Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:fire: Remove database map views while retaining location fields

Daniel91ea540429cb
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000..df86dcb179
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+app/stage/map
+app/stage/build/map
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index 5e05f9e835..cb8aa8e99a 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -680,7 +680,7 @@ jobs:
cd ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app
node scripts/trimChangelogs.js
python3 ../scripts/prepare-ocr.py
- zip -r app.zip appearance guide stage $([ -d changelogs ] && echo changelogs) -x 'stage/ocr/runtime/*'
+ zip -r app.zip appearance guide stage $([ -d changelogs ] && echo changelogs) -x 'stage/ocr/runtime/*' 'stage/map/*' 'stage/build/map/*'
zip -j app.zip ../LICENSE ../THIRD_PARTY_NOTICES.md
mkdir -p ${{ github.workspace }}/siyuan-android/app/src/main/assets
cp app.zip ${{ github.workspace }}/siyuan-android/app/src/main/assets/app.zip
diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html
index 90311b87ee..58de67d828 100644
--- a/app/appearance/icons/index.html
+++ b/app/appearance/icons/index.html
@@ -286,12 +286,6 @@
</svg>
iconGlobe
</div>
- <div>
- <svg>
- <use xlink:href="#iconMap"></use>
- </svg>
- iconMap
- </div>
<div>
<svg>
<use xlink:href="#iconMapPin"></use>
diff --git a/app/appearance/icons/litheness/icon.LICENSE b/app/appearance/icons/litheness/icon.LICENSE
index 182d1bc104..5a7cc287fe 100644
--- a/app/appearance/icons/litheness/icon.LICENSE
+++ b/app/appearance/icons/litheness/icon.LICENSE
@@ -1,5 +1,3 @@
-iconMap: https://github.com/lucide-icons/lucide/blob/main/icons/map.svg
-
ISC License
Copyright (c) 2026 Lucide Icons and Contributors
diff --git a/app/appearance/icons/litheness/icon.js b/app/appearance/icons/litheness/icon.js
index b85998ae78..7138d1bc05 100644
--- a/app/appearance/icons/litheness/icon.js
+++ b/app/appearance/icons/litheness/icon.js
@@ -142,11 +142,6 @@ document.body.insertAdjacentHTML('afterbegin', `<svg id="iconsLitheness" style="
<symbol id="iconGlobe" stroke-width="1.7" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>
</symbol>
- <symbol id="iconMap" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
- <path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" />
- <path d="M15 5.764v15" />
- <path d="M9 3.236v15" />
- </symbol>
<symbol id="iconMapPin" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" />
<circle cx="12" cy="10" r="3" />
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 5b812414c8..ee4fc66f15 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "اختيار على الخريطة",
- "mapPickedPoint": "الموقع المحدد",
- "mapCreateAtPoint": "إنشاء سجل هنا",
"syncConfig": "إعدادات خدمة المزامنة",
"clearSyncConfig": "مسح الإعدادات",
"clearSyncConfigConfirm": "هل تريد مسح العنوان وبيانات الاعتماد المحفوظة لهذه الخدمة؟ إذا كانت خدمة المزامنة الحالية، فسيتم تعطيل المزامنة أيضًا. لن تُحذف الملاحظات المحلية أو بيانات السحابة.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "تم حفظ تعديلاتك، ولكن تعذر تحديث بعض نصوص المراجع. سيعيد SiYuan المحاولة تلقائيًا.",
"clearingUnusedAssets": "جارٍ تنظيف ملفات الموارد غير المشار إليها...",
"clearingUnusedAttributeViews": "جارٍ تنظيف قواعد البيانات غير المشار إليها...",
- "extraLarge": "كبير جدًا",
- "mapUnplaced": "عناصر بلا إحداثيات",
- "mapLoadedCount": "تم تحميل ${shown}/${total}",
- "mapSkippedCount": "تم تخطي ${count}",
- "databaseMapView": "عرض الخريطة لقاعدة البيانات",
"exportBlockRefMode": "مراجع الكتل وروابط الكتل",
"configGroupOCREngine": "محرّك التعرّف",
"configGroupSignInTokens": "تسجيل الدخول والرموز",
"searchControlUnavailable": "هذا الخيار غير متاح لطريقة البحث الحالية",
- "mapAuthenticationBypass": "لا تتوفر الخرائط أثناء تفعيل تجاوز المصادقة. تظل السجلات متاحة",
- "mapView": "الخريطة",
- "mapLocationField": "حقل الموقع",
- "mapSelectLocationField": "اختر حقل الموقع",
- "mapMissingLocationField": "حقل الموقع المحفوظ غير متاح. اختر حقل موقع",
- "mapPageScope": "تعرض الخريطة ${shown} سجلًا محمّلًا من أصل ${total} سجلًا تمت تصفيته",
- "mapSkippedLocations": "المواقع المتخطاة: ${empty} بلا إحداثيات، و${invalid} غير صالحة، و${projection} بإسقاط غير مدعوم",
- "mapNoMarkers": "لا توجد مواقع متوافقة في الصفحة المحمّلة",
- "mapLoading": "جارٍ تحميل الخريطة...",
- "mapLoadError": "تعذّر تحميل الخريطة. لا تزال سجلاتك متاحة",
- "mapUnsupportedClient": "لا تتوفر بيئة معزولة للخرائط في هذا العميل. لا تزال سجلاتك متاحة",
- "mapOffline": "الخريطة غير متصلة بالإنترنت. لا تزال سجلاتك متاحة",
- "mapPublicFallback": "لا تُحمّل الخرائط في الصفحات المنشورة أو المحتوى المصدّر",
- "mapTooManyMarkers": "تحتوي هذه الصفحة على أكثر من ${limit} موقعًا. استخدم عوامل التصفية أو قلّل حجم الصفحة لعرض الخريطة",
"locationPasteInEditor": "استخدم خط العرض، خط الطول بنظام WGS84 (خط العرض من -90 إلى 90؛ خط الطول من -180 إلى 180)، أو الاسم; خط العرض, خط الطول [WGS84]",
"location": "الموقع",
"locationName": "الاسم (اختياري)",
@@ -2779,7 +2757,6 @@
"quit": "خروج من التطبيق"
},
"_attrView": {
- "map": "الخريطة",
"dateCalendar": "التقويم",
"solarCalendar": "الميلادي",
"lunarCalendar": "القمري الصيني",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 5a04386792..4b448eead4 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Auf Karte auswählen",
- "mapPickedPoint": "Ausgewählter Standort",
- "mapCreateAtPoint": "Eintrag hier erstellen",
"syncConfig": "Konfiguration des Synchronisierungsdienstes",
"clearSyncConfig": "Konfiguration löschen",
"clearSyncConfigConfirm": "Gespeicherte Adresse und Zugangsdaten dieses Dienstes löschen? Wenn dies der aktuelle Synchronisierungsdienst ist, wird auch die Synchronisierung deaktiviert. Lokale Notizen und Cloud-Daten werden nicht gelöscht.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Ihre Änderungen wurden gespeichert, aber einige Referenztexte konnten nicht aktualisiert werden. SiYuan versucht es automatisch erneut.",
"clearingUnusedAssets": "Nicht referenzierte Anhänge werden bereinigt...",
"clearingUnusedAttributeViews": "Nicht referenzierte Datenbanken werden bereinigt...",
- "extraLarge": "Sehr groß",
- "mapUnplaced": "Einträge ohne Koordinaten",
- "mapLoadedCount": "Geladen ${shown}/${total}",
- "mapSkippedCount": "Übersprungen ${count}",
- "databaseMapView": "Datenbank-Kartenansicht",
"exportBlockRefMode": "Blockreferenzen und Blocklinks",
"configGroupOCREngine": "Erkennungs-Engine",
"configGroupSignInTokens": "Anmeldung und Token",
"searchControlUnavailable": "Für die aktuelle Suchmethode nicht verfügbar",
- "mapAuthenticationBypass": "Karten sind bei aktivierter Umgehung der Authentifizierung nicht verfügbar. Datensätze bleiben verfügbar",
- "mapView": "Karte",
- "mapLocationField": "Standortfeld",
- "mapSelectLocationField": "Ein Standortfeld auswählen",
- "mapMissingLocationField": "Das gespeicherte Standortfeld ist nicht verfügbar. Ein Standortfeld auswählen",
- "mapPageScope": "Die Karte zeigt ${shown} geladene Datensätze von insgesamt ${total} gefilterten Datensätzen",
- "mapSkippedLocations": "Übersprungene Standorte: ${empty} ohne Koordinaten, ${invalid} ungültig, ${projection} mit nicht unterstützter Projektion",
- "mapNoMarkers": "Keine kompatiblen Standorte auf der geladenen Seite",
- "mapLoading": "Karte wird geladen...",
- "mapLoadError": "Die Karte konnte nicht geladen werden. Ihre Datensätze sind weiterhin verfügbar",
- "mapUnsupportedClient": "Dieser Client bietet keine isolierte Kartenumgebung. Ihre Datensätze sind weiterhin verfügbar",
- "mapOffline": "Die Karte ist offline. Ihre Datensätze sind weiterhin verfügbar",
- "mapPublicFallback": "In veröffentlichten Seiten oder Exporten werden keine Karten geladen",
- "mapTooManyMarkers": "Diese Seite enthält mehr als ${limit} Standorte. Filter verwenden oder die Seitengröße verkleinern, um die Karte anzuzeigen",
"locationPasteInEditor": "WGS84-Koordinaten als Breitengrad, Längengrad eingeben (Breitengrad -90 bis 90; Längengrad -180 bis 180) oder Name; Breitengrad, Längengrad [WGS84]",
"location": "Standort",
"locationName": "Name (optional)",
@@ -2779,7 +2757,6 @@
"quit": "Anwendung beenden"
},
"_attrView": {
- "map": "Karte",
"dateCalendar": "Kalender",
"solarCalendar": "Gregorianisch",
"lunarCalendar": "Chinesischer Mondkalender",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index c10f8c0849..daf0a74a84 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Pick on map",
- "mapPickedPoint": "Selected location",
- "mapCreateAtPoint": "Create record here",
"syncConfig": "Sync service configuration",
"clearSyncConfig": "Clear configuration",
"clearSyncConfigConfirm": "Clear this service's saved address and credentials? If it is the current sync service, sync will also be disabled. Local notes and cloud data will not be deleted.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Your edits have been saved, but some reference text could not be refreshed. SiYuan will retry automatically.",
"clearingUnusedAssets": "Cleaning up unreferenced assets...",
"clearingUnusedAttributeViews": "Cleaning up unreferenced databases...",
- "extraLarge": "Extra large",
- "mapUnplaced": "Unplaced records",
- "mapLoadedCount": "Loaded ${shown}/${total}",
- "mapSkippedCount": "Skipped ${count}",
- "databaseMapView": "Database map view",
"exportBlockRefMode": "Block refs and block links",
"configGroupOCREngine": "Recognition engine",
"configGroupSignInTokens": "Login and tokens",
"searchControlUnavailable": "Unavailable for the current search method",
- "mapAuthenticationBypass": "Maps are unavailable while authentication bypass is enabled. Records remain available",
- "mapView": "Map",
- "mapLocationField": "Location field",
- "mapSelectLocationField": "Select a location field",
- "mapMissingLocationField": "The saved location field is unavailable. Select a location field",
- "mapPageScope": "Map shows the ${shown} loaded records of ${total} filtered records",
- "mapSkippedLocations": "Skipped locations: ${empty} missing coordinates, ${invalid} invalid, ${projection} unsupported projection",
- "mapNoMarkers": "No compatible locations on the loaded page",
- "mapLoading": "Loading map...",
- "mapLoadError": "The map could not load. Your records are still available",
- "mapUnsupportedClient": "An isolated map host is not available in this client. Your records are still available",
- "mapOffline": "Map is offline. Your records are still available",
- "mapPublicFallback": "Maps are not loaded in published pages or exports",
- "mapTooManyMarkers": "This page has more than ${limit} locations. Use filters or a smaller page size to display the map",
"locationPasteInEditor": "Use WGS84 latitude, longitude (latitude -90 to 90; longitude -180 to 180), or Name; latitude, longitude [WGS84]",
"location": "Location",
"locationName": "Name (optional)",
@@ -2779,7 +2757,6 @@
"quit": "Quit application"
},
"_attrView": {
- "map": "Map",
"dateCalendar": "Calendar",
"solarCalendar": "Gregorian",
"lunarCalendar": "Chinese lunar",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 6c67fe5e4f..c458322bf4 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Elegir en el mapa",
- "mapPickedPoint": "Ubicación seleccionada",
- "mapCreateAtPoint": "Crear registro aquí",
"syncConfig": "Configuración del servicio de sincronización",
"clearSyncConfig": "Borrar configuración",
"clearSyncConfigConfirm": "¿Borrar la dirección y las credenciales guardadas de este servicio? Si es el servicio de sincronización actual, también se desactivará la sincronización. No se eliminarán las notas locales ni los datos en la nube.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Tus cambios se han guardado, pero no se ha podido actualizar parte del texto de las referencias. SiYuan lo intentará de nuevo automáticamente.",
"clearingUnusedAssets": "Limpiando recursos sin referencias...",
"clearingUnusedAttributeViews": "Limpiando bases de datos sin referencias...",
- "extraLarge": "Extragrande",
- "mapUnplaced": "Registros sin coordenadas",
- "mapLoadedCount": "Cargados ${shown}/${total}",
- "mapSkippedCount": "Omitidos ${count}",
- "databaseMapView": "Vista de mapa de la base de datos",
"exportBlockRefMode": "Referencias y enlaces de bloque",
"configGroupOCREngine": "Motor de reconocimiento",
"configGroupSignInTokens": "Inicio de sesión y tokens",
"searchControlUnavailable": "No disponible para el método de búsqueda actual",
- "mapAuthenticationBypass": "Los mapas no están disponibles mientras esté activada la omisión de autenticación. Los registros siguen disponibles",
- "mapView": "Mapa",
- "mapLocationField": "Campo de ubicación",
- "mapSelectLocationField": "Seleccione un campo de ubicación",
- "mapMissingLocationField": "El campo de ubicación guardado no está disponible. Seleccione un campo de ubicación",
- "mapPageScope": "El mapa muestra ${shown} registros cargados de ${total} registros filtrados",
- "mapSkippedLocations": "Ubicaciones omitidas: ${empty} sin coordenadas, ${invalid} no válidas, ${projection} con proyección no compatible",
- "mapNoMarkers": "No hay ubicaciones compatibles en la página cargada",
- "mapLoading": "Cargando mapa...",
- "mapLoadError": "No se pudo cargar el mapa. Sus registros siguen disponibles",
- "mapUnsupportedClient": "Este cliente no dispone de un entorno de mapas aislado. Sus registros siguen disponibles",
- "mapOffline": "El mapa está sin conexión. Sus registros siguen disponibles",
- "mapPublicFallback": "Los mapas no se cargan en páginas publicadas ni en exportaciones",
- "mapTooManyMarkers": "Esta página tiene más de ${limit} ubicaciones. Use filtros o reduzca el tamaño de página para mostrar el mapa",
"locationPasteInEditor": "Usa latitud, longitud en WGS84 (latitud de -90 a 90; longitud de -180 a 180), o Nombre; latitud, longitud [WGS84]",
"location": "Ubicación",
"locationName": "Nombre (opcional)",
@@ -2779,7 +2757,6 @@
"quit": "Salir de la aplicación"
},
"_attrView": {
- "map": "Mapa",
"dateCalendar": "Calendario",
"solarCalendar": "Gregoriano",
"lunarCalendar": "Lunar chino",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index fbb1b35010..e6981f1166 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Choisir sur la carte",
- "mapPickedPoint": "Lieu sélectionné",
- "mapCreateAtPoint": "Créer une entrée ici",
"syncConfig": "Configuration du service de synchronisation",
"clearSyncConfig": "Effacer la configuration",
"clearSyncConfigConfirm": "Effacer l’adresse et les identifiants enregistrés pour ce service ? S’il s’agit du service de synchronisation actuel, la synchronisation sera aussi désactivée. Les notes locales et les données du cloud ne seront pas supprimées.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Vos modifications ont été enregistrées, mais certains textes de référence n’ont pas pu être actualisés. SiYuan réessaiera automatiquement.",
"clearingUnusedAssets": "Nettoyage des ressources non référencées...",
"clearingUnusedAttributeViews": "Nettoyage des bases de données non référencées...",
- "extraLarge": "Très grand",
- "mapUnplaced": "Entrées sans coordonnées",
- "mapLoadedCount": "Chargés ${shown}/${total}",
- "mapSkippedCount": "Ignorés ${count}",
- "databaseMapView": "Vue carte de la base de données",
"exportBlockRefMode": "Références et liens de blocs",
"configGroupOCREngine": "Moteur de reconnaissance",
"configGroupSignInTokens": "Connexion et jetons",
"searchControlUnavailable": "Indisponible pour la méthode de recherche actuelle",
- "mapAuthenticationBypass": "Les cartes sont indisponibles lorsque le contournement de l’authentification est activé. Les enregistrements restent disponibles",
- "mapView": "Carte",
- "mapLocationField": "Champ de localisation",
- "mapSelectLocationField": "Sélectionnez un champ de localisation",
- "mapMissingLocationField": "Le champ de localisation enregistré est indisponible. Sélectionnez un champ de localisation",
- "mapPageScope": "La carte affiche ${shown} enregistrements chargés sur ${total} enregistrements filtrés",
- "mapSkippedLocations": "Localisations ignorées : ${empty} sans coordonnées, ${invalid} invalides, ${projection} avec une projection non prise en charge",
- "mapNoMarkers": "Aucune localisation compatible sur la page chargée",
- "mapLoading": "Chargement de la carte...",
- "mapLoadError": "La carte n’a pas pu être chargée. Vos enregistrements restent disponibles",
- "mapUnsupportedClient": "Ce client ne dispose pas d’un environnement cartographique isolé. Vos enregistrements restent disponibles",
- "mapOffline": "La carte est hors ligne. Vos enregistrements restent disponibles",
- "mapPublicFallback": "Les cartes ne sont pas chargées dans les pages publiées ni dans les exports",
- "mapTooManyMarkers": "Cette page comporte plus de ${limit} localisations. Utilisez des filtres ou réduisez la taille des pages pour afficher la carte",
"locationPasteInEditor": "Utilisez latitude, longitude en WGS84 (latitude de -90 à 90 ; longitude de -180 à 180), ou Nom; latitude, longitude [WGS84]",
"location": "Lieu",
"locationName": "Nom (facultatif)",
@@ -2779,7 +2757,6 @@
"quit": "Quitter le programme"
},
"_attrView": {
- "map": "Carte",
"dateCalendar": "Calendrier",
"solarCalendar": "Grégorien",
"lunarCalendar": "Lunaire chinois",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index 97ec9a16bd..f3dbf1aaeb 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "בחירה במפה",
- "mapPickedPoint": "המיקום שנבחר",
- "mapCreateAtPoint": "יצירת רשומה כאן",
"syncConfig": "הגדרות שירות הסנכרון",
"clearSyncConfig": "ניקוי ההגדרות",
"clearSyncConfigConfirm": "לנקות את הכתובת ואת פרטי ההזדהות השמורים של שירות זה? אם זהו שירות הסנכרון הנוכחי, גם הסנכרון יושבת. פתקים מקומיים ונתוני ענן לא יימחקו.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "העריכות נשמרו, אך לא ניתן היה לרענן חלק מטקסט ההפניות. SiYuan ינסה שוב אוטומטית.",
"clearingUnusedAssets": "מנקה קובצי משאבים ללא הפניות...",
"clearingUnusedAttributeViews": "מנקה מסדי נתונים ללא הפניות...",
- "extraLarge": "גדול במיוחד",
- "mapUnplaced": "רשומות ללא קואורדינטות",
- "mapLoadedCount": "נטענו ${shown}/${total}",
- "mapSkippedCount": "דולגו ${count}",
- "databaseMapView": "תצוגת מפה של מסד הנתונים",
"exportBlockRefMode": "הפניות לבלוקים וקישורי בלוקים",
"configGroupOCREngine": "מנוע זיהוי",
"configGroupSignInTokens": "כניסה ואסימונים",
"searchControlUnavailable": "האפשרות אינה זמינה בשיטת החיפוש הנוכחית",
- "mapAuthenticationBypass": "מפות אינן זמינות כאשר עקיפת האימות מופעלת. הרשומות נשארות זמינות",
- "mapView": "מפה",
- "mapLocationField": "שדה מיקום",
- "mapSelectLocationField": "בחר שדה מיקום",
- "mapMissingLocationField": "שדה המיקום השמור אינו זמין. בחר שדה מיקום",
- "mapPageScope": "המפה מציגה ${shown} רשומות שנטענו מתוך ${total} רשומות מסוננות",
- "mapSkippedLocations": "מיקומים שדולגו: ${empty} ללא קואורדינטות, ${invalid} לא תקינים, ${projection} עם היטל לא נתמך",
- "mapNoMarkers": "אין מיקומים תואמים בדף שנטען",
- "mapLoading": "טוען מפה...",
- "mapLoadError": "לא ניתן לטעון את המפה. הרשומות שלך עדיין זמינות",
- "mapUnsupportedClient": "סביבת מפות מבודדת אינה זמינה בלקוח זה. הרשומות שלך עדיין זמינות",
- "mapOffline": "המפה אינה מחוברת לרשת. הרשומות שלך עדיין זמינות",
- "mapPublicFallback": "מפות אינן נטענות בדפים שפורסמו או בתוכן שיוצא",
- "mapTooManyMarkers": "בדף זה יש יותר מ-${limit} מיקומים. השתמש במסננים או הקטן את גודל הדף כדי להציג את המפה",
"locationPasteInEditor": "יש להשתמש בקו רוחב, קו אורך לפי WGS84 (קו רוחב מ־-90 עד 90; קו אורך מ־-180 עד 180), או שם; קו רוחב, קו אורך [WGS84]",
"location": "מיקום",
"locationName": "שם (רשות)",
@@ -2779,7 +2757,6 @@
"quit": "צא מהאפליקציה"
},
"_attrView": {
- "map": "מפה",
"dateCalendar": "לוח שנה",
"solarCalendar": "גרגוריאני",
"lunarCalendar": "ירחי סיני",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index d1c17f8db5..d8ad0a71c8 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "मानचित्र पर चुनें",
- "mapPickedPoint": "चयनित स्थान",
- "mapCreateAtPoint": "यहाँ प्रविष्टि बनाएँ",
"syncConfig": "सिंक सेवा कॉन्फ़िगरेशन",
"clearSyncConfig": "कॉन्फ़िगरेशन साफ़ करें",
"clearSyncConfigConfirm": "इस सेवा का सहेजा गया पता और क्रेडेंशियल साफ़ करें? यदि यह वर्तमान सिंक सेवा है, तो सिंक भी बंद हो जाएगा। स्थानीय नोट और क्लाउड डेटा नहीं मिटाए जाएँगे।",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "आपके संपादन सहेज लिए गए हैं, लेकिन कुछ संदर्भ पाठ अपडेट नहीं हो सके। SiYuan अपने आप फिर से प्रयास करेगा।",
"clearingUnusedAssets": "बिना संदर्भ वाली संसाधन फ़ाइलें साफ़ की जा रही हैं...",
"clearingUnusedAttributeViews": "बिना संदर्भ वाले डेटाबेस साफ़ किए जा रहे हैं...",
- "extraLarge": "अतिरिक्त बड़ा",
- "mapUnplaced": "निर्देशांक के बिना प्रविष्टियाँ",
- "mapLoadedCount": "लोड हुए ${shown}/${total}",
- "mapSkippedCount": "छोड़े गए ${count}",
- "databaseMapView": "डेटाबेस मानचित्र दृश्य",
"exportBlockRefMode": "ब्लॉक रेफ़ और ब्लॉक लिंक",
"configGroupOCREngine": "पहचान इंजन",
"configGroupSignInTokens": "लॉगिन और टोकन",
"searchControlUnavailable": "वर्तमान खोज विधि में यह विकल्प उपलब्ध नहीं है",
- "mapAuthenticationBypass": "प्रमाणीकरण बायपास सक्षम होने पर मानचित्र उपलब्ध नहीं हैं। रिकॉर्ड उपलब्ध रहते हैं",
- "mapView": "मानचित्र",
- "mapLocationField": "स्थान फ़ील्ड",
- "mapSelectLocationField": "स्थान फ़ील्ड चुनें",
- "mapMissingLocationField": "सहेजा गया स्थान फ़ील्ड उपलब्ध नहीं है। स्थान फ़ील्ड चुनें",
- "mapPageScope": "मानचित्र ${total} फ़िल्टर किए गए रिकॉर्ड में से ${shown} लोड किए गए रिकॉर्ड दिखाता है",
- "mapSkippedLocations": "छोड़े गए स्थान: ${empty} में निर्देशांक नहीं हैं, ${invalid} अमान्य हैं, ${projection} का मानचित्र प्रक्षेपण समर्थित नहीं है",
- "mapNoMarkers": "लोड किए गए पृष्ठ पर कोई संगत स्थान नहीं है",
- "mapLoading": "मानचित्र लोड हो रहा है...",
- "mapLoadError": "मानचित्र लोड नहीं हो सका। आपके रिकॉर्ड अभी भी उपलब्ध हैं",
- "mapUnsupportedClient": "इस क्लाइंट में अलग-थलग मानचित्र परिवेश उपलब्ध नहीं है। आपके रिकॉर्ड अभी भी उपलब्ध हैं",
- "mapOffline": "मानचित्र ऑफ़लाइन है। आपके रिकॉर्ड अभी भी उपलब्ध हैं",
- "mapPublicFallback": "प्रकाशित पृष्ठों या निर्यात में मानचित्र लोड नहीं किए जाते",
- "mapTooManyMarkers": "इस पृष्ठ पर ${limit} से अधिक स्थान हैं। मानचित्र दिखाने के लिए फ़िल्टर उपयोग करें या पृष्ठ का आकार कम करें",
"locationPasteInEditor": "WGS84 अक्षांश, देशांतर का उपयोग करें (अक्षांश -90 से 90; देशांतर -180 से 180), या नाम; अक्षांश, देशांतर [WGS84]",
"location": "स्थान",
"locationName": "नाम (वैकल्पिक)",
@@ -2779,7 +2757,6 @@
"quit": "एप्लिकेशन से बाहर निकलें"
},
"_attrView": {
- "map": "मानचित्र",
"dateCalendar": "पंचांग",
"solarCalendar": "ग्रेगोरियन",
"lunarCalendar": "चीनी चंद्र पंचांग",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index f33338cd67..3ea0516107 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Pilih di peta",
- "mapPickedPoint": "Lokasi terpilih",
- "mapCreateAtPoint": "Buat entri di sini",
"syncConfig": "Konfigurasi layanan sinkronisasi",
"clearSyncConfig": "Hapus konfigurasi",
"clearSyncConfigConfirm": "Hapus alamat dan kredensial yang tersimpan untuk layanan ini? Jika ini layanan sinkronisasi saat ini, sinkronisasi juga akan dinonaktifkan. Catatan lokal dan data cloud tidak akan dihapus.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Perubahan Anda telah disimpan, tetapi sebagian teks referensi gagal diperbarui. SiYuan akan mencoba lagi secara otomatis.",
"clearingUnusedAssets": "Membersihkan berkas aset yang tidak dirujuk...",
"clearingUnusedAttributeViews": "Membersihkan basis data yang tidak dirujuk...",
- "extraLarge": "Sangat besar",
- "mapUnplaced": "Entri tanpa koordinat",
- "mapLoadedCount": "Dimuat ${shown}/${total}",
- "mapSkippedCount": "Dilewati ${count}",
- "databaseMapView": "Tampilan peta basis data",
"exportBlockRefMode": "Referensi blok dan tautan blok",
"configGroupOCREngine": "Mesin pengenalan",
"configGroupSignInTokens": "Login dan token",
"searchControlUnavailable": "Tidak tersedia untuk metode pencarian saat ini",
- "mapAuthenticationBypass": "Peta tidak tersedia saat fitur melewati autentikasi diaktifkan. Rekaman tetap tersedia",
- "mapView": "Peta",
- "mapLocationField": "Kolom lokasi",
- "mapSelectLocationField": "Pilih kolom lokasi",
- "mapMissingLocationField": "Kolom lokasi yang disimpan tidak tersedia. Pilih kolom lokasi",
- "mapPageScope": "Peta menampilkan ${shown} rekaman yang dimuat dari ${total} rekaman hasil penyaringan",
- "mapSkippedLocations": "Lokasi yang dilewati: ${empty} tanpa koordinat, ${invalid} tidak valid, ${projection} dengan proyeksi tidak didukung",
- "mapNoMarkers": "Tidak ada lokasi yang kompatibel pada halaman yang dimuat",
- "mapLoading": "Memuat peta...",
- "mapLoadError": "Peta tidak dapat dimuat. Rekaman Anda tetap tersedia",
- "mapUnsupportedClient": "Lingkungan peta terisolasi tidak tersedia pada klien ini. Rekaman Anda tetap tersedia",
- "mapOffline": "Peta sedang luring. Rekaman Anda tetap tersedia",
- "mapPublicFallback": "Peta tidak dimuat pada halaman yang dipublikasikan atau hasil ekspor",
- "mapTooManyMarkers": "Halaman ini memiliki lebih dari ${limit} lokasi. Gunakan filter atau ukuran halaman yang lebih kecil untuk menampilkan peta",
"locationPasteInEditor": "Gunakan lintang, bujur WGS84 (lintang -90 hingga 90; bujur -180 hingga 180), atau Nama; lintang, bujur [WGS84]",
"location": "Lokasi",
"locationName": "Nama (opsional)",
@@ -2779,7 +2757,6 @@
"quit": "Keluar aplikasi"
},
"_attrView": {
- "map": "Peta",
"dateCalendar": "Kalender",
"solarCalendar": "Gregorian",
"lunarCalendar": "Lunar Tionghoa",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index 89fe6d6bb5..298f749603 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Scegli sulla mappa",
- "mapPickedPoint": "Posizione selezionata",
- "mapCreateAtPoint": "Crea voce qui",
"syncConfig": "Configurazione del servizio di sincronizzazione",
"clearSyncConfig": "Cancella configurazione",
"clearSyncConfigConfirm": "Cancellare l’indirizzo e le credenziali salvati per questo servizio? Se è il servizio di sincronizzazione attuale, verrà disattivata anche la sincronizzazione. Le note locali e i dati nel cloud non verranno eliminati.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Le modifiche sono state salvate, ma alcuni testi dei riferimenti non sono stati aggiornati. SiYuan riproverà automaticamente.",
"clearingUnusedAssets": "Pulizia delle risorse senza riferimenti...",
"clearingUnusedAttributeViews": "Pulizia dei database senza riferimenti...",
- "extraLarge": "Molto grande",
- "mapUnplaced": "Voci senza coordinate",
- "mapLoadedCount": "Caricati ${shown}/${total}",
- "mapSkippedCount": "Ignorati ${count}",
- "databaseMapView": "Vista mappa del database",
"exportBlockRefMode": "Riferimenti e link ai blocchi",
"configGroupOCREngine": "Motore di riconoscimento",
"configGroupSignInTokens": "Accesso e token",
"searchControlUnavailable": "Non disponibile per il metodo di ricerca corrente",
- "mapAuthenticationBypass": "Le mappe non sono disponibili quando è attivo il bypass dell’autenticazione. I record restano disponibili",
- "mapView": "Mappa",
- "mapLocationField": "Campo posizione",
- "mapSelectLocationField": "Seleziona un campo posizione",
- "mapMissingLocationField": "Il campo posizione salvato non è disponibile. Seleziona un campo posizione",
- "mapPageScope": "La mappa mostra ${shown} record caricati su ${total} record filtrati",
- "mapSkippedLocations": "Posizioni ignorate: ${empty} senza coordinate, ${invalid} non valide, ${projection} con proiezione non supportata",
- "mapNoMarkers": "Nessuna posizione compatibile nella pagina caricata",
- "mapLoading": "Caricamento della mappa...",
- "mapLoadError": "Impossibile caricare la mappa. I tuoi record sono ancora disponibili",
- "mapUnsupportedClient": "Questo client non dispone di un ambiente isolato per le mappe. I tuoi record sono ancora disponibili",
- "mapOffline": "La mappa è offline. I tuoi record sono ancora disponibili",
- "mapPublicFallback": "Le mappe non vengono caricate nelle pagine pubblicate o nelle esportazioni",
- "mapTooManyMarkers": "Questa pagina contiene più di ${limit} posizioni. Usa i filtri o riduci la dimensione della pagina per visualizzare la mappa",
"locationPasteInEditor": "Usa latitudine, longitudine WGS84 (latitudine da -90 a 90; longitudine da -180 a 180), oppure Nome; latitudine, longitudine [WGS84]",
"location": "Posizione",
"locationName": "Nome (facoltativo)",
@@ -2779,7 +2757,6 @@
"quit": "Esci dall'applicazione"
},
"_attrView": {
- "map": "Mappa",
"dateCalendar": "Calendario",
"solarCalendar": "Gregoriano",
"lunarCalendar": "Lunare cinese",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index 58b8cc7b31..a6d23c2d17 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "地図で選択",
- "mapPickedPoint": "選択した位置",
- "mapCreateAtPoint": "ここに項目を作成",
"syncConfig": "同期サービスの設定",
"clearSyncConfig": "設定を消去",
"clearSyncConfigConfirm": "このサービスの保存済みアドレスと認証情報を消去しますか?現在の同期サービスの場合は同期も無効になります。ローカルのノートとクラウドのデータは削除されません。",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "編集内容は保存されましたが、一部の参照テキストを更新できませんでした。自動的に再試行します。",
"clearingUnusedAssets": "未参照のアセットを削除しています...",
"clearingUnusedAttributeViews": "未参照のデータベースを削除しています...",
- "extraLarge": "特大",
- "mapUnplaced": "座標未設定の項目",
- "mapLoadedCount": "読み込み済み ${shown}/${total}",
- "mapSkippedCount": "スキップ ${count}",
- "databaseMapView": "データベースの地図ビュー",
"exportBlockRefMode": "ブロック参照とブロックリンク",
"configGroupOCREngine": "認識エンジン",
"configGroupSignInTokens": "ログインとトークン",
"searchControlUnavailable": "現在の検索方法ではこの項目を利用できません",
- "mapAuthenticationBypass": "認証のバイパスが有効な間は地図を利用できません。レコードは引き続き利用できます",
- "mapView": "地図",
- "mapLocationField": "位置フィールド",
- "mapSelectLocationField": "位置フィールドを選択してください",
- "mapMissingLocationField": "保存された位置フィールドを利用できません。位置フィールドを選択してください",
- "mapPageScope": "地図には絞り込み後の ${total} 件のうち、読み込み済みの ${shown} 件を表示しています",
- "mapSkippedLocations": "スキップした位置:座標なし ${empty} 件、無効 ${invalid} 件、投影非対応 ${projection} 件",
- "mapNoMarkers": "読み込み済みのページに互換性のある位置がありません",
- "mapLoading": "地図を読み込み中...",
- "mapLoadError": "地図を読み込めませんでした。レコードは引き続き利用できます",
- "mapUnsupportedClient": "このクライアントでは分離された地図実行環境を利用できません。レコードは引き続き利用できます",
- "mapOffline": "地図はオフラインです。レコードは引き続き利用できます",
- "mapPublicFallback": "公開ページやエクスポートでは地図を読み込みません",
- "mapTooManyMarkers": "このページには ${limit} 件を超える位置があります。フィルターを使用するか、ページあたりの件数を減らして地図を表示してください",
"locationPasteInEditor": "WGS84 の緯度, 経度(緯度は -90 から 90、経度は -180 から 180)、または 名前; 緯度, 経度 [WGS84] の形式で入力してください",
"location": "位置",
"locationName": "名前(任意)",
@@ -2779,7 +2757,6 @@
"quit": "アプリケーションを終了"
},
"_attrView": {
- "map": "地図",
"dateCalendar": "暦",
"solarCalendar": "グレゴリオ暦",
"lunarCalendar": "旧暦(中国暦)",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 78e59fb899..768f1c9560 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "지도에서 선택",
- "mapPickedPoint": "선택한 위치",
- "mapCreateAtPoint": "여기에 항목 만들기",
"syncConfig": "동기화 서비스 설정",
"clearSyncConfig": "설정 지우기",
"clearSyncConfigConfirm": "이 서비스에 저장된 주소와 인증 정보를 지우시겠습니까? 현재 동기화 서비스인 경우 동기화도 비활성화됩니다. 로컬 노트와 클라우드 데이터는 삭제되지 않습니다.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "편집 내용은 저장되었지만 일부 참조 텍스트를 갱신하지 못했습니다. 자동으로 다시 시도합니다.",
"clearingUnusedAssets": "참조되지 않은 자산 파일을 정리하는 중...",
"clearingUnusedAttributeViews": "참조되지 않은 데이터베이스를 정리하는 중...",
- "extraLarge": "매우 크게",
- "mapUnplaced": "좌표가 없는 항목",
- "mapLoadedCount": "불러옴 ${shown}/${total}",
- "mapSkippedCount": "건너뜀 ${count}",
- "databaseMapView": "데이터베이스 지도 보기",
"exportBlockRefMode": "블록 참조와 블록 링크",
"configGroupOCREngine": "인식 엔진",
"configGroupSignInTokens": "로그인과 토큰",
"searchControlUnavailable": "현재 검색 방식에서는 이 옵션을 사용할 수 없습니다",
- "mapAuthenticationBypass": "인증 우회가 활성화된 동안에는 지도를 사용할 수 없습니다. 레코드는 계속 사용할 수 있습니다",
- "mapView": "지도",
- "mapLocationField": "위치 필드",
- "mapSelectLocationField": "위치 필드를 선택하세요",
- "mapMissingLocationField": "저장된 위치 필드를 사용할 수 없습니다. 위치 필드를 선택하세요",
- "mapPageScope": "지도에는 필터링된 ${total}개 레코드 중 불러온 ${shown}개가 표시됩니다",
- "mapSkippedLocations": "건너뛴 위치: 좌표 없음 ${empty}개, 유효하지 않음 ${invalid}개, 지원되지 않는 투영 ${projection}개",
- "mapNoMarkers": "불러온 페이지에 호환되는 위치가 없습니다",
- "mapLoading": "지도 불러오는 중...",
- "mapLoadError": "지도를 불러올 수 없습니다. 레코드는 계속 사용할 수 있습니다",
- "mapUnsupportedClient": "이 클라이언트에서는 격리된 지도 실행 환경을 사용할 수 없습니다. 레코드는 계속 사용할 수 있습니다",
- "mapOffline": "지도가 오프라인 상태입니다. 레코드는 계속 사용할 수 있습니다",
- "mapPublicFallback": "게시된 페이지나 내보낸 콘텐츠에서는 지도를 불러오지 않습니다",
- "mapTooManyMarkers": "이 페이지의 위치가 ${limit}개를 초과합니다. 지도를 표시하려면 필터를 사용하거나 페이지 크기를 줄이세요",
"locationPasteInEditor": "WGS84 위도, 경도(위도 -90~90, 경도 -180~180) 또는 이름; 위도, 경도 [WGS84] 형식으로 입력하세요",
"location": "위치",
"locationName": "이름(선택 사항)",
@@ -2779,7 +2757,6 @@
"quit": "애플리케이션 종료"
},
"_attrView": {
- "map": "지도",
"dateCalendar": "달력 체계",
"solarCalendar": "양력",
"lunarCalendar": "중국 음력",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index db19a54b0e..7153ba60f2 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Op kaart kiezen",
- "mapPickedPoint": "Geselecteerde locatie",
- "mapCreateAtPoint": "Hier item maken",
"syncConfig": "Configuratie van synchronisatiedienst",
"clearSyncConfig": "Configuratie wissen",
"clearSyncConfigConfirm": "Het opgeslagen adres en de inloggegevens van deze dienst wissen? Als dit de huidige synchronisatiedienst is, wordt synchronisatie ook uitgeschakeld. Lokale notities en cloudgegevens worden niet verwijderd.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Uw wijzigingen zijn opgeslagen, maar sommige verwijzingsteksten konden niet worden bijgewerkt. SiYuan probeert het automatisch opnieuw.",
"clearingUnusedAssets": "Niet-verwezen bijlagen opruimen...",
"clearingUnusedAttributeViews": "Niet-verwezen databases opruimen...",
- "extraLarge": "Extra groot",
- "mapUnplaced": "Items zonder coördinaten",
- "mapLoadedCount": "Geladen ${shown}/${total}",
- "mapSkippedCount": "Overgeslagen ${count}",
- "databaseMapView": "Kaartweergave van database",
"exportBlockRefMode": "Blokreferenties en bloklinks",
"configGroupOCREngine": "Herkenning-engine",
"configGroupSignInTokens": "Inloggen en tokens",
"searchControlUnavailable": "Niet beschikbaar voor de huidige zoekmethode",
- "mapAuthenticationBypass": "Kaarten zijn niet beschikbaar wanneer het omzeilen van authenticatie is ingeschakeld. Records blijven beschikbaar",
- "mapView": "Kaart",
- "mapLocationField": "Locatieveld",
- "mapSelectLocationField": "Selecteer een locatieveld",
- "mapMissingLocationField": "Het opgeslagen locatieveld is niet beschikbaar. Selecteer een locatieveld",
- "mapPageScope": "De kaart toont ${shown} geladen records van ${total} gefilterde records",
- "mapSkippedLocations": "Overgeslagen locaties: ${empty} zonder coördinaten, ${invalid} ongeldig, ${projection} met niet-ondersteunde projectie",
- "mapNoMarkers": "Geen compatibele locaties op de geladen pagina",
- "mapLoading": "Kaart laden...",
- "mapLoadError": "De kaart kon niet worden geladen. Uw records zijn nog beschikbaar",
- "mapUnsupportedClient": "Deze client heeft geen geïsoleerde kaartomgeving. Uw records zijn nog beschikbaar",
- "mapOffline": "De kaart is offline. Uw records zijn nog beschikbaar",
- "mapPublicFallback": "Kaarten worden niet geladen in gepubliceerde pagina’s of exports",
- "mapTooManyMarkers": "Deze pagina heeft meer dan ${limit} locaties. Gebruik filters of verklein de paginagrootte om de kaart weer te geven",
"locationPasteInEditor": "Gebruik WGS84-breedtegraad, lengtegraad (breedtegraad -90 tot 90; lengtegraad -180 tot 180), of Naam; breedtegraad, lengtegraad [WGS84]",
"location": "Locatie",
"locationName": "Naam (optioneel)",
@@ -2779,7 +2757,6 @@
"quit": "Applicatie afsluiten"
},
"_attrView": {
- "map": "Kaart",
"dateCalendar": "Kalender",
"solarCalendar": "Gregoriaans",
"lunarCalendar": "Chinese maankalender",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 18ea0f6db7..6d520f6590 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Wybierz na mapie",
- "mapPickedPoint": "Wybrana lokalizacja",
- "mapCreateAtPoint": "Utwórz wpis tutaj",
"syncConfig": "Konfiguracja usługi synchronizacji",
"clearSyncConfig": "Wyczyść konfigurację",
"clearSyncConfigConfirm": "Wyczyścić zapisany adres i dane uwierzytelniające tej usługi? Jeśli jest to bieżąca usługa synchronizacji, synchronizacja również zostanie wyłączona. Lokalne notatki i dane w chmurze nie zostaną usunięte.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Zmiany zostały zapisane, ale nie udało się odświeżyć części tekstów odwołań. SiYuan automatycznie spróbuje ponownie.",
"clearingUnusedAssets": "Czyszczenie nieużywanych zasobów...",
"clearingUnusedAttributeViews": "Czyszczenie nieużywanych baz danych...",
- "extraLarge": "Bardzo duży",
- "mapUnplaced": "Wpisy bez współrzędnych",
- "mapLoadedCount": "Wczytano ${shown}/${total}",
- "mapSkippedCount": "Pominięto ${count}",
- "databaseMapView": "Widok mapy bazy danych",
"exportBlockRefMode": "Odwołania i łącza do bloków",
"configGroupOCREngine": "Silnik rozpoznawania",
"configGroupSignInTokens": "Logowanie i tokeny",
"searchControlUnavailable": "Niedostępne dla bieżącej metody wyszukiwania",
- "mapAuthenticationBypass": "Mapy są niedostępne, gdy pomijanie uwierzytelniania jest włączone. Rekordy pozostają dostępne",
- "mapView": "Mapa",
- "mapLocationField": "Pole lokalizacji",
- "mapSelectLocationField": "Wybierz pole lokalizacji",
- "mapMissingLocationField": "Zapisane pole lokalizacji jest niedostępne. Wybierz pole lokalizacji",
- "mapPageScope": "Mapa pokazuje ${shown} wczytanych rekordów z ${total} przefiltrowanych",
- "mapSkippedLocations": "Pominięte lokalizacje: ${empty} bez współrzędnych, ${invalid} nieprawidłowych, ${projection} z nieobsługiwanym odwzorowaniem",
- "mapNoMarkers": "Brak zgodnych lokalizacji na wczytanej stronie",
- "mapLoading": "Wczytywanie mapy...",
- "mapLoadError": "Nie udało się wczytać mapy. Twoje rekordy są nadal dostępne",
- "mapUnsupportedClient": "Ten klient nie udostępnia izolowanego środowiska map. Twoje rekordy są nadal dostępne",
- "mapOffline": "Mapa jest offline. Twoje rekordy są nadal dostępne",
- "mapPublicFallback": "Mapy nie są wczytywane na opublikowanych stronach ani w eksportach",
- "mapTooManyMarkers": "Ta strona zawiera więcej niż ${limit} lokalizacji. Użyj filtrów lub zmniejsz rozmiar strony, aby wyświetlić mapę",
"locationPasteInEditor": "Użyj szerokości i długości geograficznej WGS84 (szerokość od -90 do 90; długość od -180 do 180) w formacie szerokość, długość lub Nazwa; szerokość, długość [WGS84]",
"location": "Lokalizacja",
"locationName": "Nazwa (opcjonalna)",
@@ -2779,7 +2757,6 @@
"quit": "Zamknij aplikację"
},
"_attrView": {
- "map": "Mapa",
"dateCalendar": "Kalendarz",
"solarCalendar": "Gregoriański",
"lunarCalendar": "Chiński księżycowy",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 83972037ec..78e8cc469a 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Escolher no mapa",
- "mapPickedPoint": "Localização selecionada",
- "mapCreateAtPoint": "Criar registro aqui",
"syncConfig": "Configuração do serviço de sincronização",
"clearSyncConfig": "Limpar configuração",
"clearSyncConfigConfirm": "Limpar o endereço e as credenciais salvos deste serviço? Se ele for o serviço de sincronização atual, a sincronização também será desativada. As notas locais e os dados na nuvem não serão excluídos.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Suas alterações foram salvas, mas alguns textos de referência não puderam ser atualizados. O SiYuan tentará novamente automaticamente.",
"clearingUnusedAssets": "Limpando recursos sem referências...",
"clearingUnusedAttributeViews": "Limpando bancos de dados sem referências...",
- "extraLarge": "Muito grande",
- "mapUnplaced": "Registros sem coordenadas",
- "mapLoadedCount": "Carregados ${shown}/${total}",
- "mapSkippedCount": "Ignorados ${count}",
- "databaseMapView": "Visualização de mapa do banco de dados",
"exportBlockRefMode": "Referências e links de bloco",
"configGroupOCREngine": "Mecanismo de reconhecimento",
"configGroupSignInTokens": "Login e tokens",
"searchControlUnavailable": "Indisponível para o método de pesquisa atual",
- "mapAuthenticationBypass": "Os mapas ficam indisponíveis enquanto a opção de ignorar a autenticação está ativada. Os registros continuam disponíveis",
- "mapView": "Mapa",
- "mapLocationField": "Campo de localização",
- "mapSelectLocationField": "Selecione um campo de localização",
- "mapMissingLocationField": "O campo de localização salvo não está disponível. Selecione um campo de localização",
- "mapPageScope": "O mapa mostra ${shown} registros carregados de ${total} registros filtrados",
- "mapSkippedLocations": "Localizações ignoradas: ${empty} sem coordenadas, ${invalid} inválidas, ${projection} com projeção não compatível",
- "mapNoMarkers": "Nenhuma localização compatível na página carregada",
- "mapLoading": "Carregando mapa...",
- "mapLoadError": "Não foi possível carregar o mapa. Seus registros continuam disponíveis",
- "mapUnsupportedClient": "Este cliente não dispõe de um ambiente isolado para mapas. Seus registros continuam disponíveis",
- "mapOffline": "O mapa está offline. Seus registros continuam disponíveis",
- "mapPublicFallback": "Os mapas não são carregados em páginas publicadas nem em exportações",
- "mapTooManyMarkers": "Esta página tem mais de ${limit} localizações. Use filtros ou reduza o tamanho da página para exibir o mapa",
"locationPasteInEditor": "Use latitude, longitude WGS84 (latitude de -90 a 90; longitude de -180 a 180), ou Nome; latitude, longitude [WGS84]",
"location": "Localização",
"locationName": "Nome (opcional)",
@@ -2779,7 +2757,6 @@
"quit": "Sair do aplicativo"
},
"_attrView": {
- "map": "Mapa",
"dateCalendar": "Calendário",
"solarCalendar": "Gregoriano",
"lunarCalendar": "Lunar chinês",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index bf8c577a5b..aebc108724 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Выбрать на карте",
- "mapPickedPoint": "Выбранное местоположение",
- "mapCreateAtPoint": "Создать запись здесь",
"syncConfig": "Настройка службы синхронизации",
"clearSyncConfig": "Очистить настройки",
"clearSyncConfigConfirm": "Удалить сохранённый адрес и учётные данные этой службы? Если это текущая служба синхронизации, синхронизация также будет отключена. Локальные заметки и облачные данные не будут удалены.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Изменения сохранены, но часть текста ссылок не удалось обновить. SiYuan автоматически повторит попытку.",
"clearingUnusedAssets": "Очистка ресурсов без ссылок...",
"clearingUnusedAttributeViews": "Очистка баз данных без ссылок...",
- "extraLarge": "Очень большой",
- "mapUnplaced": "Записи без координат",
- "mapLoadedCount": "Загружено ${shown}/${total}",
- "mapSkippedCount": "Пропущено ${count}",
- "databaseMapView": "Представление базы данных на карте",
"exportBlockRefMode": "Ссылки на блоки и гиперссылки блоков",
"configGroupOCREngine": "Движок распознавания",
"configGroupSignInTokens": "Вход и токены",
"searchControlUnavailable": "Недоступно для текущего метода поиска",
- "mapAuthenticationBypass": "Карты недоступны, пока включён обход аутентификации. Записи остаются доступными",
- "mapView": "Карта",
- "mapLocationField": "Поле местоположения",
- "mapSelectLocationField": "Выберите поле местоположения",
- "mapMissingLocationField": "Сохранённое поле местоположения недоступно. Выберите поле местоположения",
- "mapPageScope": "На карте показаны ${shown} загруженных записей из ${total} отфильтрованных",
- "mapSkippedLocations": "Пропущенные местоположения: ${empty} без координат, ${invalid} некорректных, ${projection} с неподдерживаемой проекцией",
- "mapNoMarkers": "На загруженной странице нет совместимых местоположений",
- "mapLoading": "Загрузка карты...",
- "mapLoadError": "Не удалось загрузить карту. Ваши записи по-прежнему доступны",
- "mapUnsupportedClient": "В этом клиенте нет изолированной среды для карт. Ваши записи по-прежнему доступны",
- "mapOffline": "Карта недоступна без сети. Ваши записи по-прежнему доступны",
- "mapPublicFallback": "Карты не загружаются на опубликованных страницах и в экспортированных материалах",
- "mapTooManyMarkers": "На этой странице больше ${limit} местоположений. Используйте фильтры или уменьшите размер страницы, чтобы отобразить карту",
"locationPasteInEditor": "Используйте широту, долготу WGS84 (широта от -90 до 90; долгота от -180 до 180) или Название; широта, долгота [WGS84]",
"location": "Местоположение",
"locationName": "Название (необязательно)",
@@ -2779,7 +2757,6 @@
"quit": "Выйти из приложения"
},
"_attrView": {
- "map": "Карта",
"dateCalendar": "Календарь",
"solarCalendar": "Григорианский",
"lunarCalendar": "Китайский лунный",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 0c2fadbff6..5f54ef407c 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Vybrať na mape",
- "mapPickedPoint": "Vybraná poloha",
- "mapCreateAtPoint": "Vytvoriť záznam tu",
"syncConfig": "Nastavenie služby synchronizácie",
"clearSyncConfig": "Vymazať nastavenie",
"clearSyncConfigConfirm": "Vymazať uloženú adresu a prihlasovacie údaje tejto služby? Ak ide o aktuálnu službu synchronizácie, synchronizácia sa tiež vypne. Lokálne poznámky a údaje v cloude sa neodstránia.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Vaše zmeny boli uložené, ale niektoré texty odkazov sa nepodarilo aktualizovať. SiYuan to automaticky skúsi znova.",
"clearingUnusedAssets": "Čistenie súborov príloh bez odkazov...",
"clearingUnusedAttributeViews": "Čistenie databáz bez odkazov...",
- "extraLarge": "Veľmi veľký",
- "mapUnplaced": "Záznamy bez súradníc",
- "mapLoadedCount": "Načítané ${shown}/${total}",
- "mapSkippedCount": "Vynechané ${count}",
- "databaseMapView": "Mapové zobrazenie databázy",
"exportBlockRefMode": "Odkazy na bloky a prepojenia blokov",
"configGroupOCREngine": "Mechanizmus rozpoznávania",
"configGroupSignInTokens": "Prihlásenie a tokeny",
"searchControlUnavailable": "Nie je dostupné pre aktuálnu metódu vyhľadávania",
- "mapAuthenticationBypass": "Mapy nie sú dostupné, keď je zapnuté obchádzanie overenia totožnosti. Záznamy zostávajú dostupné",
- "mapView": "Mapa",
- "mapLocationField": "Pole polohy",
- "mapSelectLocationField": "Vyberte pole polohy",
- "mapMissingLocationField": "Uložené pole polohy nie je dostupné. Vyberte pole polohy",
- "mapPageScope": "Mapa zobrazuje ${shown} načítaných záznamov z ${total} filtrovaných záznamov",
- "mapSkippedLocations": "Vynechané polohy: ${empty} bez súradníc, ${invalid} neplatných, ${projection} s nepodporovanou projekciou",
- "mapNoMarkers": "Na načítanej stránke nie sú kompatibilné polohy",
- "mapLoading": "Načítava sa mapa...",
- "mapLoadError": "Mapu sa nepodarilo načítať. Vaše záznamy sú naďalej dostupné",
- "mapUnsupportedClient": "V tomto klientovi nie je dostupné izolované mapové prostredie. Vaše záznamy sú naďalej dostupné",
- "mapOffline": "Mapa je offline. Vaše záznamy sú naďalej dostupné",
- "mapPublicFallback": "Mapy sa nenačítavajú na publikovaných stránkach ani v exportoch",
- "mapTooManyMarkers": "Táto stránka obsahuje viac ako ${limit} polôh. Na zobrazenie mapy použite filtre alebo menšiu veľkosť stránky",
"locationPasteInEditor": "Použite zemepisnú šírku, zemepisnú dĺžku WGS84 (šírka od -90 do 90; dĺžka od -180 do 180) alebo Názov; zemepisná šírka, zemepisná dĺžka [WGS84]",
"location": "Poloha",
"locationName": "Názov (voliteľný)",
@@ -2779,7 +2757,6 @@
"quit": "Ukončiť aplikáciu"
},
"_attrView": {
- "map": "Mapa",
"dateCalendar": "Kalendár",
"solarCalendar": "Gregoriánsky",
"lunarCalendar": "Čínsky lunárny",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index 18fdb2bc71..7d2a26bddb 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Изабери на мапи",
- "mapPickedPoint": "Изабрана локација",
- "mapCreateAtPoint": "Направи запис овде",
"syncConfig": "Подешавање услуге синхронизације",
"clearSyncConfig": "Обриши подешавања",
"clearSyncConfigConfirm": "Обрисати сачувану адресу и приступне податке ове услуге? Ако је ово тренутна услуга синхронизације, синхронизација ће такође бити искључена. Локалне белешке и подаци у облаку неће бити обрисани.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Измене су сачуване, али део текста референци није ажуриран. SiYuan ће аутоматски покушати поново.",
"clearingUnusedAssets": "Чишћење датотека ресурса без референци...",
"clearingUnusedAttributeViews": "Чишћење база података без референци...",
- "extraLarge": "Веома велико",
- "mapUnplaced": "Записи без координата",
- "mapLoadedCount": "Учитано ${shown}/${total}",
- "mapSkippedCount": "Прескочено ${count}",
- "databaseMapView": "Приказ базе података на мапи",
"exportBlockRefMode": "Reference blokova i veze blokova",
"configGroupOCREngine": "Mehanizam prepoznavanja",
"configGroupSignInTokens": "Prijava i tokeni",
"searchControlUnavailable": "Није доступно за тренутни начин претраге",
- "mapAuthenticationBypass": "Мапе нису доступне док је укључено заобилажење аутентификације. Записи остају доступни",
- "mapView": "Мапа",
- "mapLocationField": "Поље локације",
- "mapSelectLocationField": "Изаберите поље локације",
- "mapMissingLocationField": "Сачувано поље локације није доступно. Изаберите поље локације",
- "mapPageScope": "Мапа приказује ${shown} учитаних записа од ${total} филтрираних записа",
- "mapSkippedLocations": "Прескочене локације: ${empty} без координата, ${invalid} неисправних, ${projection} са неподржаном пројекцијом",
- "mapNoMarkers": "Нема компатибилних локација на учитаној страници",
- "mapLoading": "Учитавање мапе...",
- "mapLoadError": "Мапа није могла да се учита. Ваши записи су и даље доступни",
- "mapUnsupportedClient": "Овај клијент нема изоловано окружење за мапе. Ваши записи су и даље доступни",
- "mapOffline": "Мапа је ван мреже. Ваши записи су и даље доступни",
- "mapPublicFallback": "Мапе се не учитавају на објављеним страницама ни у извезеним садржајима",
- "mapTooManyMarkers": "Ова страница има више од ${limit} локација. Користите филтере или смањите величину странице да бисте приказали мапу",
"locationPasteInEditor": "Користите географску ширину, географску дужину WGS84 (ширина од -90 до 90; дужина од -180 до 180) или Назив; географска ширина, географска дужина [WGS84]",
"location": "Локација",
"locationName": "Назив (опционо)",
@@ -2779,7 +2757,6 @@
"quit": "Ugasi aplikaciju"
},
"_attrView": {
- "map": "Мапа",
"dateCalendar": "Календар",
"solarCalendar": "Грегоријански",
"lunarCalendar": "Кинески лунарни",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index f5496f4648..94707ca717 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "เลือกบนแผนที่",
- "mapPickedPoint": "ตำแหน่งที่เลือก",
- "mapCreateAtPoint": "สร้างรายการที่นี่",
"syncConfig": "การตั้งค่าบริการซิงค์",
"clearSyncConfig": "ล้างการตั้งค่า",
"clearSyncConfigConfirm": "ล้างที่อยู่และข้อมูลรับรองที่บันทึกไว้ของบริการนี้หรือไม่? หากเป็นบริการซิงค์ปัจจุบัน การซิงค์จะถูกปิดด้วย บันทึกในเครื่องและข้อมูลบนคลาวด์จะไม่ถูกลบ",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "บันทึกการแก้ไขแล้ว แต่ไม่สามารถอัปเดตข้อความอ้างอิงบางส่วนได้ SiYuan จะลองใหม่โดยอัตโนมัติ",
"clearingUnusedAssets": "กำลังล้างไฟล์ทรัพยากรที่ไม่มีการอ้างอิง...",
"clearingUnusedAttributeViews": "กำลังล้างฐานข้อมูลที่ไม่มีการอ้างอิง...",
- "extraLarge": "ใหญ่พิเศษ",
- "mapUnplaced": "รายการที่ไม่มีพิกัด",
- "mapLoadedCount": "โหลดแล้ว ${shown}/${total}",
- "mapSkippedCount": "ข้าม ${count}",
- "databaseMapView": "มุมมองแผนที่ฐานข้อมูล",
"exportBlockRefMode": "การอ้างอิงบล็อกและลิงก์บล็อก",
"configGroupOCREngine": "กลไกการรู้จำ",
"configGroupSignInTokens": "เข้าสู่ระบบและโทเค็น",
"searchControlUnavailable": "ตัวเลือกนี้ไม่พร้อมใช้งานสำหรับวิธีค้นหาปัจจุบัน",
- "mapAuthenticationBypass": "แผนที่ไม่พร้อมใช้งานขณะเปิดใช้การข้ามการยืนยันตัวตน ระเบียนยังคงพร้อมใช้งาน",
- "mapView": "แผนที่",
- "mapLocationField": "ฟิลด์ตำแหน่ง",
- "mapSelectLocationField": "เลือกฟิลด์ตำแหน่ง",
- "mapMissingLocationField": "ฟิลด์ตำแหน่งที่บันทึกไว้ไม่พร้อมใช้งาน โปรดเลือกฟิลด์ตำแหน่ง",
- "mapPageScope": "แผนที่แสดงระเบียนที่โหลดแล้ว ${shown} รายการจากระเบียนที่กรองแล้วทั้งหมด ${total} รายการ",
- "mapSkippedLocations": "ตำแหน่งที่ข้าม: ไม่มีพิกัด ${empty} รายการ ไม่ถูกต้อง ${invalid} รายการ ไม่รองรับการฉายแผนที่ ${projection} รายการ",
- "mapNoMarkers": "ไม่มีตำแหน่งที่เข้ากันได้ในหน้าที่โหลดแล้ว",
- "mapLoading": "กำลังโหลดแผนที่...",
- "mapLoadError": "ไม่สามารถโหลดแผนที่ได้ ระเบียนของคุณยังคงพร้อมใช้งาน",
- "mapUnsupportedClient": "ไคลเอนต์นี้ไม่มีสภาพแวดล้อมแผนที่แบบแยกส่วน ระเบียนของคุณยังคงพร้อมใช้งาน",
- "mapOffline": "แผนที่ออฟไลน์ ระเบียนของคุณยังคงพร้อมใช้งาน",
- "mapPublicFallback": "แผนที่จะไม่โหลดในหน้าที่เผยแพร่หรือเนื้อหาที่ส่งออก",
- "mapTooManyMarkers": "หน้านี้มีตำแหน่งมากกว่า ${limit} รายการ ใช้ตัวกรองหรือลดขนาดหน้าเพื่อแสดงแผนที่",
"locationPasteInEditor": "ใช้รูปแบบละติจูด, ลองจิจูด WGS84 (ละติจูด -90 ถึง 90; ลองจิจูด -180 ถึง 180) หรือ ชื่อ; ละติจูด, ลองจิจูด [WGS84]",
"location": "ตำแหน่ง",
"locationName": "ชื่อ (ไม่บังคับ)",
@@ -2779,7 +2757,6 @@
"quit": "ออก"
},
"_attrView": {
- "map": "แผนที่",
"dateCalendar": "ระบบปฏิทิน",
"solarCalendar": "เกรกอเรียน",
"lunarCalendar": "จันทรคติจีน",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index a8ec8dd509..efd4565d8b 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Haritada seç",
- "mapPickedPoint": "Seçilen konum",
- "mapCreateAtPoint": "Burada kayıt oluştur",
"syncConfig": "Eşitleme hizmeti yapılandırması",
"clearSyncConfig": "Yapılandırmayı temizle",
"clearSyncConfigConfirm": "Bu hizmetin kayıtlı adresi ve kimlik bilgileri temizlensin mi? Geçerli eşitleme hizmetiyse eşitleme de devre dışı bırakılır. Yerel notlar ve bulut verileri silinmez.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Düzenlemeleriniz kaydedildi ancak bazı başvuru metinleri yenilenemedi. SiYuan otomatik olarak yeniden deneyecek.",
"clearingUnusedAssets": "Başvurulmayan kaynak dosyaları temizleniyor...",
"clearingUnusedAttributeViews": "Başvurulmayan veritabanları temizleniyor...",
- "extraLarge": "Çok büyük",
- "mapUnplaced": "Koordinatı olmayan kayıtlar",
- "mapLoadedCount": "Yüklendi ${shown}/${total}",
- "mapSkippedCount": "Atlandı ${count}",
- "databaseMapView": "Veritabanı harita görünümü",
"exportBlockRefMode": "Blok başvuruları ve blok bağlantıları",
"configGroupOCREngine": "Tanıma motoru",
"configGroupSignInTokens": "Giriş ve tokenlar",
"searchControlUnavailable": "Geçerli arama yöntemi için kullanılamaz",
- "mapAuthenticationBypass": "Kimlik doğrulamayı atlama etkinken haritalar kullanılamaz. Kayıtlar kullanılabilir durumda kalır",
- "mapView": "Harita",
- "mapLocationField": "Konum alanı",
- "mapSelectLocationField": "Bir konum alanı seçin",
- "mapMissingLocationField": "Kayıtlı konum alanı kullanılamıyor. Bir konum alanı seçin",
- "mapPageScope": "Harita, filtrelenmiş ${total} kayıttan yüklenen ${shown} kaydı gösterir",
- "mapSkippedLocations": "Atlanan konumlar: ${empty} koordinatsız, ${invalid} geçersiz, ${projection} desteklenmeyen izdüşümde",
- "mapNoMarkers": "Yüklenen sayfada uyumlu konum yok",
- "mapLoading": "Harita yükleniyor...",
- "mapLoadError": "Harita yüklenemedi. Kayıtlarınız hâlâ kullanılabilir",
- "mapUnsupportedClient": "Bu istemcide yalıtılmış bir harita ortamı bulunmuyor. Kayıtlarınız hâlâ kullanılabilir",
- "mapOffline": "Harita çevrimdışı. Kayıtlarınız hâlâ kullanılabilir",
- "mapPublicFallback": "Yayımlanan sayfalarda veya dışa aktarılan içerikte haritalar yüklenmez",
- "mapTooManyMarkers": "Bu sayfada ${limit} konumdan fazla konum var. Haritayı göstermek için filtreleri kullanın veya sayfa boyutunu küçültün",
"locationPasteInEditor": "WGS84 enlem, boylam biçimini (enlem -90 ile 90; boylam -180 ile 180) veya Ad; enlem, boylam [WGS84] biçimini kullanın",
"location": "Konum",
"locationName": "Ad (isteğe bağlı)",
@@ -2779,7 +2757,6 @@
"quit": "Uygulamadan çık"
},
"_attrView": {
- "map": "Harita",
"dateCalendar": "Takvim",
"solarCalendar": "Miladi",
"lunarCalendar": "Çin ay takvimi",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index b2f7cd2228..d69901fd51 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "Вибрати на мапі",
- "mapPickedPoint": "Вибране розташування",
- "mapCreateAtPoint": "Створити запис тут",
"syncConfig": "Налаштування служби синхронізації",
"clearSyncConfig": "Очистити налаштування",
"clearSyncConfigConfirm": "Видалити збережену адресу й облікові дані цієї служби? Якщо це поточна служба синхронізації, синхронізацію також буде вимкнено. Локальні нотатки та хмарні дані не буде видалено.",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "Зміни збережено, але частину тексту посилань не вдалося оновити. SiYuan автоматично повторить спробу.",
"clearingUnusedAssets": "Очищення ресурсів без посилань...",
"clearingUnusedAttributeViews": "Очищення баз даних без посилань...",
- "extraLarge": "Дуже великий",
- "mapUnplaced": "Записи без координат",
- "mapLoadedCount": "Завантажено ${shown}/${total}",
- "mapSkippedCount": "Пропущено ${count}",
- "databaseMapView": "Подання бази даних на мапі",
"exportBlockRefMode": "Посилання на блоки та гіперпосилання блоків",
"configGroupOCREngine": "Рушій розпізнавання",
"configGroupSignInTokens": "Вхід і токени",
"searchControlUnavailable": "Недоступно для поточного методу пошуку",
- "mapAuthenticationBypass": "Мапи недоступні, доки ввімкнено обхід автентифікації. Записи залишаються доступними",
- "mapView": "Мапа",
- "mapLocationField": "Поле місцеположення",
- "mapSelectLocationField": "Виберіть поле місцеположення",
- "mapMissingLocationField": "Збережене поле місцеположення недоступне. Виберіть поле місцеположення",
- "mapPageScope": "Мапа показує ${shown} завантажених записів із ${total} відфільтрованих",
- "mapSkippedLocations": "Пропущені місцеположення: ${empty} без координат, ${invalid} недійсних, ${projection} з непідтримуваною проєкцією",
- "mapNoMarkers": "На завантаженій сторінці немає сумісних місцеположень",
- "mapLoading": "Завантаження мапи...",
- "mapLoadError": "Не вдалося завантажити мапу. Ваші записи залишаються доступними",
- "mapUnsupportedClient": "У цьому клієнті немає ізольованого середовища для мап. Ваші записи залишаються доступними",
- "mapOffline": "Мапа недоступна без мережі. Ваші записи залишаються доступними",
- "mapPublicFallback": "Мапи не завантажуються на опублікованих сторінках і в експортованих матеріалах",
- "mapTooManyMarkers": "На цій сторінці понад ${limit} місцеположень. Використайте фільтри або зменште розмір сторінки, щоб показати мапу",
"locationPasteInEditor": "Використовуйте широту, довготу WGS84 (широта від -90 до 90; довгота від -180 до 180) або Назва; широта, довгота [WGS84]",
"location": "Розташування",
"locationName": "Назва (необов’язково)",
@@ -2779,7 +2757,6 @@
"quit": "Вийти із застосунку"
},
"_attrView": {
- "map": "Мапа",
"dateCalendar": "Календар",
"solarCalendar": "Григоріанський",
"lunarCalendar": "Китайський місячний",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 6b2787c3ce..3263fefb3c 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "地图选点",
- "mapPickedPoint": "已选位置",
- "mapCreateAtPoint": "在此创建条目",
"syncConfig": "同步服务配置",
"clearSyncConfig": "清除配置",
"clearSyncConfigConfirm": "清除该服务保存的地址和凭据?如果它是当前同步服务,将同时关闭同步。本地笔记和云端数据不会被删除。",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "编辑已保存,但部分引用文本刷新失败,思源将自动重试。",
"clearingUnusedAssets": "正在清理未引用的资源文件...",
"clearingUnusedAttributeViews": "正在清理未引用的数据库...",
- "extraLarge": "超大",
- "mapUnplaced": "未定位条目",
- "mapLoadedCount": "已加载 ${shown}/${total}",
- "mapSkippedCount": "已跳过 ${count}",
- "databaseMapView": "数据库 地图视图",
"exportBlockRefMode": "块引用与块超链接",
"configGroupOCREngine": "识别引擎",
"configGroupSignInTokens": "登录与令牌",
"searchControlUnavailable": "当前搜索方式不支持此选项",
- "mapAuthenticationBypass": "启用鉴权绕过时无法使用地图,记录仍可访问",
- "mapView": "地图",
- "mapLocationField": "位置字段",
- "mapSelectLocationField": "请选择位置字段",
- "mapMissingLocationField": "保存的位置字段不可用,请选择位置字段",
- "mapPageScope": "地图范围为筛选结果中已加载的 ${shown} 条记录,共 ${total} 条",
- "mapSkippedLocations": "已跳过的位置:${empty} 条缺少坐标,${invalid} 条无效,${projection} 个投影不支持",
- "mapNoMarkers": "已加载的记录中没有兼容的位置",
- "mapLoading": "正在加载地图...",
- "mapLoadError": "地图无法加载,记录仍然可用",
- "mapUnsupportedClient": "此客户端尚不支持隔离的地图运行环境,记录仍然可用",
- "mapOffline": "地图处于离线状态,记录仍然可用",
- "mapPublicFallback": "发布页面和导出内容不加载地图",
- "mapTooManyMarkers": "当前页面的位置超过 ${limit} 个,请使用筛选或减小每页记录数以显示地图",
"locationPasteInEditor": "请使用 WGS84 纬度, 经度(纬度 -90 到 90;经度 -180 到 180),或 名称; 纬度, 经度 [WGS84] 格式",
"location": "位置",
"locationName": "名称(可选)",
@@ -2779,7 +2757,6 @@
"quit": "退出程序"
},
"_attrView": {
- "map": "地图",
"dateCalendar": "历法",
"solarCalendar": "公历",
"lunarCalendar": "农历",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 4ded69d086..0e6f03060d 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,7 +1,4 @@
{
- "locationPickOnMap": "地圖選點",
- "mapPickedPoint": "已選位置",
- "mapCreateAtPoint": "在此建立項目",
"syncConfig": "同步服務設定",
"clearSyncConfig": "清除設定",
"clearSyncConfigConfirm": "清除這項服務儲存的位址和憑證?如果它是目前的同步服務,也會關閉同步。本機筆記和雲端資料不會被刪除。",
@@ -13,29 +10,10 @@
"dynamicRefTextRefreshRetry": "編輯已儲存,但部分引用文字更新失敗,思源將自動重試。",
"clearingUnusedAssets": "正在清理未引用的資源檔案...",
"clearingUnusedAttributeViews": "正在清理未引用的資料庫...",
- "extraLarge": "超大",
- "mapUnplaced": "未定位項目",
- "mapLoadedCount": "已載入 ${shown}/${total}",
- "mapSkippedCount": "已略過 ${count}",
- "databaseMapView": "資料庫 地圖視圖",
"exportBlockRefMode": "區塊引用與區塊超鏈接",
"configGroupOCREngine": "辨識引擎",
"configGroupSignInTokens": "登入與權杖",
"searchControlUnavailable": "目前的搜尋方式不支援此選項",
- "mapAuthenticationBypass": "啟用驗證繞過時無法使用地圖,記錄仍可存取",
- "mapView": "地圖",
- "mapLocationField": "位置欄位",
- "mapSelectLocationField": "請選擇位置欄位",
- "mapMissingLocationField": "儲存的位置欄位無法使用,請選擇位置欄位",
- "mapPageScope": "地圖範圍為篩選結果中已載入的 ${shown} 筆記錄,共 ${total} 筆",
- "mapSkippedLocations": "已略過的位置:${empty} 筆缺少座標,${invalid} 筆無效,${projection} 個投影不支援",
- "mapNoMarkers": "已載入的記錄中沒有相容的位置",
- "mapLoading": "正在載入地圖...",
- "mapLoadError": "地圖無法載入,記錄仍然可用",
- "mapUnsupportedClient": "此用戶端尚不支援隔離的地圖執行環境,記錄仍然可用",
- "mapOffline": "地圖處於離線狀態,記錄仍然可用",
- "mapPublicFallback": "發佈頁面和匯出內容不載入地圖",
- "mapTooManyMarkers": "目前頁面的位置超過 ${limit} 個,請使用篩選或減少每頁記錄數以顯示地圖",
"locationPasteInEditor": "請使用 WGS84 緯度, 經度(緯度 -90 到 90;經度 -180 到 180),或 名稱; 緯度, 經度 [WGS84] 格式",
"location": "位置",
"locationName": "名稱(選填)",
@@ -2779,7 +2757,6 @@
"quit": "退出程序"
},
"_attrView": {
- "map": "地圖",
"dateCalendar": "曆法",
"solarCalendar": "西曆",
"lunarCalendar": "農曆",
diff --git a/app/electron-builder-arm64.yml b/app/electron-builder-arm64.yml
index 6100259ffb..9c4e092941 100644
--- a/app/electron-builder-arm64.yml
+++ b/app/electron-builder-arm64.yml
@@ -52,7 +52,7 @@ extraResources:
to: "changelogs"
- from: "stage"
to: "stage"
- filter: ["**/*", "!ocr/runtime/**/*"]
+ filter: ["**/*", "!ocr/runtime/**/*", "!map/**/*", "!build/map/**/*"]
- from: "stage/ocr/runtime/windows-arm64"
to: "stage/ocr/runtime/windows-arm64"
- from: "guide"
diff --git a/app/electron-builder-darwin-arm64.yml b/app/electron-builder-darwin-arm64.yml
index 59b207bcdb..1050c73495 100644
--- a/app/electron-builder-darwin-arm64.yml
+++ b/app/electron-builder-darwin-arm64.yml
@@ -46,7 +46,7 @@ extraResources:
to: "changelogs"
- from: "stage"
to: "stage"
- filter: ["**/*", "!ocr/runtime/**/*"]
+ filter: ["**/*", "!ocr/runtime/**/*", "!map/**/*", "!build/map/**/*"]
- from: "stage/ocr/runtime/darwin-arm64"
to: "stage/ocr/runtime/darwin-arm64"
- from: "guide"
diff --git a/app/electron-builder-darwin.yml b/app/electron-builder-darwin.yml
index 49fec92250..34634229b5 100644
--- a/app/electron-builder-darwin.yml
+++ b/app/electron-builder-darwin.yml
@@ -46,7 +46,7 @@ extraResources:
to: "changelogs"
- from: "stage"
to: "stage"
- filter: ["**/*", "!ocr/runtime/**/*"]
+ filter: ["**/*", "!ocr/runtime/**/*", "!map/**/*", "!build/map/**/*"]
- from: "stage/ocr/runtime/darwin-amd64"
to: "stage/ocr/runtime/darwin-amd64"
- from: "guide"
diff --git a/app/electron-builder-linux-arm64.yml b/app/electron-builder-linux-arm64.yml
index 9ce97a550a..3f0b043066 100644
--- a/app/electron-builder-linux-arm64.yml
+++ b/app/electron-builder-linux-arm64.yml
@@ -55,7 +55,7 @@ extraResources:
to: "changelogs"
- from: "stage"
to: "stage"
- filter: ["**/*", "!ocr/runtime/**/*"]
+ filter: ["**/*", "!ocr/runtime/**/*", "!map/**/*", "!build/map/**/*"]
- from: "stage/ocr/runtime/linux-arm64"
to: "stage/ocr/runtime/linux-arm64"
- from: "guide"
diff --git a/app/electron-builder-linux.yml b/app/electron-builder-linux.yml
index 9fb331d17b..82e0e97dea 100644
--- a/app/electron-builder-linux.yml
+++ b/app/electron-builder-linux.yml
@@ -52,7 +52,7 @@ extraResources:
to: "changelogs"
- from: "stage"
to: "stage"
- filter: ["**/*", "!ocr/runtime/**/*"]
+ filter: ["**/*", "!ocr/runtime/**/*", "!map/**/*", "!build/map/**/*"]
- from: "stage/ocr/runtime/linux-amd64"
to: "stage/ocr/runtime/linux-amd64"
- from: "guide"
diff --git a/app/electron-builder.yml b/app/electron-builder.yml
index eed41b0ed4..ad5440f794 100644
--- a/app/electron-builder.yml
+++ b/app/electron-builder.yml
@@ -51,7 +51,7 @@ extraResources:
to: "changelogs"
- from: "stage"
to: "stage"
- filter: ["**/*", "!ocr/runtime/**/*"]
+ filter: ["**/*", "!ocr/runtime/**/*", "!map/**/*", "!build/map/**/*"]
- from: "stage/ocr/runtime/windows-amd64"
to: "stage/ocr/runtime/windows-amd64"
- from: "guide"
diff --git a/app/electron/main.js b/app/electron/main.js
index f8d1d781f7..a2a0c7f58a 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -21,7 +21,6 @@ const {
net,
app,
BrowserWindow,
- MessageChannelMain,
Notification,
shell,
session,
@@ -81,7 +80,6 @@ const {WindowWorkspaceRegistry, flushWindowWorkspaces} = require("./windowWorksp
const {captureWindowGeometry, normalizeWindowGeometry, restoreWindowGeometry} = require("./windowGeometry");
const {createSettingsWindows} = require("./settingsWindows");
const {createSettingsTaskBridge} = require("./settingsTasks");
-const {createMapHostManager} = require("./mapHostManager");
const {bindWebviewDevToolsShortcut} = require("./webviewDevTools");
const windowWorkspaces = new WindowWorkspaceRegistry();
const {createNotebookSystemLock, prepareNotebookSystemLock} = require("./notebookSystemLock");
@@ -131,7 +129,6 @@ const notebookSystemLock = createNotebookSystemLock({
});
const windowKernelTargets = new Map();
const initializedWindowIds = new Set();
-let mapHostManager;
const pendingWindowIds = new Set();
createSettingsTaskBridge({
ipcMain,
@@ -1386,8 +1383,6 @@ const getKernelTarget = (target = kernelPort) => {
const rememberWindowKernelTarget = (window, target) => {
const webContentsId = window.webContents.id;
windowKernelTargets.set(webContentsId, target);
- // 在首次加载前登记宿主,远程窗口仅允许已授权的内置地图 guest。
- mapHostManager.registerOwner(window.webContents);
blockDragWindowFocusOrder.set(webContentsId, ++blockDragWindowFocusSequence);
window.on("focus", () => {
blockDragWindowFocusOrder.set(webContentsId, ++blockDragWindowFocusSequence);
@@ -1399,6 +1394,10 @@ const rememberWindowKernelTarget = (window, target) => {
writeLog("blocked subframe navigation in remote kernel mode [url=" + event.url + "]");
}
});
+ window.webContents.on("will-attach-webview", (event) => {
+ event.preventDefault();
+ writeLog("blocked webview creation in remote kernel mode");
+ });
}
window.webContents.on("did-start-navigation", (details) => {
if (details.isMainFrame && !details.isSameDocument) {
@@ -2188,7 +2187,7 @@ const initMainWindow = (kernel = kernelPort, remoteAuthenticated = true) => {
nodeIntegration: true,
nodeIntegrationInSubFrames: false,
nodeIntegrationInWorker: false,
- webviewTag: true,
+ webviewTag: kernelTarget.mode !== "remote",
webSecurity: kernelTarget.mode === "remote",
...(kernelTarget.mode === "remote" ? {session: getRemoteSession(kernelTarget)} : {}),
contextIsolation: false,
@@ -2927,8 +2926,6 @@ const initRemoteKernel = async (target) => {
};
app.whenReady().then(() => {
- mapHostManager = createMapHostManager({app, ipcMain, session, BrowserWindow, MessageChannelMain, appDir,
- getTarget: id => getWindowKernelTarget(id), isInitialized: id => initializedWindowIds.has(id)});
const startupStartedAt = Date.now();
writeLog("app ready, preparing startup window");
const appCrashInfo = readAppCrashInfo();
@@ -3910,7 +3907,7 @@ app.whenReady().then(() => {
nodeIntegration: true,
nodeIntegrationInSubFrames: false,
nodeIntegrationInWorker: false,
- webviewTag: true,
+ webviewTag: kernelTarget.mode !== "remote",
webSecurity: kernelTarget.mode === "remote",
...(kernelTarget.mode === "remote" ? {session: getRemoteSession(kernelTarget)} : {}),
autoplayPolicy: "user-gesture-required" // 桌面端禁止自动播放多媒体 https://github.com/siyuan-note/siyuan/issues/7587
diff --git a/app/electron/mapHostDiagnostics.js b/app/electron/mapHostDiagnostics.js
deleted file mode 100644
index 88f68f6acd..0000000000
--- a/app/electron/mapHostDiagnostics.js
+++ /dev/null
@@ -1,75 +0,0 @@
-// 仅返回固定分类或受限公共主机名,不转发 SDK 日志、完整地址、脚本片段或凭据。
-const MAX_MAP_DIAGNOSTICS = 64;
-const mapDiagnosticCodes = Object.freeze([
- "hostSetupFailed", "assetUnavailable", "documentLoadFailed", "bootstrapTimeout", "sdkTimeout",
- "providerRequestDenied", "providerInsecureRequest", "providerHTTPFailure", "providerNetworkFailure",
- "cspScript", "cspWorker", "cspConnect", "cspImage", "cspStyle", "cspEval", "cspWasm",
- "storageUnavailable", "webglUnavailable",
-]);
-const mapCSPDiagnosticCodes = Object.freeze(["cspScript", "cspWorker", "cspConnect", "cspImage", "cspStyle", "cspEval", "cspWasm"]);
-const mapCSPResourceCodes = Object.freeze([
- "blob", "data", "inline", "eval", "wasm", "other",
- "owner-origin", "local-address", "redacted",
-]);
-const isMapCSPHostname = value => value === "tiles.openfreemap.org";
-const isMapCSPResource = value => {
- if (typeof value !== "string" || value.length > 102) return false;
- if (mapCSPResourceCodes.includes(value)) return true;
- const hostname = /^https?:([a-z0-9.-]+)$/.exec(value)?.[1];
- return isMapCSPHostname(hostname);
-};
-
-const classifyMapCSPResources = (message, ownerOrigin) => {
- if (typeof message !== "string" || message.length > 32768 || !/content security policy/i.test(message)) return [];
- // Chromium 的 eval 文案在 directive 和实际策略之间还有原因,不能按资源 URL 解析。
- if (/^(?:Evaluating a string as JavaScript|Refused to evaluate a string as JavaScript)/i.test(message)) {
- return [{code: "cspEval", resource: "eval"}];
- }
- if (/^(?:Compiling or instantiating|Refused to compile or instantiate) a WebAssembly/i.test(message)) {
- return [{code: "cspWasm", resource: "wasm"}];
- }
- const directive = message.match(/content security policy directive:?\s*["'](worker-src|child-src|script-src(?:-elem|-attr)?|connect-src|img-src|style-src(?:-elem|-attr)?)\b/i)?.[1].toLowerCase();
- if (!directive) return [];
- const code = directive.startsWith("script-src") ? "cspScript" : directive.startsWith("style-src") ? "cspStyle" :
- ({"worker-src": "cspWorker", "child-src": "cspWorker", "connect-src": "cspConnect", "img-src": "cspImage"})[directive];
- let resource = "other";
- if (/^(?:Executing inline|Applying inline|Refused to execute inline|Refused to apply inline)/i.test(message)) {
- resource = "inline";
- } else {
- const target = message.match(/(?:loading the script|loading a script|load the script|connecting to|connect to|creating a worker from|create a worker from|loading the image|load the image|loading the stylesheet|load the stylesheet)\s*["']([^"']+)["']/i)?.[1];
- if (target?.startsWith("blob:")) resource = "blob";
- else if (target?.startsWith("data:")) resource = "data";
- else if (target) {
- try {
- const url = new URL(target);
- if (["https:", "http:"].includes(url.protocol)) {
- const hostname = url.hostname;
- const local = !hostname.includes(".") || hostname.startsWith("[") ||
- /^(?:\d{1,3}\.){3}\d{1,3}$/.test(hostname) ||
- /(?:^|\.)(?:localhost|local|internal|lan|home)$/.test(hostname);
- resource = url.username || url.password ? "redacted" : url.origin === ownerOrigin ? "owner-origin" :
- local ? "local-address" : isMapCSPHostname(hostname) ? url.protocol + hostname : "redacted";
- }
- } catch (_error) { /* 未识别资源只保留固定 other 类别。 */ }
- }
- }
- return isMapCSPResource(resource) ? [{code, resource}] : [];
-};
-
-const classifyMapConsoleMessage = message => {
- if (typeof message !== "string") return [];
- const ret = [];
- if (/content security policy|violates.*directive/i.test(message)) {
- for (const [token, code] of [["script-src", "cspScript"], ["worker-src", "cspWorker"],
- ["connect-src", "cspConnect"], ["img-src", "cspImage"], ["style-src", "cspStyle"],
- ["unsafe-eval", "cspEval"], ["wasm-unsafe-eval", "cspWasm"]]) {
- if (message.includes(token)) ret.push(code);
- }
- }
- if (/localStorage|sessionStorage/.test(message) && /denied|SecurityError|insecure/i.test(message)) ret.push("storageUnavailable");
- if (/webgl/i.test(message) && /fail|error|unsupported/i.test(message)) ret.push("webglUnavailable");
- return ret;
-};
-
-module.exports = {MAX_MAP_DIAGNOSTICS, mapDiagnosticCodes, mapCSPDiagnosticCodes, mapCSPResourceCodes,
- isMapCSPResource, classifyMapConsoleMessage, classifyMapCSPResources};
diff --git a/app/electron/mapHostDiagnostics.test.js b/app/electron/mapHostDiagnostics.test.js
deleted file mode 100644
index 266d802073..0000000000
--- a/app/electron/mapHostDiagnostics.test.js
+++ /dev/null
@@ -1,108 +0,0 @@
-const assert = require("node:assert/strict");
-const {test} = require("node:test");
-const {MAX_MAP_DIAGNOSTICS, mapDiagnosticCodes, mapCSPDiagnosticCodes, mapCSPResourceCodes, isMapCSPResource, classifyMapConsoleMessage,
- classifyMapCSPResources} = require("./mapHostDiagnostics");
-
-test("provider console diagnostics return fixed categories without SDK text, URL or credentials", () => {
- const cases = [
- ["Refused blob:https://secret.invalid/key to worker because it violates Content Security Policy worker-src 'none'", ["cspWorker"]],
- ["Refused eval because Content Security Policy script-src does not allow unsafe-eval; key=private", ["cspScript", "cspEval"]],
- ["SecurityError: Access to localStorage is denied for https://secret.invalid", ["storageUnavailable"]],
- ["WebGL initialization failed", ["webglUnavailable"]],
- ["INVALID_USER_SCODE credential=private", []],
- ["INVALID_USER_KEY INVALID_USER_DOMAIN USERKEY_PLAT_NOMATCH", []],
- ["arbitrary provider text with key=private", []],
- [undefined, []],
- ];
- for (const [message, expected] of cases) {
- const result = classifyMapConsoleMessage(message);
- assert.deepEqual(result, expected);
- assert.ok(result.every(code => mapDiagnosticCodes.includes(code)));
- }
-});
-
-test("Chromium CSP messages identify bounded resources and the fixed public tile hostname without retaining their URLs", () => {
- // Chromium 152 的三类资源拒绝文案,以及旧式 Refused to 文案。
- const cases = [
- ["Loading the script 'https://tiles.openfreemap.org/private.js?key=secret' violates the following Content Security Policy directive: \"script-src https://tiles.openfreemap.org\". The action has been blocked.", "cspScript", "https:tiles.openfreemap.org"],
- ["Connecting to 'https://tiles.openfreemap.org/rp?secret=private' violates the following Content Security Policy directive: \"connect-src https://tiles.openfreemap.org\".", "cspConnect", "https:tiles.openfreemap.org"],
- ["Creating a worker from 'blob:null/private-token' violates the following Content Security Policy directive: \"worker-src 'none'\".", "cspWorker", "blob"],
- ["Refused to create a worker from 'data:text/javascript,private' because it violates the following Content Security Policy directive: \"worker-src 'none'\".", "cspWorker", "data"],
- ["Refused to load the script 'https://[email protected]/log?key=secret' because it violates the following Content Security Policy directive: \"script-src https://tiles.openfreemap.org\".", "cspScript", "redacted"],
- ["Refused to connect to 'http://tiles.openfreemap.org/private' because it violates the following Content Security Policy directive: \"connect-src https://tiles.openfreemap.org\".", "cspConnect", "http:tiles.openfreemap.org"],
- ["Loading the image 'http://tiles.openfreemap.org/private' violates the following Content Security Policy directive: \"img-src https://tiles.openfreemap.org\".", "cspImage", "http:tiles.openfreemap.org"],
- ["Loading the stylesheet 'https://tiles.openfreemap.org/private?key=secret' violates the following Content Security Policy directive: \"style-src 'none'\".", "cspStyle", "https:tiles.openfreemap.org"],
- ["Executing inline script violates the following Content Security Policy directive 'script-src https://tiles.openfreemap.org'. Either the 'unsafe-inline' keyword, a hash, or a nonce is required.", "cspScript", "inline"],
- ["Evaluating a string as JavaScript violates the following Content Security Policy directive because 'unsafe-eval' is not an allowed source of script: \"script-src https://tiles.openfreemap.org\".", "cspEval", "eval"],
- ["Compiling or instantiating a WebAssembly module violates the following Content Security policy directive because 'unsafe-eval' is not an allowed source of script: \"script-src https://tiles.openfreemap.org\".", "cspWasm", "wasm"],
- ["Applying inline style violates the following Content Security Policy directive 'style-src-attr https://tiles.openfreemap.org'.", "cspStyle", "inline"],
- ];
- for (const [message, code, resource] of cases) {
- const result = classifyMapCSPResources(message);
- assert.deepEqual(result, [{code, resource}]);
- assert.ok(result.every(item => mapCSPDiagnosticCodes.includes(item.code) && isMapCSPResource(item.resource)));
- assert.doesNotMatch(JSON.stringify(result), /secret|private|token|\/\/|\?/);
- }
-});
-
-test("unknown or malformed CSP resources stay bounded and URL contents cannot become diagnostic data", () => {
- for (const [url, resource] of [["https://tiles.openfreemap.org.evil.invalid/path?key=secret", "redacted"],
- ["https://tiles.openfreemap.org:8443/private", "https:tiles.openfreemap.org"],
- ["http://unknown.invalid/unsafe-eval?blob:secret", "redacted"], ["file:///secret", "other"],
- ["not a URL private", "other"], ["blob:https://private.invalid/secret", "blob"]]) {
- const result = classifyMapCSPResources(`Loading the script '${url}' violates the following Content Security Policy directive: "script-src https://tiles.openfreemap.org".`);
- assert.deepEqual(result, [{code: "cspScript", resource}]);
- }
- for (const message of [undefined, {}, "provider secret text", "Content Security Policy unknown directive private",
- "Loading the script 'https://private.invalid' violates a made-up directive",
- "Loading the script 'https://tiles.openfreemap.org/" + "private".repeat(5000) + "' violates Content Security Policy directive: \"script-src 'none'\"."]) {
- assert.deepEqual(classifyMapCSPResources(message), []);
- }
-});
-
-test("owner and other local addresses become fixed labels without disclosing names, ports, or credentials", () => {
- const origin = "https://127.0.0.1:6806";
- for (const [target, resource] of [
- [origin + "/private?key=secret", "owner-origin"],
- ["https://127.0.0.1:6807/private", "local-address"],
- ["http://127.0.0.1:6806/private", "local-address"],
- ["https://localhost:6806/private", "local-address"],
- ["https://machine.local/private", "local-address"],
- ["https://machine.internal/private", "local-address"],
- ["https://intranet/private", "local-address"],
- ["https://[::1]:6806/private", "local-address"],
- ["https://192.0.2.1/private", "local-address"],
- ["https://name:[email protected]:6806/private", "redacted"],
- ]) {
- const result = classifyMapCSPResources(`Connecting to '${target}' violates the following Content Security Policy directive: "connect-src 'none'".`, origin);
- assert.deepEqual(result, [{code: "cspConnect", resource}]);
- assert.doesNotMatch(JSON.stringify(result), /127|6806|6807|machine|private|secret|localhost|intranet|192/);
- }
- const result = classifyMapCSPResources("Connecting to 'https://notes.example:7443/private' violates the following Content Security Policy directive: \"connect-src 'none'\".", "https://notes.example:7443");
- assert.deepEqual(result, [{code: "cspConnect", resource: "owner-origin"}]);
-});
-
-test("resource validator accepts only fixed codes or the exact public tile hostname", () => {
- for (const resource of [...mapCSPResourceCodes, "https:tiles.openfreemap.org", "http:tiles.openfreemap.org"]) {
- assert.equal(isMapCSPResource(resource), true, resource);
- }
- for (const resource of [undefined, null, {}, ["blob"], "https://tiles.openfreemap.org", "https:tiles.openfreemap.org:8443",
- "https:tiles.openfreemap.org/private", "https:tiles.openfreemap.org?key=secret", "https:tiles.openfreemap.org#secret",
- "https:[email protected]", "https:tiles.openfreemap.org.evil.invalid", "https:sub.tiles.openfreemap.org",
- "https:unknown.example", "https:127.0.0.1", "https:[::1]", "https:machine.local", "https:localhost",
- "HTTPS:tiles.openfreemap.org", "https:TILES.openfreemap.org", "https:tiles.openfreemap.org.",
- "https:" + "a".repeat(100) + ".openfreemap.org"]) {
- assert.equal(isMapCSPResource(resource), false, String(resource));
- }
- assert.equal(MAX_MAP_DIAGNOSTICS, 64);
-});
-
-test("other providers and unapproved tile subdomains are redacted while blocked directives survive", () => {
- for (const host of ["unknown.example", "webapi.amap.com", "jsapi.amap.com", "webst02.is.autonavi.com",
- "g.alicdn.com", "fourier.taobao.com", "map.qq.com", "api.map.baidu.com", "tiles.openfreemap.org.evil.example",
- "sub.tiles.openfreemap.org", "tiles.openfreemap.org.", "a".repeat(100) + ".openfreemap.org"]) {
- const message = `Loading the script 'https://${host}/private?key=secret' violates the following Content Security Policy directive: "script-src https://tiles.openfreemap.org".`;
- assert.deepEqual(classifyMapCSPResources(message), [{code: "cspScript", resource: "redacted"}]);
- assert.equal(isMapCSPResource("https:" + host), false);
- }
-});
diff --git a/app/electron/mapHostManager.js b/app/electron/mapHostManager.js
deleted file mode 100644
index d4a3787fa5..0000000000
--- a/app/electron/mapHostManager.js
+++ /dev/null
@@ -1,590 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-const path = require("node:path");
-const fs = require("node:fs/promises");
-const {randomBytes} = require("node:crypto");
-const {hardenMapWebviewPreferences, isMapWebviewAttachment, getMapWebviewPreferenceMismatch} = require("./mapWebviewHost");
-const {mapDiagnosticCodes, mapCSPDiagnosticCodes, isMapCSPResource, MAX_MAP_DIAGNOSTICS, classifyMapConsoleMessage,
- classifyMapCSPResources} = require("./mapHostDiagnostics");
-const {
- hasUnsafeMapSwitches, normalizeMapOrigin, parseMapCreate, parseMapCommand, parseMapReply,
- isAllowedMapProviderURL, getMapRequestPolicy, createMapContentSecurityPolicy,
-} = require("./mapHostPolicy");
-
-// 资源准备包含文档、打包资源和 CSP 锁定;地图就绪从 bootstrapReady 起另计有限预算。
-const MAP_HOST_BOOTSTRAP_TIMEOUT = 30000;
-const MAP_HOST_READY_TIMEOUT = 45000;
-
-const deniedResponse = () => new Response("Forbidden", {status: 403,
- headers: {"Content-Type": "text/plain; charset=utf-8", "Cache-Control": "no-store"}});
-const withoutCredentials = (headers) => Object.fromEntries(Object.entries(headers || {})
- .filter(([name]) => !["cookie", "authorization", "proxy-authorization"].includes(name.toLowerCase())));
-const clearMapSession = ses => {
- for (const method of ["closeAllConnections", "clearStorageData", "clearAuthCache", "clearCache", "clearHostResolverCache"]) {
- try { void Promise.resolve(ses[method]()).catch(() => {}); } catch (_error) { /* 继续清理其他会话状态。 */ }
- }
-};
-
-// 此会话从不向任何内核发送网络请求,包括未设置密码的本机内核。
-const createMapSessionRouter = ({ses, origin, appDir, readFile = fs.readFile, trackFetch = () => {}, report = () => {}}) => {
- let destroyed = false;
- let documentRequested = false;
- const requests = new Set();
- ses.setPermissionRequestHandler((_contents, _permission, callback) => callback(false));
- ses.setPermissionCheckHandler(() => false);
- ses.setDevicePermissionHandler(() => false);
- ses.setDisplayMediaRequestHandler((_request, callback) => callback({}));
- ses.setCertificateVerifyProc((_request, callback) => callback(-3));
- ses.allowNTLMCredentialsForDomains("");
- ses.on("will-download", event => event.preventDefault());
- ses.webRequest.onBeforeRequest((details, callback) => {
- const policy = getMapRequestPolicy(details.url, details.method, origin);
- let allowed = !destroyed && !!policy;
- if (details.resourceType === "mainFrame") {
- allowed = allowed && policy.type === "local" && policy.document && !documentRequested;
- if (allowed) documentRequested = true;
- } else if (details.resourceType === "subFrame" || details.resourceType === "webSocket") {
- allowed = false;
- } else if (!destroyed && /^(blob:|data:)/.test(details.url)) {
- // 仅允许无网络权限的图片数据,以及本地预载后创建的 CSP worker。
- allowed = ["image", "other"].includes(details.resourceType);
- }
- if (!allowed && !destroyed) {
- report(details.url.startsWith("http:") && !details.url.startsWith(origin + "/") ?
- "providerInsecureRequest" : "providerRequestDenied");
- }
- callback({cancel: !allowed});
- });
- ses.webRequest.onBeforeSendHeaders((details, callback) => {
- callback({cancel: destroyed, requestHeaders: withoutCredentials(details.requestHeaders)});
- });
- ses.webRequest.onHeadersReceived((details, callback) => {
- const responseHeaders = Object.fromEntries(Object.entries(details.responseHeaders || {})
- .filter(([name]) => !["set-cookie", "set-cookie2"].includes(name.toLowerCase())));
- callback({cancel: destroyed, responseHeaders});
- });
- const handle = async (request) => {
- const policy = !destroyed && getMapRequestPolicy(request.url, request.method, origin);
- if (!policy || request.headers.get("service-worker")) return deniedResponse();
- if (policy.type === "local") {
- try {
- const data = await readFile(path.join(appDir, policy.file[0]));
- if (destroyed) return deniedResponse();
- const headers = {"Content-Type": policy.file[1], "Cache-Control": "no-store",
- "X-Content-Type-Options": "nosniff", "Access-Control-Allow-Origin": "*",
- "Referrer-Policy": "strict-origin-when-cross-origin",
- "Permissions-Policy": "geolocation=(), camera=(), microphone=(), payment=(), usb=(), serial=(), bluetooth=()"};
- if (policy.document) headers["Content-Security-Policy"] = createMapContentSecurityPolicy(origin);
- return new Response(request.method === "HEAD" ? null : data, {headers});
- } catch (_error) {
- report("assetUnavailable");
- return new Response("Not Found", {status: 404});
- }
- }
- const abort = new AbortController();
- requests.add(abort);
- const timer = setTimeout(() => abort.abort(), 30000);
- timer.unref?.();
- const abortRequest = () => abort.abort();
- request.signal?.addEventListener("abort", abortRequest, {once: true});
- if (request.signal?.aborted) abort.abort();
- let activeURL;
- let finished = false;
- const finish = () => {
- if (finished) return;
- finished = true;
- clearTimeout(timer);
- request.signal?.removeEventListener("abort", abortRequest);
- if (activeURL) trackFetch(activeURL, -1);
- requests.delete(abort);
- };
- abort.signal.addEventListener("abort", finish, {once: true});
- try {
- let url = request.url;
- for (let redirects = 0; redirects <= 5; redirects++) {
- if (destroyed || abort.signal.aborted) break;
- if (!isAllowedMapProviderURL(url)) {
- report(url.startsWith("http:") ? "providerInsecureRequest" : "providerRequestDenied");
- break;
- }
- if (activeURL) trackFetch(activeURL, -1);
- activeURL = url;
- trackFetch(activeURL, 1);
- // 不复制浏览器凭证或任意请求头;来源只保留内核来源,不携带笔记路径。
- const headers = {"Referer": origin + "/"};
- for (const name of ["accept", "accept-language", "range"]) {
- const value = request.headers.get(name);
- if (value && value.length <= 4096) headers[name] = value;
- }
- const response = await ses.fetch(url, {method: request.method, headers, credentials: "omit",
- cache: "no-store", redirect: "manual", bypassCustomProtocolHandlers: true, signal: abort.signal});
- if (response.status >= 400) report("providerHTTPFailure");
- if ([301, 302, 303, 307, 308].includes(response.status)) {
- const location = response.headers.get("location");
- await response.body?.cancel();
- if (!location) break;
- url = new URL(location, url).href;
- continue;
- }
- if (destroyed || abort.signal.aborted) {
- await response.body?.cancel();
- break;
- }
- const responseHeaders = new Headers(response.headers);
- for (const name of ["set-cookie", "set-cookie2", "www-authenticate", "proxy-authenticate", "refresh", "location"]) {
- responseHeaders.delete(name);
- }
- responseHeaders.set("Cache-Control", "no-store");
- if (!response.body || request.method === "HEAD") {
- await response.body?.cancel();
- finish();
- return new Response(null, {status: response.status, headers: responseHeaders});
- }
- const reader = response.body.getReader();
- const body = new ReadableStream({
- async pull(controller) {
- try {
- const {done, value} = await reader.read();
- if (destroyed || abort.signal.aborted) throw new Error("Map request closed");
- if (done) { controller.close(); finish(); } else controller.enqueue(value);
- } catch (error) {
- if (!destroyed && !abort.signal.aborted) report("providerNetworkFailure");
- controller.error(error); finish();
- }
- },
- async cancel() { abort.abort(); await reader.cancel().catch(() => {}); finish(); },
- });
- return new Response(body, {status: response.status, headers: responseHeaders});
- }
- } catch (_error) {
- // 请求地址可能包含私有数据,不记录请求地址或异常文本。
- if (!destroyed && !abort.signal.aborted) report("providerNetworkFailure");
- }
- finish();
- return deniedResponse();
- };
- ses.protocol.handle("http", handle);
- ses.protocol.handle("https", handle);
- ses.protocol.handle("file", deniedResponse);
- return {
- destroy: () => {
- if (destroyed) return;
- destroyed = true;
- for (const request of requests) request.abort();
- requests.clear();
- // Electron 没有 Session.destroy;清理状态后仍保留拒绝处理器,阻止残留请求恢复访问。
- clearMapSession(ses);
- },
- };
-};
-
-const createMapHostManager = ({app, ipcMain, session, BrowserWindow, MessageChannelMain,
- getTarget, isInitialized, appDir, readFile, randomID = () => randomBytes(24).toString("hex")}) => {
- const hosts = new Map();
- const attachmentOwners = new WeakSet();
- const webviewSessions = new WeakSet();
- const mapContents = new Set();
- const activeFetchURLs = new Map();
- const trackFetch = (url, delta) => {
- const count = (activeFetchURLs.get(url) || 0) + delta;
- if (count <= 0) activeFetchURLs.delete(url); else activeFetchURLs.set(url, count);
- };
- const isMapAuthentication = (contents, url) => contents ? mapContents.has(contents.id) : activeFetchURLs.has(String(url));
- // Session.fetch 的客户端证书事件可能只在 app 触发,且 WebContents 为空。
- app.on("select-client-certificate", (event, contents, url, _certificates, callback) => {
- if (!contents && isMapAuthentication(contents, url)) { event.preventDefault(); callback(); }
- });
- app.on("login", (event, contents, details, _authInfo, callback) => {
- if (!contents && isMapAuthentication(contents, details.url)) { event.preventDefault(); callback(); }
- });
- // 返回固定诊断码,不暴露地址或启动参数值;所有宿主入口复用相同信任检查。
- const inspectOwner = event => {
- if (!event?.sender || event.sender.isDestroyed()) return {reason: "ownerUnavailable"};
- if (event.senderFrame !== event.sender.mainFrame) return {reason: "notMainFrame"};
- if (!isInitialized(event.sender.id)) return {reason: "notInitialized"};
- const target = getTarget(event.sender.id);
- if (!target || !["local", "remote"].includes(target.mode)) return {reason: "unregisteredOwner"};
- const origin = normalizeMapOrigin(target.origin);
- if (!origin) return {reason: "invalidKernelOrigin"};
- const win = BrowserWindow.fromWebContents(event.sender);
- if (!win || win.isDestroyed()) return {reason: "ownerUnavailable"};
- try {
- const url = new URL(event.senderFrame.url);
- if (url.origin !== origin) return {reason: "originMismatch"};
- if (!["/stage/build/app/", "/stage/build/app/window.html"].includes(url.pathname)) {
- return {reason: "unsupportedDocument"};
- }
- } catch (_error) { return {reason: "invalidDocument"}; }
- return {owner: {win, origin, mode: "webview", kernelMode: target.mode}};
- };
- const trustedOwner = event => inspectOwner(event).owner;
- const getHost = (event, value) => {
- if (!event?.sender || value?.version !== 1 || typeof value.instanceID !== "string") return;
- const host = hosts.get(event.sender.id + ":" + value.instanceID);
- if (!host || host.destroyed || host.owner !== event.sender || host.frame !== event.senderFrame) return;
- const owner = trustedOwner(event);
- if (owner && host.win === owner.win && host.origin === owner.origin &&
- host.mode === owner.mode && host.kernelMode === owner.kernelMode) return host;
- // 切换内核目标后,即使两者都使用 webview,也不能复用原来的隔离会话和端口。
- destroy(host);
- };
- const sendOwner = (host, reply) => {
- if (!host.destroyed && !host.owner.isDestroyed()) {
- try { host.owner.send("siyuan-map-reply", reply); } catch (_error) { destroy(host); }
- }
- };
- const setVisible = (host, visible) => {
- host.visible = visible && host.ready && host.win.isVisible() && !host.win.isMinimized();
- if (!host.visible) {
- host.attributionGestureUntil = 0;
- host.pointGestureUntil = 0;
- }
- const visibility = host.visible ? host.visibility : {visible: false};
- const key = JSON.stringify(visibility);
- if (host.ready && key !== host.lastVisibility) {
- host.lastVisibility = key;
- post(host, {version: 1, instanceID: host.init.instanceID, type: "visibility", ...visibility});
- }
- };
- const hide = host => setVisible(host, false);
- const destroy = host => {
- if (!host || host.destroyed) return;
- host.destroyed = true;
- clearTimeout(host.timer);
- hosts.delete(host.key);
- for (const [emitter, name, listener] of host.listeners) emitter.removeListener(name, listener);
- host.ids.clear();
- host.points = undefined;
- host.router.destroy();
- for (const port of [host.port, host.transferredPort]) {
- try { port?.close(); } catch (_error) { /* 端口已转移或关闭。 */ }
- }
- // 移除 DOM 不保证销毁 WebContents,必须实际关闭 SDK 渲染器。
- if (host.contents && !host.contents.isDestroyed()) {
- try { host.contents.stop(); } catch (_error) { /* 仍尝试关闭。 */ }
- try { host.contents.close({waitForBeforeUnload: false}); } catch (_error) { /* 渲染器可能已关闭。 */ }
- }
- if (host.contents) mapContents.delete(host.contents.id);
- };
- const fail = (host, code) => {
- if (!host || host.destroyed) return;
- sendOwner(host, {version: 1, instanceID: host.init.instanceID, type: "error", code});
- destroy(host);
- };
- const setDeadline = (host, milliseconds) => {
- clearTimeout(host.timer);
- host.timer = setTimeout(() => {
- const code = !host.loaded ? "hostDocumentLoadTimeout" : host.bootstrapped ? "hostSDKTimeout" : "hostBootstrapTimeout";
- fail(host, code);
- }, milliseconds);
- host.timer.unref?.();
- };
- const listen = (host, emitter, name, listener) => {
- const guarded = (...args) => {
- if (host.destroyed) return;
- try { listener(...args); } catch (_error) { fail(host, "hostOperationFailed"); }
- };
- host.listeners.push([emitter, name, guarded]);
- emitter.on(name, guarded);
- };
- const post = (host, message) => {
- if (!host.destroyed && host.port) {
- try { host.port.postMessage(message); } catch (_error) { fail(host, "hostOperationFailed"); }
- }
- };
- const applyVisibility = host => setVisible(host, host.visibility?.visible === true);
- const currentWebviewOwner = host => host.mode === "webview" && !hasUnsafeMapSwitches(app.commandLine) &&
- getHost({sender: host.owner, senderFrame: host.frame}, host.init) === host;
- const closeMapGuest = contents => {
- try { contents.setWindowOpenHandler(() => ({action: "deny"})); } catch (_error) { /* 对象可能已被前序监听器销毁。 */ }
- try { if (!contents.isDestroyed()) contents.close({waitForBeforeUnload: false}); } catch (_error) { /* 会话路由仍保持拒绝。 */ }
- };
- // 由主进程在加载窗口文档前调用,远程窗口自首次执行页面脚本起默认拒绝 webview。
- const registerOwner = owner => {
- if (attachmentOwners.has(owner)) return;
- attachmentOwners.add(owner);
- const beforeAttach = (event, preferences, params) => {
- // 本地普通 webview 保留既有行为;远程或未登记目标只能使用主进程保留的地图分区。
- if (typeof params?.partition !== "string" || !params.partition.startsWith("siyuan-map-")) {
- if (getTarget(owner.id)?.mode !== "local") event.preventDefault();
- return;
- }
- const host = [...hosts.values()].find(item => item.partition === params.partition);
- if (!host || host.owner !== owner || event.sender !== owner || !currentWebviewOwner(host) ||
- host.attachmentAccepted || !isMapWebviewAttachment(params, host)) {
- event.preventDefault();
- return;
- }
- try {
- const zoomFactor = owner.getZoomFactor();
- if (!Number.isFinite(zoomFactor) || zoomFactor < 0.25 || zoomFactor > 5) {
- event.preventDefault();
- fail(host, "hostAttachFailed");
- return;
- }
- hardenMapWebviewPreferences(preferences, host.session, host.partition);
- // 清空不可信偏好后恢复主窗口缩放,避免初次挂载回落到 100%。
- preferences.zoomFactor = zoomFactor;
- host.attachmentAccepted = true;
- } catch (_error) {
- event.preventDefault();
- fail(host, "hostAttachFailed");
- }
- };
- const didAttach = (_event, contents) => {
- let host, mapGuest = false;
- try {
- if (contents.isDestroyed()) return;
- if (!webviewSessions.has(contents.session)) {
- if (getTarget(owner.id)?.mode !== "local") closeMapGuest(contents);
- return;
- }
- mapGuest = true;
- host = [...hosts.values()].find(item => item.contents === contents);
- if (!host || !currentWebviewOwner(host) || host.attachmentVerified || contents.hostWebContents !== owner ||
- contents.session !== host.session || getMapWebviewPreferenceMismatch(contents.getLastWebPreferences())) {
- if (host) fail(host, "hostAttachFailed");
- closeMapGuest(contents);
- return;
- }
- host.attachmentVerified = true;
- } catch (_error) {
- if (host) fail(host, "hostAttachFailed");
- if (mapGuest) closeMapGuest(contents);
- }
- };
- owner.on("will-attach-webview", beforeAttach);
- owner.on("did-attach-webview", didAttach);
- owner.once("destroyed", () => {
- owner.removeListener("will-attach-webview", beforeAttach);
- owner.removeListener("did-attach-webview", didAttach);
- });
- };
- app.on("web-contents-created", (_event, contents) => {
- let host, mapGuest = false, ownsReservation = false;
- try {
- if (contents.isDestroyed() || contents.getType() !== "webview") return;
- if (!webviewSessions.has(contents.session)) {
- const owner = contents.hostWebContents;
- if (owner && attachmentOwners.has(owner) && getTarget(owner.id)?.mode !== "local") closeMapGuest(contents);
- return;
- }
- mapGuest = true;
- host = [...hosts.values()].find(item => item.session === contents.session);
- ownsReservation = !!host && !host.contents && contents.hostWebContents === host.owner && host.attachmentAccepted;
- // main.js 的通用外链处理器先安装;地图 guest 必须在首次加载前覆盖为拒绝。
- contents.setWindowOpenHandler(() => ({action: "deny"}));
- if (!ownsReservation || !currentWebviewOwner(host) || getMapWebviewPreferenceMismatch(contents.getLastWebPreferences())) {
- closeMapGuest(contents);
- if (ownsReservation) fail(host, "hostAttachFailed");
- return;
- }
- host.attachContents(contents);
- } catch (_error) {
- if (ownsReservation) fail(host, "hostAttachFailed");
- if (mapGuest) closeMapGuest(contents);
- }
- });
- ipcMain.handle("siyuan-map-capability", event => {
- const result = inspectOwner(event);
- const reason = result.reason || (hasUnsafeMapSwitches(app.commandLine) ? "unsafeProcessSwitches" : undefined);
- return reason ? {version: 1, supported: false, reason} : {version: 1, supported: true};
- });
- ipcMain.handle("siyuan-map-create", (event, value) => {
- const owner = trustedOwner(event);
- const init = parseMapCreate(value);
- if (!owner || !init) throw new Error("Invalid map host owner or configuration");
- if (hasUnsafeMapSwitches(app.commandLine)) return {version: 1, instanceID: init.instanceID, error: "unsupportedEnvironment"};
- const key = event.sender.id + ":" + init.instanceID;
- getHost(event, init);
- if (hosts.has(key) || hosts.size >= 32 || [...hosts.values()].filter(host => host.owner === event.sender).length >= 8) {
- return {version: 1, instanceID: init.instanceID, error: "hostLimitReached"};
- }
- let host, router, ses;
- const report = (code, resource) => {
- if (!host || host.destroyed || !mapDiagnosticCodes.includes(code) ||
- resource !== undefined && (!mapCSPDiagnosticCodes.includes(code) || !isMapCSPResource(resource))) return;
- // 按实例去重并限制总量,同一指令拒绝不同受限来源时也保留证据。
- const key = code + ":" + (resource || "");
- if (host.diagnostics.has(key) || host.diagnostics.size >= MAX_MAP_DIAGNOSTICS) return;
- host.diagnostics.add(key);
- sendOwner(host, {version: 1, instanceID: init.instanceID, type: "diagnostic", code,
- ...(resource === undefined ? {} : {resource})});
- };
- try {
- const partition = "siyuan-map-" + randomID();
- ses = session.fromPartition(partition, {cache: false});
- router = createMapSessionRouter({ses, origin: owner.origin, appDir, readFile, trackFetch, report});
- const nonce = randomID();
- const entryURL = owner.origin + "/stage/map/index.html?provider=openfreemap#" + init.instanceID + ":" + nonce;
- host = {key, init, owner: event.sender, frame: event.senderFrame, win: owner.win, origin: owner.origin, diagnostics: new Set(), report,
- mode: owner.mode, kernelMode: owner.kernelMode, session: ses, partition, entryURL, router, listeners: [], ids: new Set(), revision: -1,
- loaded: false, ready: false, bootstrapped: false, destroyed: false,
- visible: false, attributionGestureUntil: 0, pointGestureUntil: 0};
- hosts.set(key, host);
- listen(host, event.sender, "destroyed", () => destroy(host));
- listen(host, event.sender, "render-process-gone", () => destroy(host));
- listen(host, owner.win, "closed", () => destroy(host));
- listen(host, event.sender, "did-start-navigation", details => {
- if (details.isMainFrame && !details.isSameDocument) destroy(host);
- });
- for (const name of ["hide", "minimize"]) listen(host, owner.win, name, () => hide(host));
- // 失焦撤销外链与选点手势,DOM 处理地图的裁剪和叠层。
- listen(host, owner.win, "blur", () => { host.attributionGestureUntil = 0; host.pointGestureUntil = 0; });
- for (const name of ["focus", "show", "restore"]) listen(host, owner.win, name, () => applyVisibility(host));
- host.attachContents = contents => {
- host.contents = contents;
- // 全局 web-contents-created 会安装外部打开链接处理器,必须在加载前替换为拒绝。
- contents.setWindowOpenHandler(() => ({action: "deny"}));
- const armAttributionClick = () => {
- if (host.ready && host.visible && host.win.isFocused() && host.win.isVisible() && !host.win.isMinimized()) {
- host.attributionGestureUntil = Date.now() + 1000;
- }
- };
- listen(host, contents, "before-mouse-event", (_event, input) => {
- if (input.type === "mouseDown") {
- if (currentWebviewOwner(host) && host.ready && host.visible && host.win.isFocused() &&
- host.win.isVisible() && !host.win.isMinimized()) {
- sendOwner(host, {version: 1, instanceID: host.init.instanceID, type: "dismissMenu"});
- }
- }
- if (input.type === "mouseUp" && input.button === "left") {
- armAttributionClick();
- if (host.init.picking && host.attributionGestureUntil > Date.now()) {
- host.pointGestureUntil = Date.now() + 1000;
- }
- }
- });
- listen(host, contents, "before-input-event", (_event, input) => {
- if (input.type === "keyDown" && input.key === "Enter" && !input.isAutoRepeat) armAttributionClick();
- });
- mapContents.add(contents.id);
- const denyNavigation = event => event.preventDefault();
- for (const name of ["will-navigate", "will-frame-navigate", "will-redirect", "will-attach-webview"]) {
- listen(host, contents, name, denyNavigation);
- }
- listen(host, contents, "select-client-certificate", (event, _url, _certificates, callback) => { event.preventDefault(); callback(); });
- listen(host, contents, "login", (event, _details, _auth, callback) => { event.preventDefault(); callback(); });
- listen(host, contents, "certificate-error", (_event, _url, _error, _certificate, callback) => callback(false));
- listen(host, contents, "console-message", (event, _level, legacyMessage) => {
- const message = event?.message ?? legacyMessage;
- const resources = classifyMapCSPResources(message, host.origin);
- for (const code of classifyMapConsoleMessage(message)) {
- if (!resources.some(item => item.code === code)) report(code);
- }
- for (const {code, resource} of resources) report(code, resource);
- });
- listen(host, contents, "did-fail-load", (_event, _code, _description, _url, isMainFrame) => {
- if (isMainFrame === false) return;
- report("documentLoadFailed");
- fail(host, "hostDocumentLoadFailed");
- });
- listen(host, contents, "render-process-gone", () => fail(host, "hostRendererGone"));
- listen(host, contents, "did-navigate-in-page", () => fail(host, "hostDocumentMismatch"));
- listen(host, contents, "did-navigate", (_event, url) => {
- if (url !== entryURL) fail(host, "hostDocumentMismatch");
- });
- listen(host, contents, "destroyed", () => fail(host, "hostDestroyed"));
- listen(host, contents, "did-finish-load", () => {
- if (host.destroyed) return;
- try {
- if (!currentWebviewOwner(host)) { destroy(host); return; }
- if (!host.attachmentVerified) { fail(host, "hostAttachFailed"); return; }
- if (host.loaded) { fail(host, "hostDocumentReloaded"); return; }
- if (contents.getURL() !== entryURL) { fail(host, "hostDocumentMismatch"); return; }
- host.loaded = true;
- // 初始隐藏的 renderer 必须显式唤醒产帧,否则 SDK 的 load 会等待显示,而显示又等待 ready。
- contents.setBackgroundThrottling(false);
- applyVisibility(host);
- const {port1, port2} = new MessageChannelMain();
- host.port = port1;
- host.transferredPort = port2;
- port1.on("message", ({data}) => {
- if (host.destroyed) return;
- if (getHost({sender: host.owner, senderFrame: host.frame}, host.init) !== host) {
- destroy(host);
- return;
- }
- const reply = parseMapReply(data, init.instanceID);
- if (!reply) return;
- try {
- if (reply.type === "bootstrapReady" && !host.bootstrapped) {
- host.bootstrapped = true;
- // 打包资源和 CSP 已准备完成,此后只等待地图创建与 load 就绪。
- setDeadline(host, MAP_HOST_READY_TIMEOUT);
- post(host, init);
- } else if (reply.type === "ready" && host.bootstrapped && !host.ready) {
- host.ready = true;
- clearTimeout(host.timer);
- if (host.points) post(host, host.points);
- post(host, {version: 1, instanceID: init.instanceID, type: "theme", theme: init.theme});
- if (host.destroyed) return;
- applyVisibility(host);
- if (host.destroyed) return;
- contents.setBackgroundThrottling(true);
- sendOwner(host, reply);
- } else if (reply.type === "markerClick" && host.ready && reply.revision === host.revision && host.ids.has(reply.id)) {
- sendOwner(host, reply);
- } else if (reply.type === "pointClick" && host.init.picking && host.ready && host.visible &&
- reply.revision === host.revision && host.revision >= 0 && host.win.isFocused() &&
- host.win.isVisible() && !host.win.isMinimized() && host.pointGestureUntil > Date.now()) {
- host.pointGestureUntil = 0;
- host.attributionGestureUntil = 0;
- sendOwner(host, reply);
- } else if (reply.type === "attributionClick" && host.ready && host.visible &&
- host.win.isFocused() && host.win.isVisible() && !host.win.isMinimized() &&
- host.attributionGestureUntil > Date.now()) {
- host.attributionGestureUntil = 0;
- host.pointGestureUntil = 0;
- sendOwner(host, reply);
- } else if (reply.type === "error") {
- fail(host, reply.code === "hostUnavailable" ?
- host.bootstrapped ? "hostOperationFailed" : "hostBootstrapFailed" : reply.code);
- }
- } catch (_error) { fail(host, "hostOperationFailed"); }
- });
- port1.on("close", () => fail(host, "hostPortClosed"));
- port1.start();
- contents.postMessage("siyuan-map-port", {version: 1, instanceID: init.instanceID, nonce, provider: init.provider}, [port2]);
- } catch (_error) { fail(host, "hostPortSetupFailed"); }
- });
- };
- setDeadline(host, MAP_HOST_BOOTSTRAP_TIMEOUT);
- webviewSessions.add(ses);
- registerOwner(event.sender);
- return {version: 1, instanceID: init.instanceID, mode: "webview", src: entryURL, partition};
- } catch (_error) {
- if (host) fail(host, "hostSetupFailed");
- else if (router) router.destroy();
- else if (ses) clearMapSession(ses);
- return {version: 1, instanceID: init.instanceID, error: "hostSetupFailed"};
- }
- });
- ipcMain.on("siyuan-map-command", (event, value) => {
- const host = getHost(event, value);
- if (!host) return;
- const command = parseMapCommand(value, host.init.instanceID);
- if (!command) return;
- if (command.type === "visibility") {
- host.visibility = command.visible ? {visible: true, ...(command.viewport && {viewport: command.viewport})} : {visible: false};
- applyVisibility(host);
- return;
- }
- if (command.type === "destroy") { destroy(host); return; }
- if (command.type === "setPoints") {
- if (command.revision <= host.revision) return;
- host.pointGestureUntil = 0;
- host.revision = command.revision;
- host.points = command;
- host.ids = new Set(command.points.map(point => point.id));
- } else if (command.type === "theme") host.init.theme = command.theme;
- if (host.ready) post(host, command);
- });
- ipcMain.on("siyuan-map-destroy", (event, value) => destroy(getHost(event, value)));
- app.on("before-quit", () => [...hosts.values()].forEach(destroy));
- return {registerOwner, destroyAll: () => [...hosts.values()].forEach(destroy)};
-};
-
-module.exports = {createMapSessionRouter, createMapHostManager, MAP_HOST_BOOTSTRAP_TIMEOUT, MAP_HOST_READY_TIMEOUT};
diff --git a/app/electron/mapHostManager.test.js b/app/electron/mapHostManager.test.js
deleted file mode 100644
index b867d9ec6e..0000000000
--- a/app/electron/mapHostManager.test.js
+++ /dev/null
@@ -1,1084 +0,0 @@
-const assert = require("node:assert/strict");
-const {EventEmitter} = require("node:events");
-const {test} = require("node:test");
-const fs = require("node:fs");
-const path = require("node:path");
-const {createMapSessionRouter, createMapHostManager} = require("./mapHostManager");
-const {MAP_WEBVIEW_PREFERENCES} = require("./mapWebviewHost");
-
-const origin = "http://127.0.0.1:6806";
-const instanceID = "a".repeat(48);
-const envelope = {version: 1, instanceID};
-const createSession = () => {
- const ses = Object.assign(new EventEmitter(), {handlers: {}, protocols: {}, cleanup: [], fetches: []});
- for (const method of ["setPermissionRequestHandler", "setPermissionCheckHandler", "setDevicePermissionHandler",
- "setDisplayMediaRequestHandler", "setCertificateVerifyProc", "allowNTLMCredentialsForDomains"]) {
- ses[method] = value => { ses.handlers[method] = value; };
- }
- for (const method of ["closeAllConnections", "clearStorageData", "clearAuthCache", "clearCache", "clearHostResolverCache"]) {
- ses[method] = async () => { ses.cleanup.push(method); };
- }
- ses.webRequest = {};
- for (const method of ["onBeforeRequest", "onBeforeSendHeaders", "onHeadersReceived"]) {
- ses.webRequest[method] = handler => { ses.handlers[method] = handler; };
- }
- ses.protocol = {handle(scheme, handler) { ses.protocols[scheme] = handler; }};
- ses.fetch = async (url, options) => {
- ses.fetches.push({url, options});
- return new Response("tile", {headers: {"Content-Type": "application/octet-stream"}});
- };
- ses.before = details => {
- let result;
- ses.handlers.onBeforeRequest({method: "GET", resourceType: "xhr", ...details}, value => { result = value; });
- return result;
- };
- return ses;
-};
-const setupRouter = (options = {}) => {
- const ses = createSession();
- const files = [];
- const router = createMapSessionRouter({ses, origin, appDir: "/app", readFile: async file => {
- files.push(file); return Buffer.from("asset");
- }, ...options});
- return {ses, router, files};
-};
-
-test("anonymous map session blocks permissions, downloads, credentials and all non-manifest kernel traffic", async () => {
- const {ses, router, files} = setupRouter();
- let permission;
- ses.handlers.setPermissionRequestHandler({}, "geolocation", result => { permission = result; });
- assert.equal(permission, false);
- assert.equal(ses.handlers.setPermissionCheckHandler(), false);
- assert.equal(ses.handlers.setDevicePermissionHandler(), false);
- let download = false;
- ses.emit("will-download", {preventDefault() { download = true; }});
- assert.equal(download, true);
- for (const url of [origin + "/api/system/getConf", origin + "/api/network/proxy", "http://127.0.0.1:6807/api/sql",
- "file:///etc/passwd", "ws://127.0.0.1:6806/ws", "https://webapi.amap.com/maps"]) {
- assert.equal(ses.before({url}).cancel, true, url);
- assert.equal((await ses.protocols.http(new Request(url.replace(/^ws:/, "http:")))).status, 403);
- }
- const response = await ses.protocols.http(new Request(origin + "/stage/map/index.html?provider=openfreemap"));
- assert.equal(await response.text(), "asset");
- assert.equal(files.length, 1);
- assert.equal(files[0], path.join("/app", "stage/map/index.html"));
- assert.match(response.headers.get("content-security-policy"), /sandbox allow-scripts/);
- assert.equal(ses.fetches.length, 0);
- let headers;
- ses.handlers.onBeforeSendHeaders({requestHeaders: {Cookie: "secret", Authorization: "secret", "Proxy-Authorization": "secret", Accept: "*/*"}}, value => { headers = value; });
- assert.deepEqual(headers.requestHeaders, {Accept: "*/*"});
- ses.handlers.onHeadersReceived({responseHeaders: {"Set-Cookie": ["secret"], "Content-Type": ["image/png"]}}, value => { headers = value; });
- assert.deepEqual(headers.responseHeaders, {"Content-Type": ["image/png"]});
- router.destroy();
-});
-
-test("session allows only one exact initial document and no subframe, websocket or service worker", async () => {
- const {ses, router} = setupRouter();
- const url = origin + "/stage/map/index.html?provider=openfreemap";
- assert.equal(ses.before({url, resourceType: "mainFrame"}).cancel, false);
- assert.equal(ses.before({url, resourceType: "mainFrame"}).cancel, true);
- for (const resourceType of ["subFrame", "webSocket"]) {
- assert.equal(ses.before({url: "https://tiles.openfreemap.org/a", resourceType}).cancel, true);
- }
- assert.equal(ses.before({url: "blob:" + origin + "/worker", resourceType: "other"}).cancel, false);
- assert.equal(ses.before({url: "data:text/html,evil", resourceType: "mainFrame"}).cancel, true);
- assert.equal((await ses.protocols.http(new Request(origin + "/stage/build/map/host.js", {headers: {"Service-Worker": "script"}}))).status, 403);
- router.destroy();
-});
-
-test("provider forwarding uses its own session with no browser secrets and validates every redirect", async () => {
- const {ses, router} = setupRouter();
- ses.fetch = async (url, options) => {
- ses.fetches.push({url, options});
- return new Response(null, {status: 302, headers: {Location: origin + "/api/system/getConf"}});
- };
- const request = new Request("https://tiles.openfreemap.org/start", {headers: {
- Cookie: "secret", Authorization: "Bearer secret", "X-User-Token": "secret", Referer: origin + "/private-note", Accept: "application/json",
- }});
- assert.equal((await ses.protocols.https(request)).status, 403);
- assert.equal(ses.fetches.length, 1);
- assert.equal(ses.fetches[0].options.credentials, "omit");
- assert.equal(ses.fetches[0].options.bypassCustomProtocolHandlers, true);
- assert.equal(ses.fetches[0].options.redirect, "manual");
- assert.deepEqual(ses.fetches[0].options.headers, {Referer: origin + "/", accept: "application/json"});
- router.destroy();
-});
-
-test("same-provider redirects work without leaking redirect headers or provider cookies", async () => {
- const tracked = [];
- const {ses, router} = setupRouter({trackFetch: (url, delta) => tracked.push([url, delta])});
- ses.fetch = async (url, options) => {
- ses.fetches.push({url, options});
- return url.endsWith("/start") ? new Response(null, {status: 307, headers: {Location: "/end"}}) :
- new Response("tile", {headers: {"Set-Cookie": "secret", Refresh: "0;url=http://localhost", "Content-Type": "image/png"}});
- };
- const response = await ses.protocols.https(new Request("https://tiles.openfreemap.org/start"));
- assert.equal(await response.text(), "tile");
- assert.equal(ses.fetches.length, 2);
- assert.equal(response.headers.get("set-cookie"), null);
- assert.equal(response.headers.get("refresh"), null);
- assert.equal(tracked.reduce((total, entry) => total + entry[1], 0), 0);
- router.destroy();
-});
-
-test("OpenFreeMap redirects cannot reach other providers or unapproved hosts on any hop", async () => {
- for (const to of ["jsapi.amap.com", "jsapi-service.amap.com", "webapi.amap.com", "restapi.amap.com",
- "webrd01.is.autonavi.com", "map.qq.com", "api.map.baidu.com", "tiles.openfreemap.org.evil.invalid"]) {
- const reports = [], tracked = [];
- const {ses, router} = setupRouter({report: code => reports.push(code),
- trackFetch: (url, delta) => tracked.push([url, delta])});
- ses.fetch = async (url, options) => {
- ses.fetches.push({url, options});
- return new Response(null, {status: 302, headers: {
- Location: url.endsWith("/start") ? "/next" : "https://" + to + "/private?key=secret",
- }});
- };
- const initialURL = "https://tiles.openfreemap.org/start";
- const response = await ses.protocols.https(new Request(initialURL));
- assert.equal(response.status, 403, to);
- assert.deepEqual(ses.fetches.map(fetch => fetch.url), [initialURL, "https://tiles.openfreemap.org/next"]);
- assert.deepEqual(reports, ["providerRequestDenied"]);
- assert.equal(response.headers.get("location"), null);
- assert.equal(tracked.reduce((total, entry) => total + entry[1], 0), 0);
- router.destroy();
- }
-});
-
-test("OpenFreeMap redirect loops remain bounded and release anonymous request tracking", async () => {
- const tracked = [];
- const {ses, router} = setupRouter({trackFetch: (url, delta) => tracked.push([url, delta])});
- ses.fetch = async (url, options) => {
- ses.fetches.push({url, options});
- return new Response(null, {status: 302, headers: {Location: "/loop"}});
- };
- assert.equal((await ses.protocols.https(new Request("https://tiles.openfreemap.org/loop"))).status, 403);
- assert.equal(ses.fetches.length, 6);
- assert.equal(tracked.reduce((total, entry) => total + entry[1], 0), 0);
- router.destroy();
-});
-
-test("destroy aborts in-flight provider requests, clears session state and leaves orphan traffic denied", async () => {
- const {ses, router} = setupRouter();
- let signal;
- ses.fetch = async (_url, options) => {
- signal = options.signal;
- return new Promise((_resolve, reject) => signal.addEventListener("abort", () => reject(new Error("aborted"))));
- };
- const pending = ses.protocols.https(new Request("https://tiles.openfreemap.org/tile"));
- router.destroy();
- assert.equal(signal.aborted, true);
- assert.equal((await pending).status, 403);
- assert.equal(ses.before({url: "https://tiles.openfreemap.org/tile"}).cancel, true);
- assert.equal((await ses.protocols.http(new Request(origin + "/stage/map/host.css"))).status, 403);
- assert.deepEqual(ses.cleanup.sort(), ["clearAuthCache", "clearCache", "clearHostResolverCache", "clearStorageData", "closeAllConnections"].sort());
- router.destroy();
- assert.equal(ses.cleanup.length, 5);
-});
-
-const setup = (initialFault, mode = "remote", autoAttach = true) => {
- let sequence = 0;
- const faults = new Set(initialFault ? [initialFault] : []);
- const fault = name => {
- if (faults.has(name)) throw new Error("https://private.invalid/?key=secret " + name);
- };
- const handlers = {}, sessions = [], guests = [], channels = [], order = [], switches = new Map();
- const app = Object.assign(new EventEmitter(), {commandLine: {
- hasSwitch: name => switches.has(name), getSwitchValue: name => switches.get(name),
- }});
- const contents = id => Object.assign(new EventEmitter(), {id, mainFrame: {url: origin + "/stage/build/app/"}, sent: [], destroyed: false, zoom: 1,
- isDestroyed() { return this.destroyed; }, getZoomFactor() { return this.zoom; },
- send(...args) { this.sent.push(structuredClone(args)); }});
- const owner = contents(1);
- const win = Object.assign(new EventEmitter(), {webContents: owner, destroyed: false, focused: true, visible: true, minimized: false,
- isDestroyed() { return this.destroyed; }, isFocused() { return this.focused; },
- isVisible() { return this.visible; }, isMinimized() { return this.minimized; }});
- const target = {origin, mode};
- app.on("web-contents-created", (_event, guest) => guest.setWindowOpenHandler(() => ({action: "allow"})));
- let initialized = true;
- const manager = createMapHostManager({app, appDir: "/app", getTarget: id => id === 1 ? target : undefined,
- isInitialized: () => initialized, readFile: async () => Buffer.from("asset"), randomID: () => (++sequence).toString(16).padStart(48, "0"),
- ipcMain: {handle: (name, handler) => { handlers[name] = handler; }, on: (name, handler) => { handlers[name] = handler; }},
- BrowserWindow: {fromWebContents: value => value === owner ? win : undefined},
- session: {fromPartition(partition, options) {
- fault("session");
- const ses = createSession(); Object.assign(ses, {partition, options}); sessions.push(ses);
- const setPermission = ses.setPermissionRequestHandler;
- ses.setPermissionRequestHandler = value => { fault("router"); setPermission(value); };
- return ses;
- }},
- MessageChannelMain: class {
- constructor() {
- fault("channel");
- const port = () => Object.assign(new EventEmitter(), {sent: [],
- on(...args) { fault("portListener"); return EventEmitter.prototype.on.apply(this, args); },
- postMessage(value) { fault("portPost"); this.sent.push(structuredClone(value)); },
- start() { fault("portStart"); this.started = true; }, close() { this.closed = true; }});
- this.port1 = port(); this.port2 = port(); channels.push(this);
- }
- },
- });
- manager.registerOwner(owner);
- const event = () => ({sender: owner, senderFrame: owner.mainFrame});
- const attach = (descriptor, overrides = {}) => {
- const params = {src: descriptor.src, partition: descriptor.partition, ...overrides.params};
- const preferences = {nodeIntegration: true, sandbox: false, preload: "/untrusted.js", ...overrides.preferences};
- const attachEvent = {sender: owner, prevented: false, preventDefault() { this.prevented = true; }, ...overrides.event};
- owner.emit("will-attach-webview", attachEvent, preferences, params);
- if (attachEvent.prevented) return {attachEvent, preferences};
- const guest = Object.assign(contents(500 + guests.length), {session: preferences.session, hostWebContents: owner,
- url: descriptor.src, getType: () => "webview", getLastWebPreferences: () => preferences,
- getURL() { return this.url; },
- setWindowOpenHandler(handler) { this.openHandler = handler; order.push("openHandler"); },
- setBackgroundThrottling(value) { this.throttling = value; order.push("throttling:" + value); },
- postMessage(...args) { fault("portTransfer"); this.transferred = args; },
- stop() { fault("stop"); this.stopped = true; },
- close(options) { this.closeOptions = options; this.destroyed = true; this.emit("destroyed"); }, ...overrides.contents});
- guest.preferences = preferences;
- const on = guest.on;
- guest.on = function (...args) { fault("listener"); return on.apply(this, args); };
- guests.push(guest);
- if (overrides.deferCreated) return {attachEvent, preferences, guest};
- app.emit("web-contents-created", {}, guest);
- if (!guest.destroyed && !overrides.skipVerified) owner.emit("did-attach-webview", {}, guest);
- if (faults.has("earlyConsole")) {
- guest.emit("console-message", {message: "Creating a worker from 'blob:null/private' violates the following Content Security Policy directive: \"worker-src 'none'\"."});
- }
- return {attachEvent, preferences, guest};
- };
- const create = (data = {}) => {
- const descriptor = handlers["siyuan-map-create"](event(), {...envelope, provider: "openfreemap", theme: "light", ...data});
- if (autoAttach && !descriptor.error) attach(descriptor);
- return descriptor;
- };
- const command = data => handlers["siyuan-map-command"](event(), {...envelope, ...data});
- const reply = data => channels.at(-1).port1.emit("message", {data: {...envelope, ...data}});
- const load = () => guests.at(-1).emit("did-finish-load");
- return {manager, app, handlers, sessions, guests, channels, order, switches, owner, win, target, event, create, command, reply, load, faults, attach,
- setInitialized(value) { initialized = value; }};
-};
-
-const managerTest = (name, run) => {
- for (const mode of ["local", "remote"]) test(name + " (" + mode + ")", t => run(t, mode));
-};
-
-managerTest("map guest keeps an isolated memory session, secure preferences, denied external navigation and credential-free bootstrap", (_t, mode) => {
- const s = setup(undefined, mode);
- assert.equal(s.create({credentials: {apiKey: "test-key", securityCode: "test-code"}}).mode, "webview");
- const prefs = s.guests[0].preferences;
- assert.equal(prefs.sandbox, true); assert.equal(prefs.webSecurity, true); assert.equal(prefs.contextIsolation, true);
- for (const key of ["nodeIntegration", "nodeIntegrationInSubFrames", "nodeIntegrationInWorker", "webviewTag", "allowRunningInsecureContent"]) {
- assert.equal(prefs[key], false);
- }
- assert.equal(s.sessions[0].partition.startsWith("persist:"), false);
- assert.deepEqual(s.sessions[0].options, {cache: false});
- assert.deepEqual(s.order, ["openHandler", "openHandler", "openHandler"]);
- assert.deepEqual(s.guests[0].openHandler({url: "file:///etc/passwd"}), {action: "deny"});
- assert.equal(s.channels.length, 0);
- assert.equal(s.guests[0].url.includes("test-key"), false);
- s.load();
- assert.equal(s.channels[0].port1.sent.length, 0);
- s.reply({type: "ready"});
- assert.equal(s.owner.sent.length, 0);
- s.reply({type: "bootstrapReady"});
- assert.deepEqual(s.channels[0].port1.sent[0], {...envelope, type: "init", provider: "openfreemap", theme: "light"});
- s.reply({type: "bootstrapReady"});
- assert.equal(s.channels[0].port1.sent.length, 1);
- s.manager.destroyAll();
-});
-
-managerTest("only initialized registered owner main frame may create, update or destroy a map", (_t, mode) => {
- const s = setup(undefined, mode);
- const create = s.handlers["siyuan-map-create"];
- const config = {...envelope, provider: "openfreemap", theme: "light"};
- assert.throws(() => create({...s.event(), senderFrame: {}}, config));
- s.setInitialized(false); assert.throws(() => create(s.event(), config)); s.setInitialized(true);
- s.owner.mainFrame.url = "http://evil.example/stage/build/app/"; assert.throws(() => create(s.event(), config));
- s.owner.mainFrame.url = origin + "/stage/build/app/";
- s.create();
- s.handlers["siyuan-map-destroy"]({...s.event(), senderFrame: {}}, envelope);
- assert.equal(s.guests[0].destroyed, false);
- s.target.origin = "http://127.0.0.1:6807";
- s.handlers["siyuan-map-destroy"](s.event(), envelope);
- assert.equal(s.guests[0].destroyed, true, "a changed kernel origin revokes the guest");
- s.manager.destroyAll();
-});
-
-managerTest("points and clicks are bounded by current revision and membership; ready is one-shot", (_t, mode) => {
- const s = setup(undefined, mode); s.create(); s.load();
- s.command({type: "setPoints", revision: 2, points: [{id: "row", longitude: 10, latitude: 20, secret: "never"}]});
- s.reply({type: "bootstrapReady"}); s.reply({type: "ready"}); s.reply({type: "ready"});
- assert.equal(s.owner.sent.filter(entry => entry[1].type === "ready").length, 1);
- assert.deepEqual(s.channels[0].port1.sent.find(entry => entry.type === "setPoints").points,
- [{id: "row", longitude: 10, latitude: 20}]);
- s.reply({type: "markerClick", id: "row", revision: 1});
- s.reply({type: "markerClick", id: "unknown", revision: 2});
- s.reply({type: "markerClick", id: "row", revision: 2, url: "https://evil.example"});
- assert.deepEqual(s.owner.sent.filter(entry => entry[1].type === "markerClick").map(entry => entry[1]),
- [{...envelope, type: "markerClick", id: "row", revision: 2}]);
- s.command({type: "setPoints", revision: 3, points: []});
- s.reply({type: "markerClick", id: "row", revision: 2});
- assert.equal(s.owner.sent.filter(entry => entry[1].type === "markerClick").length, 1);
- s.manager.destroyAll();
-});
-
-managerTest("picked coordinates require opt-in, a current revision and one recent visible pointer gesture", (t, mode) => {
- let now = 100000;
- t.mock.method(Date, "now", () => now);
- for (const picking of [false, true]) {
- const s = setup(undefined, mode); s.create({picking}); s.load();
- s.reply({type: "bootstrapReady"}); s.reply({type: "ready"});
- s.command({type: "setPoints", revision: 1, points: []});
- s.command({type: "visibility", visible: true});
- const contents = s.guests[0];
- const click = () => contents.emit("before-mouse-event", {}, {type: "mouseUp", button: "left"});
- const point = {type: "pointClick", revision: 1, longitude: 0, latitude: 0};
- const replies = () => s.owner.sent.filter(entry => entry[1].type === "pointClick");
- s.reply(point);
- contents.emit("before-input-event", {}, {type: "keyDown", key: "Enter", isAutoRepeat: false});
- s.reply(point);
- assert.equal(replies().length, 0);
- click(); s.reply({...point, revision: 0}); s.reply({...point, longitude: 181});
- assert.equal(replies().length, 0);
- s.reply({...point, name: "private"}); s.reply(point);
- assert.equal(replies().length, picking ? 1 : 0);
- if (picking) assert.deepEqual(replies()[0][1], {...envelope, ...point});
- click(); s.win.emit("blur"); s.reply(point);
- click(); s.command({type: "visibility", visible: false}); s.command({type: "visibility", visible: true}); s.reply(point);
- click(); now += 1001; s.reply(point);
- assert.equal(replies().length, picking ? 1 : 0);
- click(); s.command({type: "setPoints", revision: 2, points: []}); s.reply(point);
- s.reply({...point, revision: 2});
- assert.equal(replies().length, picking ? 1 : 0);
- s.manager.destroyAll();
- assert.equal(contents.listenerCount("before-mouse-event"), 0);
- }
-});
-
-managerTest("attribution links require one recent trusted guest input in a ready visible focused map", (t, mode) => {
- let now = 100000;
- t.mock.method(Date, "now", () => now);
- const s = setup(undefined, mode); s.create(); s.load();
- const contents = s.guests[0];
- const click = () => contents.emit("before-mouse-event", {}, {type: "mouseUp", button: "left"});
- const links = () => s.owner.sent.filter(entry => entry[1].type === "attributionClick").map(entry => entry[1]);
- const visibility = {type: "visibility", visible: true, viewport: {x: 0, y: 0, width: 400, height: 300}};
- click(); s.reply({type: "attributionClick", link: "maplibre"});
- s.reply({type: "bootstrapReady"}); s.reply({type: "ready"});
- click(); s.reply({type: "attributionClick", link: "maplibre"});
- assert.deepEqual(links(), []);
- s.command(visibility);
- s.reply({type: "attributionClick", link: "maplibre"});
- assert.deepEqual(links(), [], "a provider message alone is insufficient");
- click();
- s.reply({type: "attributionClick", link: "maplibre", instanceID: "b".repeat(48)});
- s.reply({type: "attributionClick", link: "https://evil.invalid/"});
- assert.deepEqual(links(), []);
- s.reply({type: "attributionClick", link: "maplibre", href: "https://evil.invalid/"});
- s.reply({type: "attributionClick", link: "openstreetmap"});
- assert.deepEqual(links(), [{...envelope, type: "attributionClick", link: "maplibre"}]);
- contents.emit("before-input-event", {}, {type: "keyDown", key: "Enter", isAutoRepeat: false});
- s.reply({type: "attributionClick", link: "openstreetmap"});
- assert.equal(links().length, 2);
- click(); s.win.focused = false; s.win.emit("blur");
- assert.equal(s.channels[0].port1.sent.filter(value => value.type === "visibility").at(-1).visible, true,
- "switching applications keeps the visible map painted");
- s.reply({type: "attributionClick", link: "maplibre"});
- click(); s.reply({type: "attributionClick", link: "maplibre"});
- contents.emit("before-input-event", {}, {type: "keyDown", key: "Enter", isAutoRepeat: false});
- s.reply({type: "attributionClick", link: "maplibre"});
- assert.equal(links().length, 2, "an unfocused visible map cannot authorize an attribution link");
- s.win.focused = true; s.win.emit("focus");
- s.reply({type: "attributionClick", link: "maplibre"});
- assert.equal(links().length, 2, "blur invalidates an outstanding gesture even after focus returns");
- click(); s.command({type: "visibility", visible: false});
- s.reply({type: "attributionClick", link: "maplibre"});
- s.command(visibility);
- s.reply({type: "attributionClick", link: "maplibre"});
- assert.equal(links().length, 2, "hidden visibility invalidates an outstanding gesture");
- click(); now += 1001; s.reply({type: "attributionClick", link: "maplibre"});
- assert.equal(links().length, 2, "expired guest input cannot open a link");
- s.command({type: "visibility", visible: true, viewport: {x: 0, y: 0, width: 400, height: 300}});
- const sent = s.channels[0].port1.sent.filter(message => message.type === "visibility");
- assert.deepEqual(sent.map(message => message.visible), [false, true, false, true]);
- assert.deepEqual(sent[1].viewport, {x: 0, y: 0, width: 400, height: 300});
- s.manager.destroyAll();
- assert.equal(contents.listenerCount("before-mouse-event"), 0);
- assert.equal(contents.listenerCount("before-input-event"), 0);
-});
-
-managerTest("known host diagnostics are bounded fixed codes and stop on disposal", (_t, mode) => {
- const s = setup(undefined, mode); s.create();
- const contents = s.guests[0];
- const message = "Content Security Policy worker-src 'none'; https://secret.invalid/?key=private";
- contents.emit("console-message", {message});
- contents.emit("console-message", {message});
- contents.emit("console-message", {message: "unclassified private detail"});
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "diagnostic", code: "cspWorker"}]);
- s.manager.destroyAll();
- contents.emit("console-message", {message: "WebGL initialization failed"});
- assert.equal(s.owner.sent.length, 1);
-});
-
-managerTest("CSP resources are captured before load, deduplicated by category and isolated from the map port", (_t, mode) => {
- const s = setup("earlyConsole", mode); s.create();
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "diagnostic", code: "cspWorker", resource: "blob"}]);
- const contents = s.guests[0];
- const emit = url => contents.emit("console-message", {}, 2,
- `Connecting to '${url}' violates the following Content Security Policy directive: "connect-src https://tiles.openfreemap.org".`);
- emit("https://tiles.openfreemap.org/path?key=secret");
- emit("https://tiles.openfreemap.org/another?key=another-secret");
- emit("blob:null/private");
- for (let index = 0; index < 100; index++) emit(`https://unknown-${index}.invalid/secret`);
- assert.deepEqual(s.owner.sent.map(entry => entry[1].resource), ["blob", "https:tiles.openfreemap.org", "blob", "redacted"]);
- assert.equal(JSON.stringify(s.owner.sent).includes("secret"), false);
- const count = s.owner.sent.length;
- s.load();
- s.reply({type: "diagnostic", code: "cspWorker", resource: "https:tiles.openfreemap.org"});
- s.owner.emit("console-message", {message: "Content Security Policy worker-src 'none'"});
- assert.equal(s.owner.sent.length, count, "only the known map contents can contribute diagnostics");
- s.manager.destroyAll();
- emit("http://tiles.openfreemap.org/private");
- assert.equal(s.owner.sent.length, count);
-});
-
-managerTest("unapproved CSP hostnames redact and deduplicate without entering public diagnostics", (_t, mode) => {
- const s = setup(undefined, mode); s.create();
- const contents = s.guests[0];
- for (let index = 0; index < 100; index++) {
- contents.emit("console-message", {message: `Connecting to 'https://map${index}.openfreemap.org/private?key=secret' violates the following Content Security Policy directive: "connect-src https://tiles.openfreemap.org".`});
- }
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "diagnostic", code: "cspConnect", resource: "redacted"}]);
- assert.equal(JSON.stringify(s.owner.sent).includes("secret"), false);
- s.manager.destroyAll();
-});
-
-test("provider routing reports fixed transport failures without logging requests", async () => {
- const diagnostics = [];
- const {ses, router} = setupRouter({report: code => diagnostics.push(code)});
- ses.before({url: "http://webapi.amap.com/maps?key=private"});
- assert.deepEqual(diagnostics, ["providerInsecureRequest"]);
- ses.fetch = async () => new Response("private body", {status: 403});
- assert.equal((await ses.protocols.https(new Request("https://tiles.openfreemap.org/style?key=private"))).status, 403);
- assert.equal(diagnostics.at(-1), "providerHTTPFailure");
- ses.fetch = async () => { throw new Error("https://secret.invalid/?key=private"); };
- await ses.protocols.https(new Request("https://tiles.openfreemap.org/style?key=private"));
- assert.equal(diagnostics.at(-1), "providerNetworkFailure");
- ses.fetch = async () => new Response(null, {status: 302, headers: {Location: "http://tiles.openfreemap.org/?key=private"}});
- await ses.protocols.https(new Request("https://tiles.openfreemap.org/style"));
- assert.equal(diagnostics.at(-1), "providerInsecureRequest");
- ses.fetch = async () => new Response(new ReadableStream({pull(controller) { controller.error(new Error("private body failure")); }}));
- const broken = await ses.protocols.https(new Request("https://tiles.openfreemap.org/style"));
- await assert.rejects(broken.text());
- assert.equal(diagnostics.at(-1), "providerNetworkFailure");
- const count = diagnostics.length;
- router.destroy();
- ses.before({url: "http://webapi.amap.com/maps?key=private"});
- assert.equal(diagnostics.length, count);
- assert.equal(JSON.stringify(diagnostics).includes("private"), false);
-});
-
-managerTest("destroy and owner navigation close real contents, ports, requests and session; stale events cannot resurrect", (_t, mode) => {
- const s = setup(undefined, mode); s.create(); s.load(); s.reply({type: "bootstrapReady"});
- s.owner.emit("did-start-navigation", {isMainFrame: true, isSameDocument: false});
- assert.equal(s.guests[0].destroyed, true);
- assert.deepEqual(s.guests[0].closeOptions, {waitForBeforeUnload: false});
- assert.equal(s.channels[0].port1.closed, true); assert.equal(s.channels[0].port2.closed, true);
- assert.equal(s.sessions[0].cleanup.length, 5);
- s.reply({type: "ready"}); assert.equal(s.owner.sent.length, 0);
- s.manager.destroyAll(); assert.equal(s.sessions[0].cleanup.length, 5);
- s.create({instanceID: "b".repeat(48)});
- assert.notEqual(s.sessions[0].partition, s.sessions[1].partition);
- s.manager.destroyAll();
-});
-
-managerTest("unsafe effective switches reject creation and duplicate instance IDs cannot replace a running host", (_t, mode) => {
- const s = setup(undefined, mode); s.switches.set("disable-web-security", "");
- assert.equal(s.create().error, "unsupportedEnvironment"); assert.equal(s.guests.length, 0);
- s.switches.clear(); s.create(); assert.equal(s.create().error, "hostLimitReached"); assert.equal(s.guests.length, 1);
- s.manager.destroyAll();
-});
-
-managerTest("capability is credential-free and only supports trusted owners with safe process switches", (_t, mode) => {
- const s = setup(undefined, mode);
- const capability = s.handlers["siyuan-map-capability"];
- assert.deepEqual(capability(s.event()), {version: 1, supported: true});
- assert.deepEqual(capability({...s.event(), senderFrame: {}}), {version: 1, supported: false, reason: "notMainFrame"});
- s.switches.set("no-sandbox", "");
- assert.deepEqual(capability(s.event()), {version: 1, supported: false, reason: "unsafeProcessSwitches"});
- assert.equal(s.guests.length, 0);
-});
-
-managerTest("Electron's default file-access switch permits the HTTP map host while file access stays denied", async (_t, mode) => {
- const s = setup(undefined, mode);
- s.switches.set("allow-file-access-from-files", "");
- assert.deepEqual(s.handlers["siyuan-map-capability"](s.event()), {version: 1, supported: true});
- assert.equal(s.create().mode, "webview");
- const ses = s.sessions[0];
- assert.equal((await ses.protocols.file(new Request("file:///etc/passwd"))).status, 403);
- assert.equal(ses.before({url: "file:///etc/passwd", resourceType: "mainFrame"}).cancel, true);
- assert.equal(ses.before({url: "file:///etc/passwd", resourceType: "xhr"}).cancel, true);
- s.owner.mainFrame.url = "file:///app/index.html";
- assert.equal(s.handlers["siyuan-map-capability"](s.event()).supported, false);
- s.manager.destroyAll();
-});
-
-managerTest("navigation, redirects, client certificates, login and renderer failure are blocked", (_t, mode) => {
- const s = setup(undefined, mode); s.create(); const wc = s.guests[0];
- for (const name of ["will-navigate", "will-frame-navigate", "will-redirect", "will-attach-webview"]) {
- let prevented = false; wc.emit(name, {preventDefault() { prevented = true; }}); assert.equal(prevented, true, name);
- }
- for (const name of ["select-client-certificate", "login"]) {
- let prevented = false, answered = false;
- wc.emit(name, {preventDefault() { prevented = true; }}, {}, {}, (...args) => { answered = true; assert.equal(args.length, 0); });
- assert.equal(prevented, true); assert.equal(answered, true);
- }
- wc.emit("render-process-gone"); assert.equal(wc.destroyed, true);
- assert.equal(s.owner.sent[0][1].code, "hostRendererGone");
-});
-
-managerTest("main-process provider fetch cannot select client certificates or authenticate, including null WebContents", async (_t, mode) => {
- const s = setup(undefined, mode); s.create();
- let finish;
- s.sessions[0].fetch = () => new Promise(resolve => { finish = resolve; });
- const url = "https://tiles.openfreemap.org/tile";
- const pending = s.sessions[0].protocols.https(new Request(url));
- for (const name of ["select-client-certificate", "login"]) {
- let prevented = false, answered = false;
- s.app.emit(name, {preventDefault() { prevented = true; }}, null,
- name === "login" ? {url} : url, {}, (...args) => { answered = true; assert.equal(args.length, 0); });
- assert.equal(prevented, true); assert.equal(answered, true);
- }
- let affectedOtherURL = false;
- s.app.emit("select-client-certificate", {preventDefault() { affectedOtherURL = true; }}, null,
- "https://example.com/", [], () => {});
- assert.equal(affectedOtherURL, false);
- finish(new Response("tile"));
- assert.equal(await (await pending).text(), "tile");
- s.manager.destroyAll();
-});
-
-managerTest("a closed runtime port destroys the map instead of retaining a live orphan renderer", (_t, mode) => {
- const s = setup(undefined, mode); s.create(); s.load();
- s.channels[0].port1.emit("close");
- assert.equal(s.guests[0].destroyed, true);
- assert.equal(s.owner.sent[0][1].code, "hostPortClosed");
-});
-
-managerTest("bootstrap and SDK receive separate deadlines and duplicate bootstrap cannot extend SDK lifetime", (t, mode) => {
- t.mock.timers.enable({apis: ["setTimeout"]});
- const s = setup(undefined, mode); s.create(); s.load();
- t.mock.timers.tick(29000);
- s.reply({type: "bootstrapReady"});
- t.mock.timers.tick(39000);
- assert.equal(s.guests[0].destroyed, false, "both SDK phases retain their own 20-second budget");
- assert.deepEqual(s.owner.sent, []);
- s.reply({type: "bootstrapReady"});
- t.mock.timers.tick(5999);
- assert.equal(s.guests[0].destroyed, false);
- t.mock.timers.tick(1);
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error", code: "hostSDKTimeout"}]);
- assert.equal(s.guests[0].destroyed, true);
- assert.equal(s.channels[0].port1.closed, true);
-});
-
-managerTest("document and bootstrap timeouts have distinct final codes and successful ready clears all deadlines", (t, mode) => {
- t.mock.timers.enable({apis: ["setTimeout"]});
- for (const loaded of [false, true]) {
- const s = setup(undefined, mode); s.create();
- if (loaded) s.load();
- t.mock.timers.tick(29999);
- assert.deepEqual(s.owner.sent, []);
- t.mock.timers.tick(1);
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error",
- code: loaded ? "hostBootstrapTimeout" : "hostDocumentLoadTimeout"}]);
- assert.equal(s.guests[0].destroyed, true);
- }
- const s = setup(undefined, mode); s.create(); s.load();
- t.mock.timers.tick(29000); s.reply({type: "bootstrapReady"});
- t.mock.timers.tick(39999); s.reply({type: "ready"});
- t.mock.timers.tick(90000);
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "ready"}]);
- assert.equal(s.guests[0].destroyed, false);
- s.manager.destroyAll();
-});
-
-managerTest("creation failures return fixed stage codes and release every resource already allocated", (_t, mode) => {
- for (const point of ["session", "router"]) {
- const s = setup(point, mode);
- assert.deepEqual(s.create(), {...envelope, error: "hostSetupFailed"}, point);
- for (const ses of s.sessions) assert.equal(ses.cleanup.length, 5, point);
- assert.equal(s.guests.length, 0);
- assert.equal(JSON.stringify(s.owner.sent).includes("secret"), false, point);
- s.faults.clear();
- assert.equal(s.create().mode, "webview", "a failed instance must not occupy its slot: " + point);
- s.manager.destroyAll();
- }
-});
-
-managerTest("guest listener setup failure closes the guest and releases the reservation", (_t, mode) => {
- const s = setup("listener", mode);
- assert.equal(s.create().mode, "webview");
- assert.equal(s.guests[0].destroyed, true);
- assert.equal(s.guests[0].eventNames().length, 0);
- assert.equal(s.sessions[0].cleanup.length, 5);
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error", code: "hostAttachFailed"}]);
- s.faults.clear();
- assert.equal(s.create().mode, "webview");
- s.manager.destroyAll();
-});
-
-managerTest("main-frame load failure reports document failure without waiting for the deadline", (_t, mode) => {
- const s = setup(undefined, mode); s.create();
- s.guests[0].emit("did-fail-load", {}, -2, "secret", "https://private.invalid/?key=secret", false);
- assert.deepEqual(s.owner.sent, []);
- s.guests[0].emit("did-fail-load", {}, -2, "secret", "https://private.invalid/?key=secret", true);
- assert.equal(s.owner.sent.at(-1)[1].code, "hostDocumentLoadFailed");
- assert.equal(JSON.stringify(s.owner.sent).includes("secret"), false);
- assert.equal(s.guests[0].destroyed, true);
-});
-
-managerTest("unexpected document, reload, destruction and bootstrap rejection retain their final failure reason", (_t, mode) => {
- const cases = [
- ["hostDocumentMismatch", s => { s.guests[0].url += "unexpected"; s.load(); }],
- ["hostDocumentReloaded", s => { s.load(); s.load(); }],
- ["hostDestroyed", s => { s.guests[0].destroyed = true; s.guests[0].emit("destroyed"); }],
- ["hostBootstrapFailed", s => { s.load(); s.reply({type: "error", code: "hostUnavailable"}); }],
- ["hostOperationFailed", s => { s.load(); s.reply({type: "bootstrapReady"}); s.reply({type: "error", code: "hostUnavailable"}); }],
- ];
- for (const [code, trigger] of cases) {
- const s = setup(undefined, mode); s.create(); trigger(s);
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error", code}]);
- assert.equal(s.guests[0].destroyed, true);
- s.manager.destroyAll();
- assert.equal(s.owner.sent.length, 1, "disposal must not manufacture another hostDestroyed failure");
- }
-});
-
-managerTest("port setup and message failures close both endpoints and preserve the fixed failure stage", (_t, mode) => {
- for (const point of ["channel", "portListener", "portStart", "portTransfer"]) {
- const s = setup(undefined, mode); s.create(); s.faults.add(point); s.load();
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error", code: "hostPortSetupFailed"}], point);
- assert.equal(s.guests[0].destroyed, true, point);
- for (const channel of s.channels) {
- assert.equal(channel.port1.closed, true, point);
- assert.equal(channel.port2.closed, true, point);
- }
- }
- for (const ready of [false, true]) {
- const s = setup(undefined, mode); s.create(); s.load();
- if (ready) s.reply({type: "bootstrapReady"});
- s.faults.add("portPost");
- s.reply({type: ready ? "ready" : "bootstrapReady"});
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error", code: "hostOperationFailed"}]);
- assert.equal(s.guests[0].destroyed, true);
- assert.equal(s.guests[0].throttling, false, "a failed post must not continue ready operations");
- }
-});
-
-managerTest("renderer closure still runs when stopping it throws", (_t, mode) => {
- const s = setup(undefined, mode); s.create(); s.load();
- s.faults.add("stop");
- s.channels[0].port1.emit("close");
- assert.deepEqual(s.owner.sent.map(entry => entry[1]), [{...envelope, type: "error", code: "hostPortClosed"}]);
- assert.equal(s.guests[0].destroyed, true);
- assert.equal(s.sessions[0].cleanup.length, 5);
- assert.equal(s.channels[0].port1.closed, true);
- assert.equal(s.channels[0].port2.closed, true);
-});
-
-managerTest("main wiring removes only the process security bypass and never enables remote on map contents", () => {
- const source = fs.readFileSync(path.join(__dirname, "main.js"), "utf8");
- assert.ok(!source.includes('appendSwitch("disable-web-security")'));
- assert.match(source, /createMapHostManager\(/);
- assert.match(source, /webSecurity: kernelTarget.mode === "remote"/);
- const manager = fs.readFileSync(path.join(__dirname, "mapHostManager.js"), "utf8");
- assert.ok(!manager.includes("remote.enable"));
- assert.ok(!manager.includes("executeJavaScript"));
- assert.ok(!manager.includes("session.defaultSession"));
-});
-
-
-managerTest("capability reports bounded reasons for every owner rejection without weakening creation", (_t, mode) => {
- const cases = [
- ["ownerUnavailable", (_s, event) => { event.sender = undefined; }],
- ["ownerUnavailable", s => { s.owner.destroyed = true; }],
- ["notMainFrame", (_s, event) => { event.senderFrame = {url: "https://private.invalid/secret"}; }],
- ["notInitialized", s => s.setInitialized(false)],
- ["unregisteredOwner", s => { s.owner.id = 2; }],
- ["invalidKernelOrigin", s => { s.target.origin = "https://private.invalid/secret"; }],
- ["ownerUnavailable", (_s, event) => { event.sender = {...event.sender}; }],
- ["ownerUnavailable", s => { s.win.destroyed = true; }],
- ["originMismatch", s => { s.owner.mainFrame.url = "https://private.invalid/stage/build/app/?token=secret"; }],
- ["unsupportedDocument", s => { s.owner.mainFrame.url = origin + "/check-auth?token=secret"; }],
- ["invalidDocument", s => { s.owner.mainFrame.url = "invalid secret"; }],
- ];
- for (const [reason, change] of cases) {
- const s = setup(undefined, mode), event = s.event();
- change(s, event);
- assert.deepEqual(s.handlers["siyuan-map-capability"](event), {version: 1, supported: false, reason});
- assert.throws(() => s.handlers["siyuan-map-create"](event, {...envelope, provider: "openfreemap", theme: "light"}));
- assert.equal(s.guests.length, 0);
- s.manager.destroyAll();
- }
-});
-
-const readyWebview = s => {
- const descriptor = s.create();
- const attached = s.attach(descriptor);
- assert.equal(attached.attachEvent.prevented, false);
- assert.equal(attached.guest.destroyed, false);
- attached.guest.emit("did-finish-load");
- s.reply({type: "bootstrapReady"});
- s.reply({type: "ready"});
- s.command({type: "visibility", visible: true, viewport: {x: 0, y: 0, width: 400, height: 300}});
- return {...attached, descriptor};
-};
-
-managerTest("owner registration guards attachments before map creation and stays idempotent", (_t, mode) => {
- const s = setup(undefined, mode, false);
- s.manager.registerOwner(s.owner);
- assert.equal(s.owner.listenerCount("will-attach-webview"), 1);
- assert.equal(s.owner.listenerCount("did-attach-webview"), 1);
- s.setInitialized(false);
- s.owner.mainFrame.url = "about:blank";
- for (const params of [undefined, {}, {src: origin + "/stage/map/index.html?provider=openfreemap"},
- {src: "https://example.invalid/", partition: "plugin-session"},
- {src: "https://example.invalid/", partition: "persist:siyuan-map-forged"},
- {src: "https://example.invalid/", partition: "siyuan-map-forged"}]) {
- const event = {sender: s.owner, prevented: false, preventDefault() { this.prevented = true; }};
- const preferences = {sandbox: false, preload: "/plugin.js"};
- s.owner.emit("will-attach-webview", event, preferences, params);
- assert.equal(event.prevented, mode === "remote" || params?.partition === "siyuan-map-forged");
- assert.deepEqual(preferences, {sandbox: false, preload: "/plugin.js"});
- }
- s.target.mode = "unknown";
- assert.equal(s.attach({src: "https://example.invalid/", partition: "ordinary"}).attachEvent.prevented, true);
- s.owner.emit("destroyed");
- assert.equal(s.owner.listenerCount("will-attach-webview"), 0);
- assert.equal(s.owner.listenerCount("did-attach-webview"), 0);
- s.manager.destroyAll();
-});
-
-managerTest("unreserved created or attached guests obey the current owner's default policy", (_t, mode) => {
- for (const phase of ["created", "attached"]) {
- const s = setup(undefined, mode, false);
- const guest = {session: {}, hostWebContents: s.owner, getType: () => "webview",
- isDestroyed() { return !!this.destroyed; },
- setWindowOpenHandler(value) { this.openHandler = value; }, close() { this.destroyed = true; }};
- if (phase === "created") s.app.emit("web-contents-created", {}, guest);
- else s.owner.emit("did-attach-webview", {}, guest);
- assert.equal(!!guest.destroyed, mode === "remote", phase);
- if (mode === "remote") assert.deepEqual(guest.openHandler({url: "https://example.invalid/"}), {action: "deny"});
- s.manager.destroyAll();
- }
-});
-
-managerTest("a reservation is bound to its owner, exact entry URL and memory partition", (_t, mode) => {
- const s = setup(undefined, mode, false), descriptor = s.create();
- const otherOwner = Object.assign(new EventEmitter(), {id: 2});
- s.manager.registerOwner(otherOwner);
- const foreign = {sender: otherOwner, prevented: false, preventDefault() { this.prevented = true; }};
- otherOwner.emit("will-attach-webview", foreign, {}, {src: descriptor.src, partition: descriptor.partition});
- assert.equal(foreign.prevented, true);
- assert.equal(s.attach(descriptor, {event: {sender: otherOwner}}).attachEvent.prevented, true);
- for (const params of [{src: descriptor.src + "extra"}, {src: descriptor.src.split("#")[0]},
- {src: descriptor.src.replace("provider=openfreemap", "provider=other")},
- {partition: "siyuan-map-forged"}]) {
- assert.equal(s.attach(descriptor, {params}).attachEvent.prevented, true);
- }
- const {guest} = s.attach(descriptor);
- assert.equal(guest.destroyed, false, "foreign attempts cannot consume the owner's reservation");
- assert.equal(s.attach(descriptor).attachEvent.prevented, true);
- s.manager.destroyAll();
-});
-
-managerTest("changing target mode revokes pending and admitted reservations before they can be reused", (_t, mode) => {
- for (const phase of ["reserved", "accepted", "attached", "ready"]) {
- const s = setup(undefined, mode, false), descriptor = s.create();
- let guest;
- if (phase !== "reserved") ({guest} = s.attach(descriptor, {deferCreated: phase === "accepted"}));
- if (phase === "ready") {
- guest.emit("did-finish-load");
- s.reply({type: "bootstrapReady"}); s.reply({type: "ready"});
- }
- s.target.mode = mode === "local" ? "remote" : "local";
- if (phase === "reserved") assert.equal(s.attach(descriptor).attachEvent.prevented, true);
- if (phase === "accepted") s.app.emit("web-contents-created", {}, guest);
- if (phase === "attached") guest.emit("did-finish-load");
- if (phase === "ready") s.command({type: "theme", theme: "dark"});
- if (guest) assert.equal(guest.destroyed, true, phase);
- if (phase !== "ready") assert.equal(s.channels.length, 0, phase);
- else assert.equal(s.channels[0].port1.closed, true);
- assert.equal(s.sessions[0].cleanup.length, 5, phase);
- assert.equal(s.attach(descriptor).attachEvent.prevented, true, "revoked partitions cannot be reused");
- const replacement = s.create();
- assert.equal(replacement.mode, "webview");
- assert.notEqual(replacement.partition, descriptor.partition);
- assert.equal(s.attach(replacement).guest.destroyed, false);
- s.manager.destroyAll();
- }
-});
-
-managerTest("map reserves one fixed memory guest and installs its deny policy before first load", (_t, mode) => {
- const s = setup(undefined, mode, false);
- const descriptor = s.create({mode: "native", src: "https://evil.invalid/", partition: "persist:evil"});
- assert.equal(descriptor.mode, "webview");
- assert.match(descriptor.partition, /^siyuan-map-[a-f0-9]{48}$/);
- assert.match(descriptor.src, new RegExp("^" + origin + "/stage/map/index.html\\?provider=openfreemap#" + instanceID + ":[a-f0-9]{48}$"));
- assert.equal(s.guests.length, 0);
- assert.equal(s.channels.length, 0);
- const {guest, preferences} = s.attach(descriptor);
- assert.equal(guest.session, s.sessions[0]);
- assert.equal(preferences.nodeIntegration, false);
- assert.equal(preferences.sandbox, true);
- assert.match(preferences.preload, /mapHostPreload\.js$/);
- assert.deepEqual(guest.openHandler({url: "https://evil.invalid/"}), {action: "deny"}, "the earlier generic external opener is overridden before loading");
- for (const name of ["will-navigate", "will-frame-navigate", "will-redirect", "will-attach-webview"]) {
- let prevented = false;
- guest.emit(name, {preventDefault() { prevented = true; }});
- assert.equal(prevented, true, name);
- }
- assert.equal(s.channels.length, 0);
- guest.emit("did-finish-load");
- assert.equal(s.channels.length, 1);
- assert.equal(guest.transferred[0], "siyuan-map-port");
- s.reply({type: "bootstrapReady"}); s.reply({type: "ready"});
- assert.deepEqual(s.owner.sent.at(-1)[1], {...envelope, type: "ready"});
- assert.equal(s.attach(descriptor).attachEvent.prevented, true, "attachment permission is single use");
- s.manager.destroyAll();
- assert.equal(guest.destroyed, true);
- assert.equal(s.sessions[0].cleanup.length, 5);
-});
-
-managerTest("guest initial zoom uses the verified owner after clearing untrusted preferences", (_t, mode) => {
- for (const zoom of [0.25, 1.25, 5]) {
- const s = setup(undefined, mode, false);
- s.owner.zoom = zoom;
- const {attachEvent, guest, preferences} = s.attach(s.create(), {preferences: {zoomFactor: 99}});
- assert.equal(attachEvent.prevented, false);
- assert.equal(guest.destroyed, false);
- assert.equal(preferences.zoomFactor, zoom);
- assert.equal(preferences.sandbox, true);
- s.manager.destroyAll();
- }
-});
-
-managerTest("every security preference mismatch rejects a guest before bootstrap", (_t, mode) => {
- for (const preference of ["sandbox", "contextIsolation", "webSecurity", "nodeIntegration", "nodeIntegrationInSubFrames",
- "nodeIntegrationInWorker", "webviewTag", "allowRunningInsecureContent", "experimentalFeatures", "disablePopups",
- "safeDialogs", "disableDialogs"]) {
- const s = setup(undefined, mode, false), descriptor = s.create();
- const {guest} = s.attach(descriptor, {contents: {
- getLastWebPreferences: () => ({...MAP_WEBVIEW_PREFERENCES, [preference]: !MAP_WEBVIEW_PREFERENCES[preference]}),
- }});
- assert.equal(guest.destroyed, true, preference);
- assert.equal(s.channels.length, 0, preference);
- assert.equal(s.sessions[0].cleanup.length, 5, preference);
- assert.equal(s.owner.sent.at(-1)[1].code, "hostAttachFailed", preference);
- s.manager.destroyAll();
- }
-});
-
-managerTest("guest rejects invalid or unavailable owner zoom and releases its reservation", (_t, mode) => {
- for (const zoom of [undefined, "1.25", NaN, Infinity, -Infinity, 0, -1, 0.249, 5.001, "throws"]) {
- const s = setup(undefined, mode, false), descriptor = s.create();
- s.owner.getZoomFactor = () => {
- if (zoom === "throws") throw new Error("destroyed");
- return zoom;
- };
- const {attachEvent, guest} = s.attach(descriptor, {preferences: {zoomFactor: 1.25}});
- assert.equal(attachEvent.prevented, true);
- assert.equal(guest, undefined);
- assert.equal(s.channels.length, 0);
- assert.equal(s.sessions[0].cleanup.length, 5);
- assert.deepEqual(s.owner.sent.at(-1)[1], {...envelope, type: "error", code: "hostAttachFailed"});
- s.owner.getZoomFactor = () => 1;
- assert.equal(s.attach(descriptor).attachEvent.prevented, true, "failed reservations cannot be reused");
- s.manager.destroyAll();
- }
-});
-
-managerTest("attachment guards reject map forgeries and preserve the target-specific ordinary webview policy", (_t, mode) => {
- const s = setup(undefined, mode, false), descriptor = s.create();
- for (const params of [{src: origin + "/api/private"}, {preload: "file:///private.js"}, {nodeintegration: true},
- {webpreferences: "sandbox=false"}, {disablewebsecurity: true}]) {
- assert.equal(s.attach(descriptor, {params}).attachEvent.prevented, true);
- }
- const ordinary = {sender: s.owner, prevented: false, preventDefault() { this.prevented = true; }};
- const ordinaryPrefs = {nodeIntegration: true};
- s.owner.emit("will-attach-webview", ordinary, ordinaryPrefs, {src: "https://example.invalid/", partition: "plugin-session"});
- assert.equal(ordinary.prevented, mode === "remote");
- assert.deepEqual(ordinaryPrefs, {nodeIntegration: true});
- const {guest} = s.attach(descriptor);
- const second = Object.assign(new EventEmitter(), {session: s.sessions[0], hostWebContents: {},
- getType: () => "webview", getLastWebPreferences: () => ({}),
- isDestroyed() { return !!this.destroyed; },
- setWindowOpenHandler(value) { this.openHandler = value; }, close() { this.destroyed = true; }});
- s.app.emit("web-contents-created", {}, second);
- assert.equal(second.destroyed, true);
- assert.deepEqual(second.openHandler({url: "https://evil.invalid/"}), {action: "deny"});
- assert.equal(guest.destroyed, false, "a foreign duplicate cannot revoke the admitted guest");
- s.manager.destroyAll();
-});
-
-managerTest("pending attachments close immediately on owner loss and cannot be revived by late guest creation", (_t, mode) => {
- for (const invalidate of [
- s => s.owner.emit("did-start-navigation", {isMainFrame: true, isSameDocument: false}),
- s => s.owner.emit("destroyed"),
- s => s.owner.emit("render-process-gone"),
- s => s.win.emit("closed"),
- s => s.handlers["siyuan-map-destroy"](s.event(), envelope),
- ]) {
- const s = setup(undefined, mode, false), descriptor = s.create();
- const {guest} = s.attach(descriptor, {deferCreated: true});
- invalidate(s);
- assert.equal(s.sessions[0].cleanup.length, 5);
- s.app.emit("web-contents-created", {}, guest);
- assert.equal(guest.destroyed, true);
- assert.deepEqual(guest.openHandler({url: "https://evil.invalid/"}), {action: "deny"});
- assert.equal(s.channels.length, 0);
- s.manager.destroyAll();
- }
-});
-
-managerTest("unattached map reservation uses the existing fixed bootstrap deadline", (t, mode) => {
- t.mock.timers.enable({apis: ["setTimeout"]});
- const s = setup(undefined, mode, false), descriptor = s.create();
- t.mock.timers.tick(29999);
- assert.equal(s.sessions[0].cleanup.length, 0);
- t.mock.timers.tick(1);
- assert.equal(s.sessions[0].cleanup.length, 5);
- assert.equal(s.owner.sent.at(-1)[1].code, "hostDocumentLoadTimeout");
- assert.equal(s.attach(descriptor).attachEvent.prevented, true);
- s.manager.destroyAll();
-});
-
-managerTest("guest visibility is bounded and survives resize without native geometry or menu handlers", (_t, mode) => {
- const s = setup(undefined, mode, false), {guest} = readyWebview(s);
- const visibility = () => s.channels[0].port1.sent.filter(item => item.type === "visibility");
- const dismiss = () => s.owner.sent.filter(item => item[1].type === "dismissMenu");
- const mouse = () => guest.emit("before-mouse-event", {preventDefault() { assert.fail("map input must continue"); }}, {type: "mouseDown"});
- assert.equal(visibility().at(-1).visible, true);
- for (const name of ["resize", "enter-full-screen", "leave-full-screen"]) s.win.emit(name);
- s.owner.emit("zoom-changed");
- mouse();
- assert.equal(dismiss().length, 1);
- assert.equal(s.handlers["siyuan-map-geometry"], undefined);
- assert.equal(s.handlers["siyuan-map-unplaced-open"], undefined);
- s.win.visible = false; s.win.emit("hide"); mouse();
- assert.equal(dismiss().length, 1);
- assert.equal(visibility().at(-1).visible, false);
- s.win.visible = true; s.win.emit("show"); mouse();
- assert.equal(dismiss().length, 2);
- assert.equal(visibility().at(-1).visible, true);
- s.command({type: "visibility", visible: true, viewport: {x: 0, y: 0, width: Infinity, height: 3}});
- assert.equal(visibility().at(-1).viewport.width, 400);
- s.command({type: "visibility", visible: false}); mouse();
- assert.equal(dismiss().length, 2);
- assert.equal(s.guests.length, 1);
- s.manager.destroyAll();
-});
-
-managerTest("hidden bootstrap gets frames while window and DOM visibility remain authoritative", (_t, mode) => {
- const s = setup(undefined, mode); s.create(); s.load();
- const guest = s.guests[0];
- const visible = {type: "visibility", visible: true, viewport: {x: 0, y: 0, width: 400, height: 300}};
- const visibility = () => s.channels[0].port1.sent.filter(value => value.type === "visibility");
- assert.equal(guest.preferences.backgroundThrottling, false);
- assert.equal(guest.throttling, false);
- s.command(visible);
- assert.equal(visibility().length, 0, "the provider cannot receive a visible state before ready");
- s.command({type: "visibility", visible: false});
- s.reply({type: "bootstrapReady"}); s.reply({type: "ready"});
- assert.equal(guest.throttling, true);
- assert.equal(visibility().at(-1).visible, false);
- s.win.focused = false; s.win.emit("blur"); s.command(visible);
- assert.equal(visibility().at(-1).visible, true, "an unfocused visible window can paint the map");
- for (const [property, hiddenValue, hide, restore] of [
- ["visible", false, "hide", "show"], ["minimized", true, "minimize", "restore"],
- ]) {
- s.win[property] = hiddenValue; s.win.emit(hide);
- assert.equal(visibility().at(-1).visible, false);
- s.command(visible); s.win.emit("focus");
- assert.equal(visibility().at(-1).visible, false, "owner commands cannot expose a hidden window");
- s.win[property] = !hiddenValue; s.win.emit(restore);
- assert.equal(visibility().at(-1).visible, true);
- }
- s.command({type: "visibility", visible: false});
- s.win.focused = true; s.win.emit("focus");
- assert.equal(visibility().at(-1).visible, false, "focus cannot revive an owner-occluded map");
- s.manager.destroyAll();
-});
-
-managerTest("only current trusted guest input dismisses DOM menus; guest replies and revoked owners cannot", (_t, mode) => {
- const s = setup(undefined, mode, false), {guest} = readyWebview(s);
- const dismiss = () => s.owner.sent.filter(item => item[1].type === "dismissMenu");
- s.reply({type: "dismissMenu"});
- assert.equal(dismiss().length, 0);
- guest.emit("before-mouse-event", {}, {type: "mouseDown"});
- assert.deepEqual(dismiss().map(item => item[1]), [{...envelope, type: "dismissMenu"}]);
- s.win.focused = false; guest.emit("before-mouse-event", {}, {type: "mouseDown"}); s.win.focused = true;
- s.setInitialized(false); guest.emit("before-mouse-event", {}, {type: "mouseDown"}); s.setInitialized(true);
- s.target.mode = mode === "local" ? "remote" : "local"; guest.emit("before-mouse-event", {}, {type: "mouseDown"});
- assert.equal(dismiss().length, 1);
- s.reply({type: "markerClick", id: "row", revision: 1});
- assert.equal(guest.destroyed, true, "mode changes revoke the old guest before accepting any reply");
- s.manager.destroyAll();
-});
-
-managerTest("guest load requires verified attachment and exact one-shot document identity", (_t, mode) => {
- for (const failure of ["unverified", "hash", "other-document", "reload"]) {
- const s = setup(undefined, mode, false), descriptor = s.create();
- const {guest} = s.attach(descriptor, {skipVerified: failure === "unverified"});
- guest.emit("did-finish-load");
- if (failure === "hash") guest.emit("did-navigate-in-page");
- if (failure === "other-document") guest.emit("did-navigate", {}, origin + "/api/private");
- if (failure === "reload") guest.emit("did-finish-load");
- assert.equal(guest.destroyed, true, failure);
- if (s.channels.length) assert.equal(s.channels[0].port1.closed, true);
- assert.equal(s.sessions[0].cleanup.length, 5);
- s.manager.destroyAll();
- }
-});
-
-managerTest("kernel target mode is authoritative and unknown modes are not registered owners", (_t, mode) => {
- const s = setup(undefined, mode);
- assert.equal(s.create({mode: "native"}).mode, "webview");
- s.manager.destroyAll();
- delete s.target.mode;
- assert.equal(s.handlers["siyuan-map-capability"](s.event()).reason, "unregisteredOwner");
- assert.throws(() => s.create());
-});
-
-managerTest("guest readback and closure races cannot escape Electron attachment callbacks", (_t, mode) => {
- for (const phase of ["created", "attached", "close-throws"]) {
- const s = setup(undefined, mode, false), descriptor = s.create();
- let reads = 0;
- let attached;
- assert.doesNotThrow(() => {
- attached = s.attach(descriptor, {contents: {
- getLastWebPreferences() {
- reads++;
- if (phase !== "attached" || reads > 1) throw new Error("Object has been destroyed");
- return MAP_WEBVIEW_PREFERENCES;
- },
- close() {
- if (phase === "close-throws") throw new Error("Object has been destroyed");
- this.destroyed = true;
- this.emit("destroyed");
- },
- }});
- }, phase);
- assert.equal(s.channels.length, 0, phase);
- assert.equal(s.sessions[0].cleanup.length, 5, phase);
- assert.equal(s.owner.sent.at(-1)[1].code, "hostAttachFailed", phase);
- if (phase !== "close-throws") assert.equal(attached.guest.destroyed, true);
- s.manager.destroyAll();
- }
- const s = setup(undefined, mode, false);
- assert.doesNotThrow(() => s.app.emit("web-contents-created", {}, {
- setWindowOpenHandler() {}, isDestroyed: () => true,
- getType() { throw new Error("Object has been destroyed"); },
- }));
- s.manager.destroyAll();
-});
diff --git a/app/electron/mapHostPolicy.js b/app/electron/mapHostPolicy.js
deleted file mode 100644
index 302a7d3a98..0000000000
--- a/app/electron/mapHostPolicy.js
+++ /dev/null
@@ -1,151 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-// 只读取固定打包资源,不解析渲染器提供的文件路径,也不代理任何内核请求。
-const mapHostFiles = Object.freeze({
- "/stage/map/index.html": ["stage/map/index.html", "text/html; charset=utf-8"],
- "/stage/map/host.css": ["stage/map/host.css", "text/css; charset=utf-8"],
- "/stage/build/map/host.js": ["stage/build/map/host.js", "text/javascript; charset=utf-8"],
- "/stage/build/map/maplibre-gl.js": ["stage/build/map/maplibre-gl.js", "text/javascript; charset=utf-8"],
- "/stage/build/map/maplibre-gl.css": ["stage/build/map/maplibre-gl.css", "text/css; charset=utf-8"],
- "/stage/build/map/maplibre-gl-csp-worker.js": ["stage/build/map/maplibre-gl-csp-worker.js", "text/javascript; charset=utf-8"],
- "/stage/build/map/maplibre-LICENSE.txt": ["stage/build/map/maplibre-LICENSE.txt", "text/plain; charset=utf-8"],
-});
-
-// Electron 默认启用 allow-file-access-from-files;地图仅加载 HTTP(S) 文档,并由独立会话拒绝文件协议。
-// 该开关只影响文件来源文档,不应误判为此地图宿主的安全绕过。
-const unsafeMapSwitches = Object.freeze([
- "disable-web-security", "allow-running-insecure-content", "disable-site-isolation-for-policy",
- "disable-site-isolation-trials", "no-sandbox", "disable-setuid-sandbox", "disable-seccomp-filter-sandbox",
- "single-process", "allow-universal-access-from-files",
- "ignore-certificate-errors", "ignore-certificate-errors-spki-list", "ignore-ssl-errors",
- "ignore-ssl-errors-with-hosts", "allow-insecure-localhost",
-]);
-const unsafeDisabledFeatures = new Set(["isolateorigins", "site-per-process", "siteperprocess", "outofblinkcors"]);
-const hasUnsafeMapSwitches = (commandLine) => unsafeMapSwitches.some(name => commandLine.hasSwitch(name)) ||
- (commandLine.getSwitchValue("disable-features") || "").toLowerCase().split(",")
- .some(name => unsafeDisabledFeatures.has(name.trim().split(/[<:]/, 1)[0]));
-
-const isRecord = value => !!value && typeof value === "object" && !Array.isArray(value);
-const isMapInstanceID = value => typeof value === "string" && /^[a-f0-9]{48}$/.test(value);
-const isMapTheme = value => value === "light" || value === "dark";
-const isMapRevision = value => Number.isSafeInteger(value) && value >= 0;
-const isMapIdentifier = value => typeof value === "string" && /^[a-zA-Z0-9_-]{1,128}$/.test(value);
-const normalizeMapOrigin = value => {
- try {
- const url = new URL(value);
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.origin !== value) return;
- return url.origin;
- } catch (_error) {
- return;
- }
-};
-const sanitizeMapPoints = value => {
- if (!Array.isArray(value)) return [];
- const ids = new Set();
- const points = [];
- for (const point of value.slice(0, 10000)) {
- if (!isRecord(point) || "coordinateSystem" in point || !isMapIdentifier(point.id) || ids.has(point.id) ||
- !Number.isFinite(point.longitude) || Math.abs(point.longitude) > 180 ||
- !Number.isFinite(point.latitude) || Math.abs(point.latitude) > 85.0511287798066) continue;
- ids.add(point.id);
- points.push({id: point.id, longitude: point.longitude, latitude: point.latitude});
- }
- return points;
-};
-const parseMapCreate = value => {
- if (!isRecord(value) || value.version !== 1 || !isMapInstanceID(value.instanceID) ||
- value.provider !== "openfreemap" || !isMapTheme(value.theme) ||
- value.picking !== undefined && typeof value.picking !== "boolean") return;
- return {version: 1, instanceID: value.instanceID, type: "init", provider: "openfreemap", theme: value.theme,
- ...(value.picking === true && {picking: true})};
-};
-const parseMapCommand = (value, instanceID) => {
- if (!isRecord(value) || value.version !== 1 || value.instanceID !== instanceID) return;
- const base = {version: 1, instanceID};
- if (value.type === "visibility") {
- if (Object.keys(value).some(key => !["version", "instanceID", "type", "visible", "viewport"].includes(key)) ||
- typeof value.visible !== "boolean") return;
- if (!value.visible) return !Object.hasOwn(value, "viewport") ? {...base, type: "visibility", visible: false} : undefined;
- if (!Object.hasOwn(value, "viewport")) return {...base, type: "visibility", visible: true};
- const rect = value.viewport;
- if (!isRecord(rect) || Object.keys(rect).length !== 4 ||
- !["x", "y", "width", "height"].every(key => Object.hasOwn(rect, key) && Number.isFinite(rect[key]) && rect[key] >= 0 && rect[key] <= 32768) ||
- rect.width <= 0 || rect.height <= 0) return;
- return {...base, type: "visibility", visible: true, viewport: {x: rect.x, y: rect.y, width: rect.width, height: rect.height}};
- }
- if (value.type === "setPoints" && isMapRevision(value.revision) && Array.isArray(value.points)) {
- return {...base, type: value.type, revision: value.revision, points: sanitizeMapPoints(value.points)};
- }
- if (value.type === "theme" && isMapTheme(value.theme)) return {...base, type: value.type, theme: value.theme};
- if (["resize", "destroy"].includes(value.type)) return {...base, type: value.type};
-};
-const parseMapReply = (value, instanceID) => {
- if (!isRecord(value) || value.version !== 1 || value.instanceID !== instanceID) return;
- const base = {version: 1, instanceID};
- if (["ready", "bootstrapReady"].includes(value.type)) return {...base, type: value.type};
- if (value.type === "markerClick" && isMapIdentifier(value.id) && isMapRevision(value.revision)) {
- return {...base, type: value.type, id: value.id, revision: value.revision};
- }
- if (value.type === "pointClick" && isMapRevision(value.revision) && !("coordinateSystem" in value) &&
- Number.isFinite(value.longitude) && Math.abs(value.longitude) <= 180 &&
- Number.isFinite(value.latitude) && Math.abs(value.latitude) <= 85.0511287798066) {
- return {...base, type: value.type, revision: value.revision, longitude: value.longitude, latitude: value.latitude};
- }
- if (value.type === "attributionClick" && ["openfreemap", "openmaptiles", "openstreetmap", "maplibre"].includes(value.link)) {
- return {...base, type: value.type, link: value.link};
- }
- if (value.type === "error" && ["unsupportedEnvironment", "invalidConfiguration",
- "hostUnavailable", "sdkUnavailable", "mapUnavailable", "sdkScriptLoadFailed",
- "sdkGlobalMissing", "mapCreationFailed", "mapReadyTimeout", "hostLimitReached", "hostSetupFailed",
- "hostAttachFailed", "hostDocumentLoadFailed", "hostDocumentLoadTimeout", "hostDocumentReloaded",
- "hostDocumentMismatch", "hostRendererGone", "hostDestroyed", "hostPortSetupFailed", "hostPortClosed",
- "hostBootstrapFailed", "hostBootstrapTimeout", "hostSDKTimeout", "hostOperationFailed", "hostCreateRejected",
- "hostCreateInvalidResponse", "hostReadyTimeout", "hostOwnerSetupFailed"].includes(value.code)) {
- return {...base, type: "error", code: value.code};
- }
-};
-
-const isAllowedMapProviderURL = value => {
- try {
- const url = new URL(value);
- return url.protocol === "https:" && !url.username && !url.password &&
- !url.port && !url.hash && url.hostname === "tiles.openfreemap.org";
- } catch (_error) {
- return false;
- }
-};
-const getMapRequestPolicy = (value, method, origin) => {
- try {
- if (!["GET", "HEAD"].includes(method) || typeof value !== "string" || value.length > 16384) return;
- const url = new URL(value);
- if (url.username || url.password) return;
- if (url.origin === origin) {
- if (!Object.hasOwn(mapHostFiles, url.pathname)) return;
- if (url.pathname === "/stage/map/index.html") {
- if (url.search !== "?provider=openfreemap") return;
- } else if (url.search) return;
- return {type: "local", file: mapHostFiles[url.pathname], document: url.pathname === "/stage/map/index.html"};
- }
- if (isAllowedMapProviderURL(value)) return {type: "provider"};
- } catch (_error) {
- return;
- }
-};
-
-const createMapContentSecurityPolicy = origin => {
- if (!normalizeMapOrigin(origin)) throw new Error("Invalid map origin");
- const assets = origin + "/stage/build/map/";
- const scripts = assets + "host.js " + assets + "maplibre-gl.js";
- const connect = "https://tiles.openfreemap.org " + assets + "maplibre-gl-csp-worker.js";
- const images = "data: blob: https://tiles.openfreemap.org";
- const styles = "'unsafe-inline' " + origin + "/stage/map/host.css " + assets + "maplibre-gl.css";
- return "default-src 'none'; sandbox allow-scripts; script-src " + scripts + "; connect-src " + connect +
- "; img-src " + images + "; style-src " + styles + "; font-src 'none'; worker-src blob:" +
- "; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
-};
-
-module.exports = {mapHostFiles, unsafeMapSwitches, hasUnsafeMapSwitches, normalizeMapOrigin,
- isMapInstanceID, parseMapCreate, parseMapCommand, parseMapReply,
- isAllowedMapProviderURL, getMapRequestPolicy, createMapContentSecurityPolicy};
diff --git a/app/electron/mapHostPolicy.test.js b/app/electron/mapHostPolicy.test.js
deleted file mode 100644
index 898a529701..0000000000
--- a/app/electron/mapHostPolicy.test.js
+++ /dev/null
@@ -1,206 +0,0 @@
-const assert = require("node:assert/strict");
-const {test} = require("node:test");
-const {
- mapHostFiles, unsafeMapSwitches, hasUnsafeMapSwitches, normalizeMapOrigin, parseMapCreate, parseMapCommand,
- parseMapReply, isAllowedMapProviderURL, getMapRequestPolicy, createMapContentSecurityPolicy,
-} = require("./mapHostPolicy");
-
-const instanceID = "a".repeat(48);
-const origin = "http://127.0.0.1:6806";
-const envelope = {version: 1, instanceID};
-
-test("map origin accepts only the exact registered HTTP(S) origin", () => {
- assert.equal(normalizeMapOrigin(origin), origin);
- for (const invalid of [origin + "/", origin + "/api", "file:///tmp", "https://user:[email protected]", "null", undefined]) {
- assert.equal(normalizeMapOrigin(invalid), undefined);
- }
-});
-
-test("only fixed local assets are available; another kernel, APIs, methods and path aliases are denied", () => {
- for (const file of Object.keys(mapHostFiles)) {
- const query = file.endsWith("index.html") ? "?provider=openfreemap" : "";
- assert.equal(getMapRequestPolicy(origin + file + query, "GET", origin).type, "local");
- }
- for (const url of [origin + "/api/system/getConf", origin + "/stage/build/app/index.js", origin + "/stage/map/",
- origin + "/stage/map/index.html?provider=amap", origin + "/stage/map/index.html?provider=openfreemap&extra=1",
- origin + "/stage/map/%69ndex.html?provider=openfreemap", origin + "/stage/map/host.css?api=1",
- "http://127.0.0.1:6807/stage/map/host.css", "file:///etc/passwd", "https://evil.example/", "ws://127.0.0.1:6806/ws"]) {
- assert.equal(getMapRequestPolicy(url, "GET", origin), undefined, url);
- }
- assert.equal(getMapRequestPolicy(origin + "/stage/map/host.css", "POST", origin), undefined);
-});
-
-test("provider routing rejects other providers, insecure schemes, ports, credentials and suffix tricks", () => {
- assert.equal(isAllowedMapProviderURL("https://tiles.openfreemap.org/planet/a"), true);
- for (const url of ["http://tiles.openfreemap.org/a", "https://tiles.openfreemap.org:444/a",
- "https://key:[email protected]/a", "https://tiles.openfreemap.org.evil.example/a",
- "https://eviltiles.openfreemap.org/a", "https://tiles.openfreemap.org./a", "https://tiles.openfreemap.org/a#fragment",
- "https://webapi.amap.com/maps", "https://webrd01.is.autonavi.com/a", "https://map.qq.com/",
- "https://api.map.baidu.com/", "https://127.0.0.1/api", "data:text/plain,a", "file:///tmp/a"]) {
- assert.equal(isAllowedMapProviderURL(url), false, url);
- }
-});
-
-test("only OpenFreeMap initializes and credentials, metadata and commands cannot cross the whitelist", () => {
- const init = parseMapCreate({...envelope, provider: "openfreemap", theme: "dark", credentials: {
- apiKey: " key ", securityCode: " code ", userToken: "never", url: origin,
- }, executeJavaScript: "never"});
- assert.deepEqual(init, {...envelope, type: "init", provider: "openfreemap", theme: "dark"});
- for (const provider of ["amap", "tencent", "baidu", "evil", "__proto__", undefined]) {
- assert.equal(parseMapCreate({...envelope, provider, theme: "light"}), undefined);
- }
- const point = {id: "row-1", longitude: 120, latitude: 30, title: "private", content: "private"};
- const command = parseMapCommand({...envelope, type: "setPoints", revision: 1, points: [point, point,
- {...point, id: "bad-lat", latitude: 90}, {...point, id: "bad-lon", longitude: 181}]}, instanceID);
- assert.deepEqual(command.points, [{id: "row-1", longitude: 120, latitude: 30}]);
- assert.equal(parseMapCommand({...envelope, type: "init"}, instanceID), undefined);
- assert.equal(parseMapCommand({...envelope, type: "navigate", url: "https://example.com"}, instanceID), undefined);
- assert.equal(parseMapCommand({...envelope, type: "setPoints", revision: -1, points: []}, instanceID), undefined);
- assert.equal(parseMapReply({...envelope, type: "error", code: "readFile"}, instanceID), undefined);
- assert.deepEqual(parseMapReply({...envelope, type: "bootstrapReady", url: "bad"}, instanceID), {...envelope, type: "bootstrapReady"});
-});
-
-test("obsolete coordinate-system point messages are rejected rather than reinterpreted", () => {
- for (const coordinateSystem of ["wgs84", "gcj02", "bd09", "unknown", "", undefined]) {
- const points = [{id: "row", longitude: 120, latitude: 30, coordinateSystem}];
- assert.deepEqual(parseMapCommand({...envelope, type: "setPoints", revision: 0, points}, instanceID).points, []);
- }
-});
-
-test("map visibility accepts only its exact envelope and copies a bounded viewport", () => {
- for (const visible of [true, false]) {
- const value = {...envelope, type: "visibility", visible};
- assert.deepEqual(parseMapCommand(value, instanceID), value);
- }
- for (const viewport of [{x: 0, y: 0, width: 1, height: 1},
- {x: 32768, y: 32768, width: 32768, height: 32768},
- {x: 10.25, y: 20.5, width: 0.25, height: 0.5}]) {
- const value = {...envelope, type: "visibility", visible: true, viewport};
- const command = parseMapCommand(value, instanceID);
- assert.deepEqual(command, value);
- assert.notEqual(command, value);
- assert.notEqual(command.viewport, viewport);
- }
-});
-
-test("map visibility rejects foreign envelopes, extra fields and non-boolean visibility", () => {
- const value = {...envelope, type: "visibility", visible: true};
- for (const visible of [undefined, null, 0, 1, "true", "false", {}, []]) {
- assert.equal(parseMapCommand({...value, visible}, instanceID), undefined);
- }
- for (const extra of [{url: origin}, {executeJavaScript: "never"}, {bounds: {}}, {visibleToOwner: true},
- {privateData: undefined}]) {
- assert.equal(parseMapCommand({...value, ...extra}, instanceID), undefined);
- }
- assert.equal(parseMapCommand({...value, version: 2}, instanceID), undefined);
- assert.equal(parseMapCommand(value, "b".repeat(48)), undefined);
- const missingVisibility = {...value};
- delete missingVisibility.visible;
- assert.equal(parseMapCommand(missingVisibility, instanceID), undefined);
-});
-
-test("map visibility rejects malformed viewport values and fields instead of discarding them", () => {
- const value = {...envelope, type: "visibility", visible: true};
- const viewport = {x: 0, y: 0, width: 200, height: 100};
- for (const invalid of [null, undefined, [], "viewport", 1, {}, {...viewport, extra: true},
- {...viewport, crop: undefined}]) {
- assert.equal(parseMapCommand({...value, viewport: invalid}, instanceID), undefined);
- }
- for (const key of ["x", "y", "width", "height"]) {
- const incomplete = {...viewport};
- delete incomplete[key];
- assert.equal(parseMapCommand({...value, viewport: incomplete}, instanceID), undefined, key);
- for (const number of [undefined, null, NaN, Infinity, -Infinity, -1, 32769, "1", true]) {
- assert.equal(parseMapCommand({...value, viewport: {...viewport, [key]: number}}, instanceID), undefined,
- key + ": " + String(number));
- }
- }
- for (const key of ["width", "height"]) {
- assert.equal(parseMapCommand({...value, viewport: {...viewport, [key]: 0}}, instanceID), undefined, key);
- }
- for (const hiddenViewport of [viewport, null, undefined]) {
- assert.equal(parseMapCommand({...value, visible: false, viewport: hiddenViewport}, instanceID), undefined);
- }
-});
-
-test("guest replies cannot dismiss the owner's menu", () => {
- for (const extra of [{}, {id: "row-1", revision: 1}, {trusted: true}, {visible: false}]) {
- assert.equal(parseMapReply({...envelope, type: "dismissMenu", ...extra}, instanceID), undefined);
- }
-});
-
-test("WGS84 points keep finite world bounds, the Mercator latitude limit and the point count limit", () => {
- const points = Array.from({length: 10010}, (_, index) => ({id: "row-" + index, longitude: 10, latitude: 20}));
- assert.equal(parseMapCommand({...envelope, type: "setPoints", revision: 0, points}, instanceID).points.length, 10000);
- const limit = 85.0511287798066;
- const bounds = [{id: "west", longitude: -180, latitude: -limit}, {id: "east", longitude: 180, latitude: limit}];
- for (const [longitude, latitude] of [[-181, 0], [181, 0], [0, -limit - 1e-10], [0, limit + 1e-10],
- [0, -90], [0, 90], [NaN, 0], [0, NaN], [Infinity, 0], [0, -Infinity], ["10", 20]]) {
- bounds.push({id: "invalid-" + bounds.length, longitude, latitude});
- }
- assert.deepEqual(parseMapCommand({...envelope, type: "setPoints", revision: 0, points: bounds}, instanceID).points,
- bounds.slice(0, 2));
-});
-
-test("map loading failures retain only fixed stage codes across the desktop boundary", () => {
- for (const code of ["sdkScriptLoadFailed", "sdkGlobalMissing", "mapCreationFailed", "mapReadyTimeout"]) {
- assert.deepEqual(parseMapReply({...envelope, type: "error", code, message: "https://private.invalid/?key=secret",
- stack: "secret"}, instanceID), {...envelope, type: "error", code});
- }
- assert.equal(parseMapReply({...envelope, type: "error", code: "https://private.invalid/?key=secret"}, instanceID), undefined);
-});
-
-test("host failure replies preserve fixed reasons and reject invented or foreign failure codes", () => {
- for (const code of ["hostLimitReached", "hostSetupFailed", "hostAttachFailed", "hostDocumentLoadFailed",
- "hostDocumentLoadTimeout", "hostDocumentReloaded", "hostDocumentMismatch", "hostRendererGone", "hostDestroyed",
- "hostPortSetupFailed", "hostPortClosed", "hostBootstrapFailed", "hostBootstrapTimeout", "hostSDKTimeout",
- "hostOperationFailed", "hostCreateRejected", "hostCreateInvalidResponse", "hostReadyTimeout", "hostOwnerSetupFailed"]) {
- const reply = {...envelope, type: "error", code};
- assert.deepEqual(parseMapReply({...reply, error: "private", url: "https://private.invalid/?key=secret"}, instanceID), reply);
- assert.equal(parseMapReply(reply, "other"), undefined);
- assert.equal(parseMapReply({...reply, version: 2}, instanceID), undefined);
- }
- for (const code of ["missingCredentials", "sdkCallbackTimeout", "hostSecret", "hostLimitReached\nprivate",
- "https://private.invalid/?key=secret", null, {}]) {
- assert.equal(parseMapReply({...envelope, type: "error", code}, instanceID), undefined);
- }
-});
-
-test("map creation fails closed for effective process security bypasses", () => {
- const commandLine = switches => ({hasSwitch: name => switches.has(name), getSwitchValue: name => switches.get(name)});
- assert.equal(hasUnsafeMapSwitches(commandLine(new Map())), false);
- assert.equal(hasUnsafeMapSwitches(commandLine(new Map([["allow-file-access-from-files", ""]]))), false);
- for (const name of unsafeMapSwitches) assert.equal(hasUnsafeMapSwitches(commandLine(new Map([[name, ""]]))), true, name);
- for (const value of ["IsolateOrigins", "Other, SitePerProcess", "OutOfBlinkCors:trial", "SitePerProcess<Experiment"]) {
- assert.equal(hasUnsafeMapSwitches(commandLine(new Map([["disable-features", value]]))), true);
- }
- assert.equal(hasUnsafeMapSwitches(commandLine(new Map([["disable-features", "AutoupgradeMixedContent"]]))), false);
-});
-
-test("bootstrap CSP has sandbox isolation and only fixed local assets plus OpenFreeMap", () => {
- const csp = createMapContentSecurityPolicy(origin);
- assert.match(csp, /sandbox allow-scripts;/);
- assert.match(csp, /frame-src 'none'/);
- assert.match(csp, /form-action 'none'/);
- assert.match(csp, /frame-ancestors 'none'/);
- assert.ok(!csp.includes("allow-same-origin"));
- assert.ok(!csp.includes("unsafe-eval"));
- assert.doesNotMatch(csp, /amap|autonavi|qq\.com|baidu|bdimg|alicdn|taobao/);
- assert.throws(() => createMapContentSecurityPolicy("http://example.com/a"));
-});
-
-test("OpenFreeMap CSP scopes bundled scripts, worker, styles and tile requests to their exact sources", () => {
- const csp = createMapContentSecurityPolicy(origin);
- const directives = Object.fromEntries(csp.split(";").filter(value => value.trim()).map(value => {
- const [name, ...sources] = value.trim().split(/\s+/);
- return [name, sources];
- }));
- assert.deepEqual(directives["script-src"], [origin + "/stage/build/map/host.js", origin + "/stage/build/map/maplibre-gl.js"]);
- assert.deepEqual(directives["worker-src"], ["blob:"]);
- assert.deepEqual(directives["connect-src"], ["https://tiles.openfreemap.org", origin + "/stage/build/map/maplibre-gl-csp-worker.js"]);
- assert.deepEqual(directives["img-src"], ["data:", "blob:", "https://tiles.openfreemap.org"]);
- assert.deepEqual(directives["style-src"], ["'unsafe-inline'", origin + "/stage/map/host.css", origin + "/stage/build/map/maplibre-gl.css"]);
- assert.deepEqual(directives["frame-src"], ["'none'"]);
- assert.deepEqual(directives.sandbox, ["allow-scripts"]);
- assert.equal(getMapRequestPolicy("https://tiles.openfreemap.org/resource", "GET", origin).type, "provider");
-});
diff --git a/app/electron/mapHostPreload.js b/app/electron/mapHostPreload.js
deleted file mode 100644
index 16b5dcf4a1..0000000000
--- a/app/electron/mapHostPreload.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-const {contextBridge, ipcRenderer} = require("electron");
-
-// 预载脚本不暴露 IPC 方法、Node 对象、文件路径或导航能力。
-if (process.isMainFrame) {
- contextBridge.exposeInMainWorld("siyuanMapDesktop", Object.freeze({version: 1}));
- ipcRenderer.once("siyuan-map-port", (event, data) => {
- if (data?.version !== 1 || !/^[a-f0-9]{48}$/.test(data.instanceID || "") ||
- !/^[a-f0-9]{48}$/.test(data.nonce || "") || event.ports.length !== 1 ||
- data.provider !== "openfreemap") {
- event.ports.forEach(port => port.close());
- return;
- }
- window.postMessage({type: "siyuan-map-desktop-connect", version: 1, instanceID: data.instanceID,
- nonce: data.nonce, provider: data.provider}, "*", [event.ports[0]]);
- });
-}
diff --git a/app/electron/mapHostPreload.test.js b/app/electron/mapHostPreload.test.js
deleted file mode 100644
index eed02dcd71..0000000000
--- a/app/electron/mapHostPreload.test.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const assert = require("node:assert/strict");
-const {test} = require("node:test");
-const fs = require("node:fs");
-const path = require("node:path");
-const vm = require("node:vm");
-
-const setup = (isMainFrame = true) => {
- const listeners = {}, exposed = {}, posted = [], map = {style: {}};
- vm.runInNewContext(fs.readFileSync(path.join(__dirname, "mapHostPreload.js"), "utf8"), {
- require: name => {
- assert.equal(name, "electron");
- return {contextBridge: {exposeInMainWorld: (name, value) => { exposed[name] = value; }}, ipcRenderer: {
- once: (name, listener) => { listeners[name] = (...args) => { delete listeners[name]; listener(...args); }; },
- on: (name, listener) => { listeners[name] = listener; },
- }};
- },
- process: {isMainFrame}, window: {postMessage: (...args) => posted.push(args)}, document: {getElementById: () => map},
- });
- return {listeners, exposed, posted, map};
-};
-
-test("sandbox preload exposes only a frozen version capability and one transferred map port", () => {
- const s = setup();
- assert.deepEqual(Object.keys(s.exposed), ["siyuanMapDesktop"]);
- assert.deepEqual(Object.keys(s.exposed.siyuanMapDesktop), ["version"]);
- assert.equal(Object.isFrozen(s.exposed.siyuanMapDesktop), true);
- const data = {version: 1, instanceID: "a".repeat(48), nonce: "b".repeat(48), provider: "openfreemap", secret: "never"};
- const port = {};
- s.listeners["siyuan-map-port"]({ports: [port]}, data);
- assert.equal(s.listeners["siyuan-map-port"], undefined);
- assert.equal(s.posted[0][0].type, "siyuan-map-desktop-connect");
- assert.equal(s.posted[0][0].secret, undefined);
- assert.equal(s.posted[0][2][0], port);
-});
-
-test("invalid port metadata closes the port and subframes receive no capability", () => {
- const s = setup(); let closed = false;
- s.listeners["siyuan-map-port"]({ports: [{close() { closed = true; }}]}, {version: 2});
- assert.equal(closed, true); assert.equal(s.posted.length, 0);
- const subframe = setup(false);
- assert.deepEqual(subframe.exposed, {}); assert.deepEqual(subframe.listeners, {});
-});
-
-test("the transferred map port only admits the fixed OpenFreeMap provider", () => {
- for (const provider of ["amap", "tencent", "baidu", "__proto__", undefined]) {
- const s = setup(); let closed = false;
- s.listeners["siyuan-map-port"]({ports: [{close() { closed = true; }}]}, {
- version: 1, instanceID: "a".repeat(48), nonce: "b".repeat(48), provider,
- });
- assert.equal(closed, true);
- assert.equal(s.posted.length, 0);
- }
-});
diff --git a/app/electron/mapOwnerRegistration.test.js b/app/electron/mapOwnerRegistration.test.js
deleted file mode 100644
index 86e220dfde..0000000000
--- a/app/electron/mapOwnerRegistration.test.js
+++ /dev/null
@@ -1,39 +0,0 @@
-const assert = require("node:assert/strict");
-const {EventEmitter} = require("node:events");
-const {readFileSync} = require("node:fs");
-const {join} = require("node:path");
-const {test} = require("node:test");
-const {runInNewContext} = require("node:vm");
-const {shouldBlockRemoteFrameNavigation} = require("./remoteKernel");
-
-test("window target registration installs the map guard before remote document events and retains subframe denial", () => {
- const source = readFileSync(join(__dirname, "main.js"), "utf8");
- const start = source.indexOf("const rememberWindowKernelTarget =");
- const end = source.indexOf("\nconst getWindowKernelTarget", start);
- const targets = new Map(), initialized = new Set([42]), registered = [];
- const scope = {
- windowKernelTargets: targets, initializedWindowIds: initialized,
- blockDragWindowFocusOrder: new Map(), blockDragWindowFocusSequence: 0,
- mapHostManager: {registerOwner(contents) {
- assert.equal(targets.get(contents.id)?.mode, "remote");
- assert.equal(contents.eventNames().length, 0);
- registered.push(contents);
- }},
- shouldBlockRemoteFrameNavigation, writeLog() {}, cleanupBlockDragSessions() {}, cleanupBlockDragWindow() {},
- };
- const register = runInNewContext(source.slice(start, end) + "\nrememberWindowKernelTarget;", scope);
- const owner = Object.assign(new EventEmitter(), {id: 42});
- const win = Object.assign(new EventEmitter(), {webContents: owner});
- register(win, {mode: "remote", origin: "https://example.invalid"});
- assert.deepEqual(registered, [owner]);
- let blocked = 0;
- owner.emit("will-frame-navigate", {isMainFrame: false, preventDefault() { blocked++; }});
- owner.emit("will-frame-navigate", {isMainFrame: true, preventDefault() { blocked++; }});
- assert.equal(blocked, 1);
- owner.emit("did-start-navigation", {isMainFrame: true, isSameDocument: false});
- assert.equal(initialized.has(42), false);
- owner.emit("destroyed");
- assert.equal(targets.has(42), false);
- assert.match(source, /mapHostManager = createMapHostManager/);
- assert.equal((source.match(/webSecurity: kernelTarget\.mode === "remote"/g) || []).length, 2);
-});
diff --git a/app/electron/mapWebviewHost.js b/app/electron/mapWebviewHost.js
deleted file mode 100644
index 81272b1b3a..0000000000
--- a/app/electron/mapWebviewHost.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-const path = require("node:path");
-
-const MAP_WEBVIEW_PREFERENCES = Object.freeze({sandbox: true, contextIsolation: true, webSecurity: true,
- nodeIntegration: false, nodeIntegrationInSubFrames: false, nodeIntegrationInWorker: false,
- webviewTag: false, allowRunningInsecureContent: false, plugins: false, experimentalFeatures: false,
- navigateOnDragDrop: false, disablePopups: true, safeDialogs: true, disableDialogs: true, devTools: false,
- spellcheck: false, backgroundThrottling: false, autoplayPolicy: "user-gesture-required"});
-
-const hardenMapWebviewPreferences = (preferences, session, partition) => {
- for (const name of Object.keys(preferences)) delete preferences[name];
- Object.assign(preferences, MAP_WEBVIEW_PREFERENCES, {session, partition,
- preload: path.join(__dirname, "mapHostPreload.js")});
-};
-
-const isMapWebviewAttachment = (params, host) => !!params && params.src === host.entryURL &&
- params.partition === host.partition && !["preload", "webpreferences", "nodeintegration", "nodeintegrationinsubframes",
- "disablewebsecurity", "allowpopups", "plugins", "blinkfeatures", "disableblinkfeatures", "useragent", "httpreferrer"]
- .some(name => !!params[name]);
-
-// Electron 44 的回读只包括安全偏好子集,不包括 preload、partition 等构造参数。
-const reportedPreferences = ["sandbox", "contextIsolation", "webSecurity", "nodeIntegration",
- "nodeIntegrationInSubFrames", "nodeIntegrationInWorker", "webviewTag", "allowRunningInsecureContent",
- "experimentalFeatures", "disablePopups", "safeDialogs", "disableDialogs"];
-const getMapWebviewPreferenceMismatch = actual => reportedPreferences.find(name => actual?.[name] !== MAP_WEBVIEW_PREFERENCES[name]);
-
-module.exports = {MAP_WEBVIEW_PREFERENCES, hardenMapWebviewPreferences, isMapWebviewAttachment, getMapWebviewPreferenceMismatch};
diff --git a/app/electron/mapWebviewHost.test.js b/app/electron/mapWebviewHost.test.js
deleted file mode 100644
index bdb55a1ce6..0000000000
--- a/app/electron/mapWebviewHost.test.js
+++ /dev/null
@@ -1,106 +0,0 @@
-const assert = require("node:assert/strict");
-const path = require("node:path");
-const {test} = require("node:test");
-const {
- MAP_WEBVIEW_PREFERENCES, hardenMapWebviewPreferences, isMapWebviewAttachment, getMapWebviewPreferenceMismatch,
-} = require("./mapWebviewHost");
-
-const host = {
- entryURL: "http://127.0.0.1:6806/stage/map/index.html?provider=openfreemap",
- partition: "siyuan-map-" + "a".repeat(48),
-};
-const reportedPreferences = {
- sandbox: true,
- contextIsolation: true,
- webSecurity: true,
- nodeIntegration: false,
- nodeIntegrationInSubFrames: false,
- nodeIntegrationInWorker: false,
- webviewTag: false,
- allowRunningInsecureContent: false,
- experimentalFeatures: false,
- disablePopups: true,
- safeDialogs: true,
- disableDialogs: true,
-};
-
-test("map webview preferences require sandbox isolation and disable privileged guest features", () => {
- assert.ok(Object.isFrozen(MAP_WEBVIEW_PREFERENCES));
- for (const [key, value] of Object.entries(reportedPreferences)) {
- assert.equal(MAP_WEBVIEW_PREFERENCES[key], value, key);
- }
- for (const key of ["plugins", "navigateOnDragDrop", "devTools", "spellcheck", "backgroundThrottling"]) {
- assert.equal(MAP_WEBVIEW_PREFERENCES[key], false, key);
- }
- assert.equal(MAP_WEBVIEW_PREFERENCES.autoplayPolicy, "user-gesture-required");
-});
-
-test("map webview hardening removes renderer preferences and forces the registered session and preload", () => {
- const session = {name: "isolated-map-session"};
- const preferences = {
- ...Object.fromEntries(Object.entries(MAP_WEBVIEW_PREFERENCES).map(([key, value]) => [key, !value])),
- session: {name: "default-session"},
- partition: "persist:private",
- preload: "/tmp/renderer-controlled-preload.js",
- preloadURL: "file:///tmp/renderer-controlled-preload.js",
- additionalArguments: ["--disable-web-security"],
- enableBlinkFeatures: "UnsafeFeature",
- disableBlinkFeatures: "SafeFeature",
- rendererControlled: true,
- };
- hardenMapWebviewPreferences(preferences, session, host.partition);
- assert.deepEqual(preferences, {...MAP_WEBVIEW_PREFERENCES, session, partition: host.partition,
- preload: path.join(__dirname, "mapHostPreload.js")});
- assert.equal(preferences.session, session);
-});
-
-test("map webview attachment requires the exact registered entry URL and in-memory partition", () => {
- const params = {src: host.entryURL, partition: host.partition};
- assert.equal(isMapWebviewAttachment(params, host), true);
- for (const invalid of [undefined, null, {}, []]) {
- assert.equal(isMapWebviewAttachment(invalid, host), false);
- }
- for (const src of [undefined, "", host.entryURL + "#fragment", host.entryURL + "&extra=1",
- host.entryURL.replace("index.html", "%69ndex.html"),
- host.entryURL.replace("/stage/map/", "/stage/map/../map/"),
- host.entryURL.replace("6806", "6807"), "https://tiles.openfreemap.org/", "file:///tmp/map.html"]) {
- assert.equal(isMapWebviewAttachment({...params, src}, host), false, String(src));
- }
- for (const partition of [undefined, "", "persist:" + host.partition, "siyuan-map-" + "b".repeat(48)]) {
- assert.equal(isMapWebviewAttachment({...params, partition}, host), false, String(partition));
- }
-});
-
-test("map webview read-back requires every reported security preference to retain its exact value", () => {
- for (const [key, value] of Object.entries(reportedPreferences)) {
- const missing = {...reportedPreferences};
- delete missing[key];
- assert.equal(getMapWebviewPreferenceMismatch(missing), key, key + " missing");
- for (const changed of [!value, String(value), undefined, null]) {
- assert.equal(getMapWebviewPreferenceMismatch({...reportedPreferences, [key]: changed}), key,
- key + ": " + String(changed));
- }
- }
- for (const invalid of [undefined, null, {}, []]) {
- assert.ok(getMapWebviewPreferenceMismatch(invalid));
- }
-});
-
-test("map webview read-back does not require constructor-only or unreported default preferences", () => {
- assert.equal(getMapWebviewPreferenceMismatch({...reportedPreferences}), undefined);
- assert.equal(getMapWebviewPreferenceMismatch({...reportedPreferences,
- defaultFontFamily: {standard: "Times New Roman"}, javascript: true, images: true}), undefined);
-});
-
-test("map webview attachment rejects guest-supplied privilege and navigation attributes", () => {
- const params = {src: host.entryURL, partition: host.partition};
- for (const key of ["preload", "webpreferences", "nodeintegration", "nodeintegrationinsubframes", "disablewebsecurity",
- "allowpopups", "plugins", "blinkfeatures", "disableblinkfeatures", "useragent", "httpreferrer"]) {
- for (const value of [true, "true", "false", "file:///tmp/guest.js", 1]) {
- assert.equal(isMapWebviewAttachment({...params, [key]: value}, host), false, key + ": " + value);
- }
- for (const value of [undefined, false, "", 0]) {
- assert.equal(isMapWebviewAttachment({...params, [key]: value}, host), true, key + ": " + String(value));
- }
- }
-});
diff --git a/app/electron/remoteWebviewBoundary.test.js b/app/electron/remoteWebviewBoundary.test.js
new file mode 100644
index 0000000000..21e4d2b833
--- /dev/null
+++ b/app/electron/remoteWebviewBoundary.test.js
@@ -0,0 +1,67 @@
+const assert = require("node:assert/strict");
+const {EventEmitter} = require("node:events");
+const {readFileSync} = require("node:fs");
+const {join} = require("node:path");
+const {test} = require("node:test");
+const {runInNewContext} = require("node:vm");
+const {shouldBlockRemoteFrameNavigation} = require("./remoteKernel");
+
+const source = readFileSync(join(__dirname, "main.js"), "utf8");
+
+test("remote windows reject guests while local plugin guests keep their original attachment capabilities", () => {
+ const start = source.indexOf("const rememberWindowKernelTarget =");
+ const end = source.indexOf("\nconst getWindowKernelTarget", start);
+ assert.ok(start > 0 && end > start);
+ assert.doesNotMatch(source, /mapHostManager|createMapHostManager|MessageChannelMain/);
+ for (const mode of ["local", "remote"]) {
+ const targets = new Map(), initialized = new Set([42]);
+ const scope = {
+ windowKernelTargets: targets, initializedWindowIds: initialized,
+ blockDragWindowFocusOrder: new Map(), blockDragWindowFocusSequence: 0,
+ shouldBlockRemoteFrameNavigation, writeLog() {}, cleanupBlockDragSessions() {}, cleanupBlockDragWindow() {},
+ };
+ const register = runInNewContext(source.slice(start, end) + "\nrememberWindowKernelTarget;", scope);
+ const contents = Object.assign(new EventEmitter(), {id: 42});
+ const win = Object.assign(new EventEmitter(), {webContents: contents});
+ const target = {mode, origin: "https://example.invalid"};
+ register(win, target);
+ assert.equal(targets.get(contents.id), target);
+ let blocked = 0;
+ const guestPreferences = {nodeIntegration: true, preload: "/plugin/preload.js"};
+ contents.emit("will-attach-webview", {preventDefault() { blocked++; }}, guestPreferences, {src: "https://plugin.invalid"});
+ assert.equal(blocked, mode === "remote" ? 1 : 0);
+ assert.deepEqual(guestPreferences, {nodeIntegration: true, preload: "/plugin/preload.js"});
+ assert.equal(contents.listenerCount("will-attach-webview"), mode === "remote" ? 1 : 0);
+ contents.emit("will-frame-navigate", {isMainFrame: false, preventDefault() { blocked++; }});
+ contents.emit("will-frame-navigate", {isMainFrame: true, preventDefault() { blocked++; }});
+ assert.equal(blocked, mode === "remote" ? 2 : 0);
+ contents.emit("did-start-navigation", {isMainFrame: true, isSameDocument: false});
+ assert.equal(initialized.has(42), false);
+ contents.emit("destroyed");
+ assert.equal(targets.has(42), false);
+ }
+});
+
+test("main and detached windows enable local webviews and disable remote webviews", () => {
+ const windowStarts = [source.indexOf("const currentWindow = new BrowserWindow({"),
+ source.indexOf("const win = new BrowserWindow({", source.indexOf('ipcMain.on("siyuan-open-window"'))];
+ for (const start of windowStarts) {
+ assert.ok(start > 0);
+ const preferencesStart = source.indexOf("webPreferences: {", start) + "webPreferences: ".length;
+ const preferencesEnd = source.indexOf("\n", source.indexOf("autoplayPolicy:", preferencesStart));
+ const expression = "(" + source.slice(preferencesStart, preferencesEnd) + "\n})";
+ for (const mode of ["local", "remote"]) {
+ const remoteSession = {};
+ const preferences = runInNewContext(expression, {
+ kernelTarget: {mode}, getRemoteSession: () => remoteSession,
+ });
+ assert.equal(preferences.webviewTag, mode === "local");
+ assert.equal(preferences.webSecurity, mode === "remote");
+ assert.equal(preferences.nodeIntegration, true);
+ assert.equal(preferences.nodeIntegrationInSubFrames, false);
+ assert.equal(preferences.nodeIntegrationInWorker, false);
+ assert.equal(preferences.contextIsolation, false);
+ assert.equal(preferences.session, mode === "remote" ? remoteSession : undefined);
+ }
+ }
+});
diff --git a/app/electron/webviewDevTools.test.js b/app/electron/webviewDevTools.test.js
index c4af59047e..9b455f52eb 100644
--- a/app/electron/webviewDevTools.test.js
+++ b/app/electron/webviewDevTools.test.js
@@ -87,13 +87,13 @@ test("macOS Option-modified characters still match the physical I key", () => {
assert.equal(host.toggled, 1);
});
-test("map and plugin guests route to their own main, detached or settings window", () => {
+test("plugin guests route to their own main, detached or settings window", () => {
const hosts = [1, 2, 3].map(id => createContents(id));
const targets = new Map(hosts.map(host => [host.id, {mode: "local"}]));
for (const mode of ["local", "remote"]) {
for (const host of hosts) {
targets.set(host.id, {mode});
- for (const partition of ["siyuan-map-test", "plugin-test"]) {
+ for (const partition of ["plugin-test", "persist:plugin-test"]) {
const guest = createContents(10 + host.id, "webview");
guest.hostWebContents = host;
guest.partition = partition;
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
index 74d3a0f119..c2dab79d03 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
@@ -7,7 +7,7 @@
"id": "20240208172514-9dsv6na",
"title": "Database",
"type": "doc",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -74,7 +74,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009034010-6kd9rk5",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -102,30 +102,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009034010-h9vridq",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Enter longitude and latitude in their separate fields, for example longitude 116.4074 and latitude 39.9042. Or click "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "Pick on map"
- },
- {
- "Type": "NodeText",
- "Data": " to open the embedded map in the location editor. Clicking the map fills the draft coordinates; click "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "Save"
- },
- {
- "Type": "NodeText",
- "Data": " to apply them. Source text stays unchanged when you only edit the name. Changing the coordinates manually or by picking on the map clears that source text. If the map is unavailable, you can still enter coordinates manually."
+ "Data": "Enter longitude and latitude in their separate fields, for example longitude 116.4074 and latitude 39.9042. Source text stays unchanged when you only edit the name. Changing the coordinates clears that source text."
}
]
},
@@ -3987,123 +3969,6 @@
}
]
},
- {
- "ID": "20261009050034-byowtq3",
- "Type": "NodeHeading",
- "HeadingLevel": 2,
- "Properties": {
- "id": "20261009050034-byowtq3",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "Map view"
- }
- ]
- },
- {
- "ID": "20261009050034-yqulacv",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-yqulacv",
- "updated": "20261010233500"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "The map uses built-in OpenFreeMap. When no Location field is selected, the first Location field in the view is used; you can change it in the view settings. In an editable view, use the Unplaced records button to the right of the summary to browse records without coordinates in that field under the current filters and search, including records with only a place name. The list supports search and loading more records in batches. Click a record to open and edit it. Switch to a Table view to browse all records. In the view settings, Height offers Small (320 px), Medium (480 px), Large (640 px), and Extra large (800 px), with Medium as the default. The height is saved separately for each view and adapts to small screens."
- }
- ]
- },
- {
- "ID": "20261009050034-2ja6x7k",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-2ja6x7k",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "OpenFreeMap requires no API key or global service configuration. Keep the map's provider and data attribution visible."
- }
- ]
- },
- {
- "ID": "20261009050034-w0l8ys9",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-w0l8ys9",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "The map displays WGS84 coordinates without conversion. OpenFreeMap uses Web Mercator: latitudes beyond ±85.0511287798066° are valid stored coordinates but are skipped with an unsupported-projection count rather than silently clamped."
- }
- ]
- },
- {
- "ID": "20261009050034-kpnifml",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-kpnifml",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "Filters and sorting also apply to the map. Markers represent only the loaded records, not the entire database. The displayed counts identify the loaded scope and skipped locations. If there are too many markers, use filters or a smaller page size. Click a marker to open its record. Click an empty area of the map to show a popup with the selected WGS84 coordinates. Use "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "Copy"
- },
- {
- "Type": "NodeText",
- "Data": " to copy them, or in an editable view choose "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "Create record here"
- },
- {
- "Type": "NodeText",
- "Data": " to create a record with that point in the view's selected Location field. Clicking the map alone does not change any record."
- }
- ]
- },
- {
- "ID": "20261009050034-x0kdedj",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-x0kdedj",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "Maps require an external network connection. The isolated map page receives coordinates and opaque record IDs, but no record titles or full contents. Published pages do not load a live map, and document exports retain a table of records."
- }
- ]
- },
- {
- "ID": "20261009050034-wflckkb",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-wflckkb",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "The host follows the app theme; the basemap keeps its default style. Maps run in isolated Web pages. Desktop clients use a separate secure host; mobile clients require an app shell that restricts native bridges and navigation to trusted documents. Maps do not load if these boundaries cannot be established. Desktop maps follow page scrolling and clip areas covered by sticky tabs; menus or dialogs may hide them temporarily. When offline, incompatible with WebGL, unable to load the map, or using authentication bypass, switch to a Table view to access records. Address search, geocoding, routing, and coordinate conversion are not provided."
- }
- ]
- },
{
"ID": "20240818174922-r0eubvc",
"Type": "NodeHeading",
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
index 41fc8fa56f..092d6cc4b5 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
@@ -7,7 +7,7 @@
"id": "20240208113259-nykkvaq",
"title": "数据库",
"type": "doc",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -74,7 +74,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009034010-m7nwg3o",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -102,30 +102,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009034010-grvs8hv",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
"Type": "NodeText",
- "Data": "在经度和纬度输入框中分别填写坐标,例如经度 116.4074、纬度 39.9042。也可点击 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "地图选点"
- },
- {
- "Type": "NodeText",
- "Data": " 打开位置编辑器内嵌的地图。点击地图会填入草稿坐标,再点击 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "保存"
- },
- {
- "Type": "NodeText",
- "Data": " 才会应用。仅修改名称时,保留的来源文本保持不变;手动修改坐标或地图选点会清除来源文本。地图不可用时,仍可手动填写坐标。"
+ "Data": "在经度和纬度输入框中分别填写坐标,例如经度 116.4074、纬度 39.9042。仅修改名称时,保留的来源文本保持不变;修改坐标会清除来源文本。"
}
]
},
@@ -3987,123 +3969,6 @@
}
]
},
- {
- "ID": "20261009050034-dfwj4cb",
- "Type": "NodeHeading",
- "HeadingLevel": 2,
- "Properties": {
- "id": "20261009050034-dfwj4cb",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地图视图"
- }
- ]
- },
- {
- "ID": "20261009050034-dz1fw4j",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-dz1fw4j",
- "updated": "20261010233500"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地图使用内置 OpenFreeMap。未指定位置字段时,默认使用视图中的第一个位置字段,也可在视图设置中更改。在可编辑视图中,点击摘要右侧的“未定位条目”按钮,可查看当前筛选和搜索结果中该字段尚无坐标的条目,包括仅填写地点名称的条目。列表支持搜索和分批加载,点击条目可打开并编辑。浏览全部记录可切换到表格视图。 视图设置中的高度提供小(320 px)、中(480 px)、大(640 px)和超大(800 px)四档,默认使用中档。高度按视图独立保存,并适配小屏幕。"
- }
- ]
- },
- {
- "ID": "20261009050034-f3814by",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-f3814by",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "OpenFreeMap 不需要 API Key 或全局服务配置。请保留地图上的提供商和地图数据署名。"
- }
- ]
- },
- {
- "ID": "20261009050034-lipfkdw",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-lipfkdw",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地图显示 WGS84 坐标,不进行转换。OpenFreeMap 使用墨卡托投影,纬度超出 ±85.0511287798066° 的合法位置会保留原值并计入投影不支持数量,不会静默裁切。"
- }
- ]
- },
- {
- "ID": "20261009050034-ughi4hh",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-ughi4hh",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "筛选和排序同样作用于地图。标记只代表已加载的记录,不代表整个数据库;界面会说明已加载范围及跳过的位置数量。标记过多时请缩小分页或使用筛选。点击标记打开对应记录。点击地图空白处会弹出所选点的 WGS84 坐标,可点击 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "复制"
- },
- {
- "Type": "NodeText",
- "Data": " 复制坐标;在可编辑视图中,还可选择 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "在此创建条目"
- },
- {
- "Type": "NodeText",
- "Data": ",创建条目并将该点写入视图选定的位置字段。仅点击地图不会更改任何记录。"
- }
- ]
- },
- {
- "ID": "20261009050034-rrjk1eg",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-rrjk1eg",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地图需要外部网络连接。隔离的地图页面仅接收坐标和不含正文的记录 ID,不接收记录标题或完整内容。发布页面不加载实时地图,文档导出保留记录表格。"
- }
- ]
- },
- {
- "ID": "20261009050034-wy69fcu",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-wy69fcu",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "宿主配色跟随应用主题,底图保留默认样式。地图通过隔离的 Web 页面运行;桌面客户端使用独立的安全宿主,移动客户端需搭配限制原生桥和导航仅用于可信主文档的外壳。无法建立隔离边界时不加载地图。桌面地图随页面滚动并裁剪吸顶栏覆盖的区域,菜单或对话框遮挡时可能暂时隐藏。离线、WebGL 不兼容、地图加载失败或启用鉴权绕过模式时,可切换到表格视图访问记录。本功能不提供地址搜索、地理编码、路线规划或坐标转换。"
- }
- ]
- },
{
"ID": "20240818174119-3zag9wr",
"Type": "NodeHeading",
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
index 6454a1a732..2cd4371b83 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
@@ -7,7 +7,7 @@
"id": "20240208171522-y7dxcno",
"title": "資料庫",
"type": "doc",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -74,7 +74,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009034010-5oq6h7a",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -102,30 +102,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009034010-ue87c6m",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
"Type": "NodeText",
- "Data": "在經度和緯度輸入框中分別填寫座標,例如經度 116.4074、緯度 39.9042。也可點擊 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "地圖選點"
- },
- {
- "Type": "NodeText",
- "Data": " 開啟位置編輯器內嵌的地圖。點擊地圖會填入草稿座標,再點擊 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "保存"
- },
- {
- "Type": "NodeText",
- "Data": " 才會套用。僅修改名稱時,保留的來源文字維持不變;手動修改座標或地圖選點會清除來源文字。地圖無法使用時,仍可手動填寫座標。"
+ "Data": "在經度和緯度輸入框中分別填寫座標,例如經度 116.4074、緯度 39.9042。僅修改名稱時,保留的來源文字維持不變;修改座標會清除來源文字。"
}
]
},
@@ -3987,123 +3969,6 @@
}
]
},
- {
- "ID": "20261009050034-7n1yzkx",
- "Type": "NodeHeading",
- "HeadingLevel": 2,
- "Properties": {
- "id": "20261009050034-7n1yzkx",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地圖檢視"
- }
- ]
- },
- {
- "ID": "20261009050034-ctek3na",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-ctek3na",
- "updated": "20261010233500"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地圖使用內建 OpenFreeMap。未指定位置欄位時,預設使用檢視中的第一個位置欄位,也可在檢視設定中變更。在可編輯檢視中,點擊摘要右側的「未定位項目」按鈕,可查看目前篩選和搜尋結果中該欄位尚無座標的項目,包括僅填寫地點名稱的項目。清單支援搜尋和分批載入,點擊項目可開啟並編輯。瀏覽全部記錄可切換到表格檢視。 視圖設定中的高度提供小(320 px)、中(480 px)、大(640 px)和超大(800 px)四種尺寸,預設使用中尺寸。高度依視圖獨立儲存,並適配小螢幕。"
- }
- ]
- },
- {
- "ID": "20261009050034-ezfsjzw",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-ezfsjzw",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "OpenFreeMap 不需要 API Key 或全域服務設定。請保留地圖上的提供商和地圖資料署名。"
- }
- ]
- },
- {
- "ID": "20261009050034-0pe5w4a",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-0pe5w4a",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地圖顯示 WGS84 座標,不進行轉換。OpenFreeMap 使用麥卡托投影,緯度超出 ±85.0511287798066° 的合法位置會保留原值並計入投影不支援數量,不會靜默裁切。"
- }
- ]
- },
- {
- "ID": "20261009050034-3r0lsdq",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-3r0lsdq",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "篩選和排序同樣作用於地圖。標記只代表已載入的記錄,不代表整個資料庫;介面會說明已載入範圍及跳過的位置數量。標記過多時請縮小分頁或使用篩選。點擊標記開啟對應記錄。點擊地圖空白處會彈出所選點的 WGS84 座標,可點擊 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "複製"
- },
- {
- "Type": "NodeText",
- "Data": " 複製座標;在可編輯檢視中,還可選擇 "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "在此建立項目"
- },
- {
- "Type": "NodeText",
- "Data": ",建立項目並將該點寫入檢視選定的位置欄位。僅點擊地圖不會變更任何記錄。"
- }
- ]
- },
- {
- "ID": "20261009050034-fadq3xu",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-fadq3xu",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地圖需要外部網路連線。隔離的地圖頁面僅接收座標和不含正文的記錄 ID,不接收記錄標題或完整內容。發佈頁面不載入即時地圖,文件匯出保留記錄表格。"
- }
- ]
- },
- {
- "ID": "20261009050034-8jfc6yh",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-8jfc6yh",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "宿主配色跟隨應用程式主題,底圖保留預設樣式。地圖透過隔離的 Web 頁面執行;桌面客戶端使用獨立的安全宿主,行動客戶端需搭配限制原生橋和導覽僅用於可信主文件的外殼。無法建立隔離邊界時不載入地圖。桌面地圖隨頁面捲動並裁剪置頂分頁列覆蓋的區域,選單或對話方塊遮擋時可能暫時隱藏。離線、WebGL 不相容、地圖載入失敗或啟用鑑權繞過模式時,可切換到表格檢視存取記錄。本功能不提供地址搜尋、地理編碼、路線規劃或座標轉換。"
- }
- ]
- },
{
"ID": "20240818174403-xnbqd38",
"Type": "NodeHeading",
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
index f858852db1..8de7fb99c0 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
@@ -8,7 +8,7 @@
"id": "20240530101000-3eaevtp",
"title": "データベース",
"type": "doc",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -75,7 +75,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20261009034010-6j4iniw",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
@@ -103,30 +103,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261009034010-1609sdo",
- "updated": "20261011093258"
+ "updated": "20261011102158"
},
"Children": [
{
"Type": "NodeText",
- "Data": "経度と緯度は、それぞれの入力欄に入力します。例えば、経度には 116.4074、緯度には 39.9042 を入力します。または "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "地図で選択"
- },
- {
- "Type": "NodeText",
- "Data": " をクリックすると、位置エディター内に埋め込み地図が開きます。地図をクリックすると下書きに座標が入力され、"
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "保存"
- },
- {
- "Type": "NodeText",
- "Data": " をクリックすると適用されます。名前だけを変更すると出典テキストは保持されます。座標を手動で変更したり、地図で選択したりすると、出典テキストは消去されます。地図を利用できない場合も、座標を手動で入力できます。"
+ "Data": "経度と緯度は、それぞれの入力欄に入力します。例えば、経度には 116.4074、緯度には 39.9042 を入力します。名前だけを変更すると出典テキストは保持されます。座標を変更すると、出典テキストは消去されます。"
}
]
},
@@ -3993,123 +3975,6 @@
}
]
},
- {
- "ID": "20261009050034-lzsqdz2",
- "Type": "NodeHeading",
- "HeadingLevel": 2,
- "Properties": {
- "id": "20261009050034-lzsqdz2",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "マップビュー"
- }
- ]
- },
- {
- "ID": "20261009050034-xn4up1k",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-xn4up1k",
- "updated": "20261010233500"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地図には組み込みの OpenFreeMap を使用します。位置フィールドを指定していない場合は、ビュー内の最初の位置フィールドを使用します。ビューの設定で変更できます。編集可能なビューでは、件数表示の右側にある「座標未設定の項目」ボタンから、現在のフィルターと検索条件に一致し、そのフィールドに座標がない項目を確認できます。場所の名前だけを入力した項目も含まれます。一覧内で検索したり、項目を追加で読み込んだりできます。項目をクリックすると開いて編集できます。すべてのレコードを閲覧するにはテーブルビューに切り替えてください。 ビュー設定の高さには、小(320 px)、中(480 px)、大(640 px)、特大(800 px)の4段階があり、既定は中です。高さはビューごとに保存され、小さな画面にも適応します。"
- }
- ]
- },
- {
- "ID": "20261009050034-5nmyptf",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-5nmyptf",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "OpenFreeMap に API キーやグローバルなサービス設定は不要です。地図の提供元とデータの帰属表示は残してください。"
- }
- ]
- },
- {
- "ID": "20261009050034-m26635d",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-m26635d",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地図は WGS84 座標を変換せずに表示します。OpenFreeMap は Web Mercator を使用します。緯度が ±85.0511287798066° を超える位置は有効な保存値ですが、無断で補正せず、投影非対応として件数を示して除外します。"
- }
- ]
- },
- {
- "ID": "20261009050034-e6lcmxa",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-e6lcmxa",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "フィルターと並べ替えは地図にも適用されます。マーカーは読み込み済みのレコードだけを表し、データベース全体ではありません。読み込み範囲と除外件数を画面に表示します。マーカーが多すぎる場合はフィルターや小さいページサイズを使用してください。マーカーをクリックするとレコードを開きます。地図の何もない場所をクリックすると、選択した地点の WGS84 座標がポップアップに表示されます。"
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "コピー"
- },
- {
- "Type": "NodeText",
- "Data": " で座標をコピーできます。編集可能なビューでは "
- },
- {
- "Type": "NodeTextMark",
- "TextMarkType": "kbd",
- "TextMarkTextContent": "ここに項目を作成"
- },
- {
- "Type": "NodeText",
- "Data": " を選ぶと、ビューで選択中の位置フィールドにその地点を設定した項目を作成できます。地図をクリックするだけではレコードは変更されません。"
- }
- ]
- },
- {
- "ID": "20261009050034-b9sfeey",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-b9sfeey",
- "updated": "20261010064719"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "地図は外部ネットワークを使用します。隔離された地図ページに渡すのは座標と本文を含まないレコード ID だけで、タイトルやレコード全体は渡しません。公開ページではライブ地図を読み込まず、文書のエクスポートにはレコードの表を残します。"
- }
- ]
- },
- {
- "ID": "20261009050034-5qz3tt7",
- "Type": "NodeParagraph",
- "Properties": {
- "id": "20261009050034-5qz3tt7",
- "updated": "20261011093258"
- },
- "Children": [
- {
- "Type": "NodeText",
- "Data": "ホストの配色はアプリのテーマに従い、ベースマップは既定のスタイルを維持します。地図は隔離された Web ページで動作します。デスクトップ版は独立した安全なホストを使用し、モバイル版はネイティブブリッジと画面遷移を信頼された主文書に制限するアプリが必要です。隔離を確立できない場合は地図を読み込みません。デスクトップでは地図がスクロールに追従し、固定タブに重なる部分を切り取ります。メニューやダイアログが重なる間は一時的に非表示になる場合があります。オフライン、WebGL 非対応、地図の読み込み失敗、認証バイパスの有効時には、テーブルビューでレコードを利用できます。住所検索、ジオコーディング、経路案内、座標変換は提供しません。"
- }
- ]
- },
{
"ID": "20240818180118-fq3wqdb",
"Type": "NodeHeading",
diff --git a/app/package.json b/app/package.json
index a33d64dbaf..9cc32c1b7b 100644
--- a/app/package.json
+++ b/app/package.json
@@ -15,14 +15,14 @@
"api:generate": "node scripts/api-contracts.mjs",
"api:check": "node scripts/api-contracts.mjs --check",
"test": "node --import tsx --test --test-concurrency=1 \"src/**/*.test.ts\" \"tests/**/*.test.js\" \"electron/**/*.test.js\" \"scripts/**/*.test.js\"",
- "dev": "webpack --mode development --config webpack.config.js --config webpack.map.js",
- "dev:mobile": "webpack --mode development --config webpack.mobile.js --config webpack.map.js",
- "dev:desktop": "webpack --mode development --config webpack.desktop.js --config webpack.map.js",
+ "dev": "webpack --mode development --config webpack.config.js",
+ "dev:mobile": "webpack --mode development --config webpack.mobile.js",
+ "dev:desktop": "webpack --mode development --config webpack.desktop.js",
"dev:export": "webpack --mode development --config webpack.export.js",
"build": "pnpm run /build:.*/",
- "build:app": "webpack --mode production --config webpack.config.js --config webpack.map.js",
- "build:mobile": "webpack --mode production --config webpack.mobile.js --config webpack.map.js",
- "build:desktop": "webpack --mode production --config webpack.desktop.js --config webpack.map.js",
+ "build:app": "webpack --mode production --config webpack.config.js",
+ "build:mobile": "webpack --mode production --config webpack.mobile.js",
+ "build:desktop": "webpack --mode production --config webpack.desktop.js",
"build:export": "webpack --mode production --config webpack.export.js",
"gen:types": "tsc -d",
"gen:arch": "node ../scripts/generate-arch-svg.js",
@@ -84,7 +84,6 @@
"html-webpack-plugin": "^5.5.0",
"iconv-lite": "^0.6.3",
"ifdef-loader": "^2.3.2",
- "maplibre-gl": "5.21.1",
"mini-css-extract-plugin": "2.9.2",
"path-browserify": "^1.0.1",
"postcss": "^8.5.29",
diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml
index c33fb5fd11..5917aa53bf 100644
--- a/app/pnpm-lock.yaml
+++ b/app/pnpm-lock.yaml
@@ -248,9 +248,6 @@ importers:
ifdef-loader:
specifier: ^2.3.2
version: 2.3.2
- maplibre-gl:
- specifier: 5.21.1
- version: 5.21.1
mini-css-extract-plugin:
specifier: 2.9.2
version: 2.9.2([email protected])
@@ -967,42 +964,6 @@ packages:
resolution: {integrity: sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q==}
engines: {node: '>= 10.0.0'}
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-0SElaV0uMxEnxzBhhX9WTuPyUeMsAN/SS0i16tjuba4/mio63MG9khjC1a0JAiPGXAwvwm4UfHJURCN7nyudQg==}
- engines: {node: '>= 22'}
-
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-YGcBz1cg4ATXDCM/71L9xveh4dynfGmcLDqufR+nQQy3fKwsAZsWd/x4621/6uJaeB9mwOHE6hPeDgXz9uViUQ==}
-
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-LVL4wgI9YAum5V+LNVQO6QgFBPw7/MIIY4XJPNsPDMrjEwcE+JfKk1LuIl8GnF197ejVdC9QdPaxrx5gfgdGXg==}
-
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==}
-
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-fqd515fjBmANKGGsQ286E2Wvj/XvDFpGzwJxq4CI6jMQue6Oy04uCKp+JWKF00xRTmk6cEu1jPJ9p3xqH8YWqQ==}
-
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-pXj8m7KTsqZt+1jsE0xIpGvqTSbblfkuEJL/NJmNePMtEwxO8V3XMDo9WMSfDeqHvCtBI9Lmt4mGcGR10zecmw==}
-
- '@mapbox/[email protected]':
- resolution: {integrity: sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==}
- engines: {node: '>=6.0.0'}
-
- '@maplibre/[email protected]':
- resolution: {integrity: sha512-2ZYhobdAY+y4/P/z1xe0698165LywD0yDdWugdu3NRUrajgVWut+tLkcz7i/RJguMTURwK7gxwmwYMFJbgbQFw==}
-
- '@maplibre/[email protected]':
- resolution: {integrity: sha512-lichxSiagMEBBrqHF0trtMQH9RKh+9jUlIJl0qW0QHvt2H/tbvUWdE+ZzI2Jd0/pT7j/iavLonlPu7EQ/ixTOw==}
- hasBin: true
-
- '@maplibre/[email protected]':
- resolution: {integrity: sha512-7M2O7ABM80Oi8XPkfkrjKB8mOBIxGoVgkA52Mu4RMWoBvvMdagQ522+WxVYujZsMpqIr3BpzrTbXrm4k8lCzCQ==}
-
- '@maplibre/[email protected]':
- resolution: {integrity: sha512-j6p0AdjvAR19Z3XaCysle7A4ZSo08tYOzxD0Y9NQylwPAkwJJeYub5b2eVucdeDh7erhv69DahoLOevDRERRUw==}
-
resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==}
engines: {node: '>= 16'}
@@ -1158,9 +1119,6 @@ packages:
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==}
-
resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==}
@@ -1788,9 +1746,6 @@ packages:
resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
- resolution: {integrity: sha512-FHc6yNpnTORB0tM5kmZ03iD2mDuNakDE2lvf4Hw1XkfxtEHIGVi01B/GqUSwx+NcC1WGjidAfpTXzeALtPtfpg==}
-
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
@@ -2124,9 +2079,6 @@ packages:
resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==}
- resolution: {integrity: sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==}
-
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
engines: {node: '>= 6'}
@@ -2470,9 +2422,6 @@ packages:
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
- resolution: {integrity: sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==}
-
resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==}
@@ -2491,9 +2440,6 @@ packages:
resolution: {integrity: sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==}
- resolution: {integrity: sha512-e9vurzrXJQrFX6ckpHP3bvj5l+9CnYzkxDNnNQ1h2QTqdWsUAJgXiKdGNcOa1EY85dU8KbQ+z/FdQdB7P+9yfQ==}
-
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
@@ -2558,10 +2504,6 @@ packages:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-zto1RTnFkOpOO1bm93ElCXF1huey2N4LvXaGLMFcYAu9txh0OhGIdX1q3LZLkrMKgMxMeYduaQo+DVNzg098fg==}
- engines: {node: '>=16.14.0', npm: '>=8.1.0'}
-
resolution: {integrity: sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==}
engines: {node: '>=10'}
@@ -2655,9 +2597,6 @@ packages:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
- resolution: {integrity: sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==}
-
resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -2805,14 +2744,6 @@ packages:
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
engines: {node: '>=16 || 14 >=14.18'}
- resolution: {integrity: sha512-J0ajxARhZfpUEebxYs1vhMGMuLSXtBe1e+fFPDrf2uA2hgo+UshKfNUWOz92HJNz6/NFEXseQPddnHkTreWRqg==}
- hasBin: true
-
- resolution: {integrity: sha512-mnvGdvOrIvJOBGUEdGkrVXjN8E/VkIJCkf2eS1DH2yv82ORUlLttmDt0rWY38yYZmVwciZwBUvHM20qxBZf40w==}
- hasBin: true
-
resolution: {integrity: sha512-eRWB5LBz7PpDu4PUlwT0PhnQfTQJlDDdPa35urV4Osrm0t0AqQFGn+UIkU3klZvwJ8KPO3VbBFsXquA6p6kqZw==}
engines: {node: '>=12', npm: '>=6'}
@@ -2912,9 +2843,6 @@ packages:
engines: {node: '>=14.0.0'}
hasBin: true
- resolution: {integrity: sha512-pcaShQc1Shq0y+E7GqJqvZj8DTthWV1KeHGdi0Z6IAin2Oi3JnLCOfwnCo84qc+HAp52wT9nK9H7FAJp5a44GQ==}
-
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
@@ -2940,9 +2868,6 @@ packages:
resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==}
- resolution: {integrity: sha512-VG2K63Igkiv9p76tk1lilczEK1cT+kCjKtkdhw1dQZV3k3IXJbd3o6Ho8b9zJZaHSnT2hKe4I+ObmX9w6m5SmQ==}
-
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -2965,9 +2890,6 @@ packages:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==}
-
resolution: {integrity: sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==}
hasBin: true
@@ -3020,9 +2942,6 @@ packages:
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
- resolution: {integrity: sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==}
-
resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==}
engines: {node: '>= 0.4'}
@@ -3345,9 +3264,6 @@ packages:
resolution: {integrity: sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==}
engines: {node: '>=12.0.0'}
- resolution: {integrity: sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==}
-
resolution: {integrity: sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==}
@@ -4088,47 +4004,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@mapbox/[email protected]': {}
-
- '@mapbox/[email protected]': {}
-
- '@mapbox/[email protected]': {}
-
- '@mapbox/[email protected]': {}
-
- '@mapbox/[email protected]': {}
-
- '@mapbox/[email protected]':
- dependencies:
- '@mapbox/point-geometry': 1.1.0
- '@types/geojson': 7946.0.16
- pbf: 4.0.2
-
- '@mapbox/[email protected]': {}
-
- '@maplibre/[email protected]':
- dependencies:
- kdbush: 4.1.0
-
- '@maplibre/[email protected]':
- dependencies:
- '@mapbox/jsonlint-lines-primitives': 2.0.3
- '@mapbox/unitbezier': 1.0.0
- json-stringify-pretty-compact: 4.0.0
- minimist: 1.2.8
- quickselect: 3.0.0
- tinyqueue: 3.0.0
-
- '@maplibre/[email protected]':
- dependencies:
- '@mapbox/point-geometry': 1.1.0
-
- '@maplibre/[email protected]':
- dependencies:
- '@mapbox/point-geometry': 1.1.0
- '@types/geojson': 7946.0.16
- pbf: 5.1.2
-
'@noble/[email protected]': {}
'@noble/[email protected]': {}
@@ -4259,8 +4134,6 @@ snapshots:
dependencies:
'@types/node': 18.13.0
- '@types/[email protected]': {}
-
dependencies:
'@types/minimatch': 6.0.0
@@ -4975,8 +4848,6 @@ snapshots:
-
@@ -5410,8 +5281,6 @@ snapshots:
dependencies:
resolve-pkg-maps: 1.0.0
-
dependencies:
is-glob: 4.0.3
@@ -5755,8 +5624,6 @@ snapshots:
-
optional: true
@@ -5776,8 +5643,6 @@ snapshots:
optionalDependencies:
graceful-fs: 4.2.11
-
dependencies:
json-buffer: 3.0.1
@@ -5837,28 +5702,6 @@ snapshots:
dependencies:
yallist: 4.0.0
- dependencies:
- '@mapbox/jsonlint-lines-primitives': 2.0.3
- '@mapbox/point-geometry': 1.1.0
- '@mapbox/tiny-sdf': 2.2.0
- '@mapbox/unitbezier': 0.0.1
- '@mapbox/vector-tile': 2.0.5
- '@mapbox/whoots-js': 3.1.0
- '@maplibre/geojson-vt': 6.1.2
- '@maplibre/maplibre-gl-style-spec': 24.10.0
- '@maplibre/mlt': 1.3.0
- '@maplibre/vt-pbf': 4.3.2
- '@types/geojson': 7946.0.16
- earcut: 3.2.4
- gl-matrix: 3.4.4
- kdbush: 4.1.0
- murmurhash-js: 1.0.0
- pbf: 4.0.2
- potpack: 2.1.0
- quickselect: 3.0.0
- tinyqueue: 3.0.0
-
dependencies:
escape-string-regexp: 4.0.0
@@ -5931,8 +5774,6 @@ snapshots:
-
@@ -6072,14 +5913,6 @@ snapshots:
lru-cache: 10.2.0
minipass: 7.1.3
- dependencies:
- resolve-protobuf-schema: 2.1.0
-
- dependencies:
- resolve-protobuf-schema: 2.1.0
-
@@ -6170,8 +6003,6 @@ snapshots:
commander: 9.4.0
optional: true
-
@@ -6196,8 +6027,6 @@ snapshots:
retry: 0.12.0
signal-exit: 3.0.7
-
@@ -6214,8 +6043,6 @@ snapshots:
-
dependencies:
debug: 4.4.3([email protected])
@@ -6268,10 +6095,6 @@ snapshots:
- dependencies:
- protocol-buffers-schema: 3.6.1
-
dependencies:
es-errors: 1.3.0
@@ -6617,8 +6440,6 @@ snapshots:
fdir: 6.5.0([email protected])
picomatch: 4.0.4
-
dependencies:
tmp: 0.2.7
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 58781eae3b..b8f7134bad 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -1,149 +1,3 @@
-@use "../component/record-inbox";
-
-.av__location-picker {
- margin-top: 8px;
-}
-
-.av__location-picker-canvas {
- height: clamp(180px, 35vh, 280px);
- position: relative;
- overflow: hidden;
-}
-
-.av__map {
- width: 100%;
- min-width: 0;
- display: flex;
- flex-direction: column;
- gap: 8px;
- margin: 8px 0;
-}
-
-.av__map-setting-value {
- min-width: 0;
- max-width: min(160px, 45vw);
-}
-
-.av__map-status,
-.av__map-skipped,
-.av__map-summary {
- overflow-wrap: anywhere;
-}
-
-.av__map-toolbar {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- gap: 8px;
-}
-
-.av__map-summary {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-end;
- line-height: 16px;
- min-width: 0;
- max-width: 100%;
- gap: 4px 12px;
-}
-
-.av__map-unplaced-menu {
- @include record-inbox.header-search("av__map-unplaced", 8px);
-
- &:not(.b3-menu--fullscreen) {
- width: min(320px, 75vw);
- }
-
- &.b3-menu--fullscreen {
- .av__map-unplaced-head,
- .av__map-unplaced-search {
- padding-left: 0;
- padding-right: 0;
- }
- }
-}
-
-.av__map-status:empty,
-.av__map-skipped:empty {
- display: none;
-}
-
-.av__map-canvas {
- width: 100%;
- height: clamp(240px, 60vh, 480px);
-
- // 保留外层矩形命中区域,避免圆角透明区中断地图可见性与署名计时。
- > iframe,
- > webview {
- border-radius: var(--b3-border-radius);
- overflow: hidden;
- }
-}
-
-@each $height, $minimum, $viewport in ((320, 160px, 40vh), (640, 320px, 80vh), (800, 400px, 100vh)) {
- .av__map[data-map-height="#{$height}"] > .av__map-canvas {
- height: clamp($minimum, $viewport, #{$height}px);
- }
-}
-
-.av__map-empty {
- font-size: var(--b3-font-size);
- min-height: 240px;
- padding: 32px 16px;
- border: 1px solid var(--b3-border-color);
- border-radius: var(--b3-border-radius);
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: var(--b3-theme-on-background);
-
- > p {
- margin: 12px 0 24px;
- text-align: center;
- }
-
- > svg {
- width: 32px;
- height: 32px;
- color: var(--b3-theme-on-surface);
- }
-}
-
-.av__map-setup,
-.av__map-create-fields {
- width: 360px;
- max-width: 100%;
-}
-
-.av__map-setting {
- display: grid;
- grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
- align-items: center;
- gap: 16px;
-
- > span,
- .b3-select {
- min-width: 0;
- }
-
- .b3-select {
- width: 100%;
- }
-}
-
-.av__map-create-fields {
- display: flex;
- margin-top: 24px;
- padding-top: 20px;
- border-top: 1px solid var(--b3-border-color);
-
- .b3-button {
- flex: 1;
- white-space: normal;
- }
-}
-
.av__lunar-editor {
width: 340px;
max-width: 100%;
@@ -510,16 +364,7 @@
margin-top: 4px !important;
margin-bottom: 4px !important;
- &[data-av-type="map"] > .av__container > .av__scroll {
- .av__row[data-id],
- .av__row--util,
- .av__spacer {
- display: none;
- }
- }
-
- &[data-av-type="list"],
- &[data-av-type="map"] {
+ &[data-av-type="list"] {
width: 100%;
> .av__container,
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index b4c35cb3ce..37c5abf199 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -154,7 +154,6 @@ const slashMenuBuiltinOrder = [
"databaseGalleryView",
"databaseKanbanView",
"databaseCalendarView",
- "databaseMapView",
"separator_2",
"emoji",
"link",
@@ -573,7 +572,7 @@ test("slash menu catalog follows the built-in hint order", () => {
assert.deepEqual(section?.children.map((item) => item.key), ["menu"]);
const children = getEntryCatalogChildren(SLASH_MENU_ROOT_PATH);
assert.deepEqual(children.map((item) => item.key), ["frequent", ...slashMenuBuiltinOrder]);
- assert.equal(children.filter((item) => item.type === "entry").length, 70);
+ assert.equal(children.filter((item) => item.type === "entry").length, 69);
assert.equal(children.filter((item) => item.type === "separator").length, 5);
assert.equal(children.filter(item => item.key !== "frequent").every((item) => item.simple), true);
});
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index cd71ce4bb0..eaeee056d3 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -581,7 +581,6 @@ const slashMenuBuiltinChildren = [
node("databaseGalleryView", lang("databaseGalleryView")),
node("databaseKanbanView", lang("databaseKanbanView")),
node("databaseCalendarView", lang("databaseCalendarView")),
- node("databaseMapView", lang("databaseMapView")),
separator("separator_2"),
node("emoji", lang("emoji")),
node("link", lang("link")),
diff --git a/app/src/config/entryVisibility/order.test.ts b/app/src/config/entryVisibility/order.test.ts
index a9a8380a00..aeb4e6dd43 100644
--- a/app/src/config/entryVisibility/order.test.ts
+++ b/app/src/config/entryVisibility/order.test.ts
@@ -83,19 +83,6 @@ test("database calendar view merges into saved slash orders and preserves plugin
assert.equal(entries.find(item => item.key === "databaseCalendarView").simple, true);
});
-test("database map view merges into saved slash orders without changing existing entries", () => {
- const entries = getEntryCatalogChildren("editor.slash.menu");
- const defaults = entries.map(item => item.key);
- const saved = defaults.filter(key => key !== "databaseMapView");
- saved.splice(1, 0, "plugin:example:item");
- const merged = mergeEntryOrderPreservingUnknown(defaults, saved);
- assert.deepEqual(merged.filter(key => key !== "databaseMapView"), saved);
- assert.equal(merged[merged.indexOf("databaseCalendarView") + 1], "databaseMapView");
- const separators = new Set(entries.filter(item => item.type === "separator").map(item => item.key));
- assert.deepEqual(resolveEntryOrder([...defaults, "plugin:example:item"], merged, separators), merged);
- assert.equal(entries.find(item => item.key === "databaseMapView").simple, true);
-});
-
test("database list view merges into saved slash orders and preserves plugin slots", () => {
const entries = getEntryCatalogChildren("editor.slash.menu");
const defaults = entries.map(item => item.key);
@@ -110,6 +97,18 @@ test("database list view merges into saved slash orders and preserves plugin slo
["databaseTableView", "databaseListView"]);
});
+test("retired database map entry stays hidden without changing saved slash or plugin order", () => {
+ const entries = getEntryCatalogChildren("editor.slash.menu");
+ const defaults = entries.map(item => item.key);
+ const saved = [...defaults];
+ saved.splice(saved.indexOf("databaseCalendarView") + 1, 0, "databaseMapView", "plugin:example:item");
+ const merged = mergeEntryOrderPreservingUnknown(defaults, saved);
+ const separators = new Set(entries.filter(item => item.type === "separator").map(item => item.key));
+ assert.equal(defaults.includes("databaseMapView"), false);
+ assert.deepEqual(resolveEntryOrder([...defaults, "plugin:example:item"], merged, separators),
+ saved.filter(key => key !== "databaseMapView"));
+});
+
test("custom task status merges into saved list menus without moving existing entries", () => {
const entries = getEntryCatalogChildren("gutter.single.listBlock");
const defaults = entries.map(item => item.key);
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index 989b31409c..34f18b32be 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -277,11 +277,6 @@ export const getBuiltinSlashMenuItems = (protyle: IProtyle): IHintData[] => {
id: "databaseCalendarView",
value: '<div data-type="NodeAttributeView" data-av-type="calendar"></div>',
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconCalendar"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.databaseCalendarView}</span></div>`,
- }, {
- filter: [window.siyuan.languages.databaseMapView, "database map view", "地图", "数据库地图视图", "ditu", "shujukuditushitu", "sjkdts"],
- id: "databaseMapView",
- value: '<div data-type="NodeAttributeView" data-av-type="map"></div>',
- html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconMap"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.databaseMapView}</span></div>`,
}, {
value: "",
id: "separator_2",
diff --git a/app/src/protyle/hint/mapSlashEntry.test.ts b/app/src/protyle/hint/mapSlashEntry.test.ts
deleted file mode 100644
index acf1fd1bb4..0000000000
--- a/app/src/protyle/hint/mapSlashEntry.test.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {join} from "node:path";
-import test from "node:test";
-import {runInNewContext} from "node:vm";
-import * as ts from "typescript";
-import {resolveSlashMenuItems, TSlashMenuItem} from "./slashMenu";
-
-test("the map slash entry is searchable and creates a map database block", () => {
- const source = ts.createSourceFile("extend.ts", readFileSync(join(__dirname, "extend.ts"), "utf8"),
- ts.ScriptTarget.Latest, true);
- let declaration: ts.ObjectLiteralExpression;
- const visit = (node: ts.Node) => {
- if (ts.isObjectLiteralExpression(node) && node.properties.some(property =>
- ts.isPropertyAssignment(property) && property.name.getText(source) === "id" &&
- ts.isStringLiteral(property.initializer) && property.initializer.text === "databaseMapView")) {
- declaration = node;
- }
- ts.forEachChild(node, visit);
- };
- visit(source);
- assert.ok(declaration);
- const item: TSlashMenuItem = runInNewContext(ts.transpileModule(`(${declaration.getText(source)})`, {
- compilerOptions: {target: ts.ScriptTarget.ES2020},
- }).outputText, {window: {siyuan: {languages: {databaseMapView: "Database map view"}}}});
- item.entryKey = item.id;
- const options = {enabled: true, hideConfiguredCreate: false, order: [item.id], visible: () => true};
- for (const key of ["data", "map", "地图", "ditu"]) {
- assert.equal(resolveSlashMenuItems([item], {...options, key})[0], item);
- }
- assert.equal(item.value, '<div data-type="NodeAttributeView" data-av-type="map"></div>');
- assert.match(item.html, /#iconMap/);
- assert.match(item.html, /Database map view/);
- assert.equal(resolveSlashMenuItems([item], {...options, key: "map", visible: () => false}).length, 0);
- assert.equal(resolveSlashMenuItems([item], {...options, key: "map", lite: true}).length, 0);
-});
diff --git a/app/src/protyle/hint/slashMenu.test.ts b/app/src/protyle/hint/slashMenu.test.ts
index 4591fefd51..26acf90b5b 100644
--- a/app/src/protyle/hint/slashMenu.test.ts
+++ b/app/src/protyle/hint/slashMenu.test.ts
@@ -84,7 +84,7 @@ test("slash menu separator normalization removes leading, trailing, and consecut
});
test("lite slash menu hides document-dependent entries and keeps local editing entries", () => {
- const unavailable = ["database", "databaseTableView", "databaseListView", "databaseCalendarView", "databaseMapView", "databaseKanbanView", "databaseGalleryView",
+ const unavailable = ["database", "databaseTableView", "databaseListView", "databaseCalendarView", "databaseKanbanView", "databaseGalleryView",
"newFileRef", "newSubDocRef", "template", "blockEmbed", "aiWriting", "widget", "unknown"];
const available = ["ref", "assets", "heading1", "table", "bold", "mermaid", "horizontalSuperBlock", "verticalSuperBlock"];
const items = [...unavailable, ...available].map((id) => entry(id));
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 79dbdc67a6..29aa260e60 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -411,7 +411,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
return true;
} else if (type === "av-add-more" && !protyle.disabled) {
const templateID = blockElement.querySelector<HTMLElement>(".av__header")?.dataset.defaultTemplateId;
- if (templateID || ["calendar", "map"].includes(viewType)) {
+ if (templateID || viewType === "calendar") {
createAttributeViewItem({blockElement, protyle, templateID});
} else {
insertRows({
@@ -522,7 +522,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
target.previousElementSibling?.getAttribute("data-id") || undefined;
const groupID = bodyElement ? bodyElement.getAttribute("data-group-id") : "";
const templateID = blockElement.querySelector<HTMLElement>(".av__header")?.dataset.defaultTemplateId;
- if (templateID || viewType === "map") {
+ if (templateID) {
createAttributeViewItem({blockElement, protyle, templateID, position: {previousID, groupID}});
} else {
insertRows({blockElement, protyle, count: 1, previousID, groupID});
diff --git a/app/src/protyle/render/av/calendar/render.test.ts b/app/src/protyle/render/av/calendar/render.test.ts
index c8e2b5a366..410c966b9c 100644
--- a/app/src/protyle/render/av/calendar/render.test.ts
+++ b/app/src/protyle/render/av/calendar/render.test.ts
@@ -393,7 +393,6 @@ test("calendar edit-mode changes refresh controls and stale actions cannot creat
"../richText": {renderAVRichTextElements() {}},
"../locate": {finishAVLocate() {}},
"../render/av/calendar/render": calendar,
- "../render/av/map/render": {refreshMapReadonly() {}},
"../../util/functions": {isMobile: () => mobile},
"../ui/hideElements": {hideElements() {}},
"./disabledWYSIWYG": {disabledWYSIWYG() {}},
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 2332fa4570..a71a1dd2ce 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -559,7 +559,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
if (!bodyElement) {
return;
}
- const isList = ["list", "map"].includes(blockElement.getAttribute("data-av-type"));
+ const isList = blockElement.getAttribute("data-av-type") === "list";
const avHeaderRect = (isList ? blockElement.querySelector(".av__views") :
bodyElement.querySelector(".av__row--header")).getBoundingClientRect();
if (avHeaderRect.bottom > cellRect.top) {
diff --git a/app/src/protyle/render/av/container.ts b/app/src/protyle/render/av/container.ts
index 138511996a..d37b91a323 100644
--- a/app/src/protyle/render/av/container.ts
+++ b/app/src/protyle/render/av/container.ts
@@ -1,8 +1,5 @@
-import {destroyMap} from "./map/state";
-
// 重建数据库容器时保留标签栏位置,仅在首次渲染或切换视图时滚动到目标标签。
export const replaceAVContainer = (blockElement: HTMLElement, html: string) => {
- destroyMap(blockElement);
const selector = ":scope > .av__container > .av__header > .av__views > .layout-tab-bar";
const previousTabBar = blockElement.querySelector<HTMLElement>(selector);
const scrollLeft = previousTabBar?.scrollLeft || 0;
diff --git a/app/src/protyle/render/av/fieldVisibility.ts b/app/src/protyle/render/av/fieldVisibility.ts
index ceae29fd50..685fa26599 100644
--- a/app/src/protyle/render/av/fieldVisibility.ts
+++ b/app/src/protyle/render/av/fieldVisibility.ts
@@ -7,8 +7,6 @@ import {setPosition} from "../../../util/setPosition";
const getViewIcon = (type: TAVView) => {
switch (type) {
- case "map":
- return "iconMap";
case "calendar":
return "iconCalendar";
case "list":
diff --git a/app/src/protyle/render/av/layout.ts b/app/src/protyle/render/av/layout.ts
index 680dccd28f..a91a88f77d 100644
--- a/app/src/protyle/render/av/layout.ts
+++ b/app/src/protyle/render/av/layout.ts
@@ -1,6 +1,5 @@
import {isAVSelectType} from "./capabilities";
import {bindCalendarSettings, getCalendarSettingsHTML} from "./calendar/settings";
-import {bindMapSettings, getMapSettingsHTML} from "./map/settings";
import {isTableLikeView} from "./viewType";
import {isAVRenderData} from "./renderData";
import {transaction} from "../../wysiwyg/transaction";
@@ -147,11 +146,6 @@ export const getLayoutHTML = (data: IAV) => {
<div class="fn__hr"></div>
<div>${window.siyuan.languages.calendarView}</div>
</div>
- <div data-type="set-layout" data-view-type="map" class="av__layout-item${data.viewType === "map" ? " av__layout-item--select" : ""}">
- <svg><use xlink:href="#iconMap"></use></svg>
- <div class="fn__hr"></div>
- <div>${window.siyuan.languages.mapView}</div>
- </div>
</div>
</button>
<label class="b3-menu__item">
@@ -180,9 +174,6 @@ export const getLayoutHTML = (data: IAV) => {
if (data.viewType === "calendar") {
return html + getCalendarSettingsHTML(data.view as IAVTable, true) + "</div>";
}
- if (data.viewType === "map") {
- html += getMapSettingsHTML(data.view as IAVTable);
- }
return html + `<button class="b3-menu__item" data-type="set-page-size" data-size="${view.pageSize}">
<span class="fn__flex-center">${window.siyuan.languages.entryNum}</span>
<span class="fn__flex-1"></span>
@@ -299,10 +290,6 @@ export const bindLayoutEvent = (options: {
bindCalendarSettings({...options, onChange: rerender});
return;
}
- if (options.data.viewType === "map") {
- bindMapSettings({...options, onChange: rerender});
- return;
- }
if (isTableLikeView(options.data.viewType)) {
return;
}
diff --git a/app/src/protyle/render/av/listView.test.ts b/app/src/protyle/render/av/listView.test.ts
index d7f236e442..8115559301 100644
--- a/app/src/protyle/render/av/listView.test.ts
+++ b/app/src/protyle/render/av/listView.test.ts
@@ -46,15 +46,6 @@ const createView = () => ({
}) as IAVTable;
describe("database list view", () => {
- it("map record lists use list rendering and the same field selection plumbing", () => {
- const data = createView();
- const options = {data, row: data.rows[0], rowIndex: 0, pinIndex: 0};
- assert.equal(getRowHTML({...options, type: "map"}), getRowHTML({...options, type: "list"}));
- assert.equal(viewType.isTableLikeView("map"), true);
- const selected = resolveAVSelectedCell({view: data, viewType: "map"} as IAV,
- {groupID: "", rowID: "row", colID: "title"});
- assert.equal(selected.cell.id, "title-value");
- });
it("renders the primary field without column widths or freezing and reveals selected properties", () => {
const data = createView();
const options = {data, row: data.rows[0], rowIndex: 0, pinIndex: 0, type: "list" as TAVView};
diff --git a/app/src/protyle/render/av/locate.ts b/app/src/protyle/render/av/locate.ts
index 7945a986cb..6d05b829c4 100644
--- a/app/src/protyle/render/av/locate.ts
+++ b/app/src/protyle/render/av/locate.ts
@@ -10,7 +10,6 @@ import {scrollCenter} from "../../../util/highlightById";
import {setAVCellAnchor, setAVItemAnchor} from "./rangeSelect";
import {updateAVRowSelect} from "./virtualScroll";
import {getAVLocateViewChange} from "./locateView";
-import {openMapRecord} from "./map/openRecord";
import {applyAVColorPalette, getAVCustomColors} from "./color";
import {getBacklinkScrollElement, revealBacklinkReference, scrollBacklinkTarget} from "./backlinkScroll";
@@ -25,7 +24,6 @@ const queuedLocateRequests = new Map<string, {
}>();
const renderTokens = new WeakMap<HTMLElement, symbol>();
const renderedAVData = new WeakMap<HTMLElement, IAV>();
-const mapOpenTokens = new WeakMap<HTMLElement, symbol>();
const highlightTokens = new WeakMap<HTMLElement, symbol>();
const highlightStates = new WeakMap<HTMLElement, {element: HTMLElement, className: string, timer: number}>();
@@ -322,7 +320,7 @@ export const prepareAVLocate = (blockElement: HTMLElement, data: IAV, resetData:
if (request.viewID && request.previousViewID !== undefined && request.viewID !== request.previousViewID) {
clearSelect(["row", "galleryItem"], blockElement);
}
- if (data.viewType === "calendar" || data.viewType === "map") {
+ if (data.viewType === "calendar") {
return;
}
const key = data.target.groupID || "all";
@@ -378,41 +376,6 @@ export const finishAVLocate = (blockElement: HTMLElement, protyle: IProtyle, dat
clearAVLocateRequest(blockElement, request);
return;
}
- if (data.viewType === "map") {
- clearAVLocateRequest(blockElement, request);
- if (request.located) {
- return;
- }
- // 预览只定位地图容器,明确打开条目的操作复用记录详情,不展开记录列表。
- if (request.persistView === false) {
- if (request.scroll !== false && !scrollBacklinkTarget(blockElement, blockElement)) {
- scrollCenter(protyle, blockElement, "center");
- }
- } else {
- const row = (data.view as IAVTable).rows.find(item => item.id === request.itemID);
- const token = Symbol();
- const renderToken = renderTokens.get(blockElement);
- mapOpenTokens.set(blockElement, token);
- const failed = () => {
- if (blockElement.isConnected && mapOpenTokens.get(blockElement) === token &&
- renderTokens.get(blockElement) === renderToken && !getAVLocateRequest(blockElement) &&
- (!request.isValid || request.isValid()) && !request.messageShown) {
- request.messageShown = true;
- showMessage(window.siyuan.languages.databaseItemNotFound);
- }
- };
- void Promise.resolve(openMapRecord(protyle, blockElement, row, request.keyID)).then(opened => {
- if (!opened) {
- failed();
- }
- }).catch(failed).finally(() => {
- if (mapOpenTokens.get(blockElement) === token) {
- mapOpenTokens.delete(blockElement);
- }
- });
- }
- return;
- }
const groupQuery = data.target.groupID ? `.av__body[data-group-id="${data.target.groupID}"]` : ".av__body";
const bodyElement = blockElement.querySelector(groupQuery) as HTMLElement;
if (bodyElement?.classList.contains("fn__none")) {
diff --git a/app/src/protyle/render/av/locationEditor.test.ts b/app/src/protyle/render/av/locationEditor.test.ts
index b09db168a9..d28abc7c69 100644
--- a/app/src/protyle/render/av/locationEditor.test.ts
+++ b/app/src/protyle/render/av/locationEditor.test.ts
@@ -44,13 +44,9 @@ const createEditor = (options: {
} = {}) => {
const fields = Object.fromEntries(["name", "latitude", "longitude"]
.map(name => [name, new Control()]));
- const buttons = Object.fromEntries(["save", "clear", "cancel", "pick"].map(name => [name, new Control()]));
+ const buttons = Object.fromEntries(["save", "clear", "cancel"].map(name => [name, new Control()]));
const container = new Control();
const error = new Control();
- const mapCanvas = new Control();
- const mapStatus = new Control();
- const pickers: Array<{options: Parameters<typeof import("./map/locationPicker").createAVLocationPicker>[0];
- points: unknown[]; destroyed: boolean}> = [];
const lifecycle: string[] = [];
const saved: IAVCellLocationValue[] = [];
const owner = {isConnected: true};
@@ -63,8 +59,6 @@ const createEditor = (options: {
if (selector === '[data-role="error"]') {
return error;
}
- if (selector === '[data-role="map-canvas"]') return mapCanvas;
- if (selector === '[data-role="map-status"]') return mapStatus;
const field = selector.match(/data-field="(\w+)"/);
const action = selector.match(/data-action="(\w+)"/);
return field ? fields[field[1]] : buttons[action[1]];
@@ -103,17 +97,6 @@ const createEditor = (options: {
}},
"./locationValue": locationValue,
"./cellEditor": {AV_CELL_EDITOR_CLOSE_EVENT: "siyuan-av-cell-editor-close"},
- "./map/locationPicker": {createAVLocationPicker: (options: typeof pickers[number]["options"]) => {
- const picker = {options, points: [] as unknown[], destroyed: false};
- pickers.push(picker);
- return {
- setPoint: (point: unknown) => picker.points.push(point),
- destroy: () => {
- picker.destroyed = true;
- lifecycle.push("destroy-picker");
- },
- };
- }},
};
runInNewContext(compiled, {
exports: methods,
@@ -147,7 +130,7 @@ const createEditor = (options: {
onDestroy: () => lifecycle.push("on-destroy"),
});
return {
- fields, buttons, error, root, lifecycle, saved, owner, dialog, markup, pickers, mapCanvas, mapStatus,
+ fields, buttons, error, root, lifecycle, saved, owner, dialog, markup,
ownerChanged: () => ownerChanged(),
closeSheet: () => closeSheet(),
settle: () => new Promise<void>(resolve => setImmediate(resolve)),
@@ -165,7 +148,7 @@ describe("database location editor", () => {
assert.doesNotMatch(editor.markup, /<label class="b3-label/);
assert.match(editor.markup, /<div class="b3-label b3-label--inner fn__flex">\s*<label class="fn__flex-1">longitude/);
assert.match(editor.markup, /<label class="fn__flex-1">latitude/);
- assert.doesNotMatch(editor.markup, /coordinateSystem|select|textarea|data-action="parse"/);
+ assert.doesNotMatch(editor.markup, /coordinateSystem|select|textarea|data-action="parse"|data-action="pick"|map-canvas/);
assert.match(editor.markup, /data-action="save"/);
}
});
@@ -396,116 +379,4 @@ describe("database location editor", () => {
assert.equal(editor.lifecycle.includes("blur"), true);
});
- it("opens one lazy embedded picker and commits its latest draft only on Save on desktop and mobile", async () => {
- for (const mobile of [false, true]) {
- const editor = createEditor({mobile, value: {name: "Office", latitude: 20, longitude: 30,
- originalInput: "Legacy source"}});
- assert.equal(editor.pickers.length, 0);
- editor.buttons.pick.dispatch("click");
- editor.buttons.pick.dispatch("click");
- assert.equal(editor.pickers.length, 1);
- const picker = editor.pickers[0];
- assert.equal(picker.options.canvas, editor.mapCanvas);
- assert.deepEqual(JSON.parse(JSON.stringify(picker.options.point)), {longitude: 30, latitude: 20});
- assert.equal(picker.options.onPick({longitude: 110, latitude: 40}), true);
- assert.equal(picker.options.onPick({longitude: -0.0000001, latitude: 0}), true);
- assert.equal(editor.fields.longitude.value, "-0.0000001");
- assert.equal(editor.fields.latitude.value, "0");
- assert.equal(editor.fields.name.value, "Office");
- assert.equal(editor.saved.length, 0);
- editor.buttons.save.dispatch("click");
- await editor.settle();
- assert.deepEqual(editor.saved, [{name: "Office", longitude: -0.0000001, latitude: 0, originalInput: ""}]);
- assert.equal(picker.destroyed, true);
- assert.equal(editor.lifecycle.filter(item => item === "destroy-picker").length, 1);
- }
- });
-
- it("updates the same picker with manual coordinate drafts without committing", () => {
- const editor = createEditor();
- editor.buttons.pick.dispatch("click");
- editor.fields.longitude.value = "102.42";
- editor.fields.latitude.value = "25.04";
- editor.fields.latitude.dispatch("input");
- assert.deepEqual(JSON.parse(JSON.stringify(editor.pickers[0].points)), [{longitude: 102.42, latitude: 25.04}]);
- assert.equal(editor.saved.length, 0);
- editor.fields.latitude.value = "invalid";
- editor.fields.latitude.dispatch("input");
- assert.equal(editor.pickers[0].points.length, 2);
- assert.equal(editor.fields.latitude.value, "invalid");
- });
-
- it("does not change the saved value or provenance merely by opening the map", async () => {
- const editor = createEditor({value: {name: "Office", longitude: 30, latitude: 20, originalInput: "Legacy source"}});
- editor.buttons.pick.dispatch("click");
- editor.buttons.save.dispatch("click");
- await editor.settle();
- assert.equal(editor.saved.length, 0);
- assert.equal(editor.pickers[0].destroyed, true);
- });
-
- it("keeps manual fields and Save available while an opened picker is loading or unavailable", async () => {
- const editor = createEditor();
- editor.buttons.pick.dispatch("click");
- editor.mapStatus.textContent = "mapLoadError";
- assert.equal(editor.buttons.save.disabled, false);
- assert.equal(editor.fields.latitude.disabled, false);
- assert.equal(editor.fields.longitude.disabled, false);
- editor.fields.latitude.value = "20";
- editor.fields.longitude.value = "30";
- editor.fields.latitude.dispatch("input");
- editor.buttons.save.dispatch("click");
- await editor.settle();
- assert.deepEqual(editor.saved, [{name: "", longitude: 30, latitude: 20, originalInput: ""}]);
- });
-
- it("discards picked coordinates and disposes the picker on Cancel, Escape, navigation and mobile dismissal", async () => {
- for (const action of ["cancel", "escape", "navigation", "sheet", "disconnect"]) {
- const editor = createEditor({mobile: action === "sheet"});
- editor.buttons.pick.dispatch("click");
- const picker = editor.pickers[0];
- picker.options.onPick({longitude: 110, latitude: 40});
- if (action === "escape") editor.key("Escape");
- else if (action === "navigation") editor.root.dispatch("siyuan-av-cell-editor-close");
- else if (action === "sheet") await editor.closeSheet();
- else if (action === "disconnect") {
- editor.owner.isConnected = false;
- editor.ownerChanged();
- } else editor.buttons.cancel.dispatch("click");
- assert.equal(picker.options.isCurrent(), false);
- assert.equal(picker.options.onPick({longitude: 111, latitude: 41}), false);
- editor.buttons.save.dispatch("click");
- await editor.settle();
- assert.equal(editor.saved.length, 0);
- assert.equal(editor.fields.longitude.value, "110");
- assert.equal(editor.lifecycle.filter(item => item === "destroy-picker").length, 1);
- }
- });
-
- it("rejects stale owner identity during map callbacks and does not open a picker for a stale owner", () => {
- let valid = true;
- const editor = createEditor({isValid: () => valid});
- editor.buttons.pick.dispatch("click");
- valid = false;
- assert.equal(editor.pickers[0].options.isCurrent(), false);
- assert.equal(editor.pickers[0].destroyed, true);
- assert.equal(editor.saved.length, 0);
- const stale = createEditor({isValid: () => false});
- stale.buttons.pick.dispatch("click");
- assert.equal(stale.pickers.length, 0);
- });
-
- it("ignores map clicks while saving and preserves the committed draft", async () => {
- let complete: () => void;
- const editor = createEditor({save: () => new Promise<void>(resolve => complete = resolve)});
- editor.buttons.pick.dispatch("click");
- editor.pickers[0].options.onPick({longitude: 110, latitude: 40});
- editor.buttons.save.dispatch("click");
- assert.equal(editor.pickers[0].options.onPick({longitude: 111, latitude: 41}), false);
- assert.equal(editor.fields.longitude.value, "110");
- assert.deepEqual(editor.saved, [{name: "", longitude: 110, latitude: 40, originalInput: ""}]);
- complete();
- await editor.settle();
- });
-
});
diff --git a/app/src/protyle/render/av/locationEditor.ts b/app/src/protyle/render/av/locationEditor.ts
index a1c930e4a8..03d848fe9c 100644
--- a/app/src/protyle/render/av/locationEditor.ts
+++ b/app/src/protyle/render/av/locationEditor.ts
@@ -7,7 +7,6 @@ import {activeBlur} from "../../../mobile/util/keyboardToolbar";
/// #endif
import {beginAVEditorSession} from "./editorSession";
import {AV_CELL_EDITOR_CLOSE_EVENT} from "./cellEditor";
-import {createAVLocationPicker} from "./map/locationPicker";
import {
areAVLocationsEqual,
createAVLocationReplacement,
@@ -39,7 +38,6 @@ export const openAVLocationEditor = (options: AVLocationEditorOptions) => {
let composing = false;
let disposeSheet: (() => void) | undefined;
let ownerObserver: MutationObserver | undefined;
- let mapPicker: ReturnType<typeof createAVLocationPicker> | undefined;
const endEditorSession = options.ownerElement ? beginAVEditorSession(options.ownerElement) : undefined;
const dialog = new Dialog({
title: escapeHtml(languages.location),
@@ -59,11 +57,6 @@ export const openAVLocationEditor = (options: AVLocationEditorOptions) => {
<span class="fn__hr"></span><input class="b3-text-field fn__block" data-field="latitude" type="text" inputmode="decimal" spellcheck="false">
</label>
</div>
- <div class="av__location-picker">
- <button type="button" class="b3-button b3-button--outline" data-action="pick">${escapeHtml(languages.locationPickOnMap)}</button>
- <div class="ft__on-surface" data-role="map-status" role="status" aria-live="polite"></div>
- <div class="av__location-picker-canvas fn__none" data-role="map-canvas"></div>
- </div>
<div class="ft__error fn__none" style="margin-top:8px" data-role="error" role="alert" aria-live="polite"></div>
</div>
<div class="b3-dialog__action">
@@ -103,7 +96,6 @@ export const openAVLocationEditor = (options: AVLocationEditorOptions) => {
}
closing = true;
ownerObserver?.disconnect();
- mapPicker?.destroy();
disposeSheet?.();
/// #if MOBILE
if (mobile && root.contains(document.activeElement)) {
@@ -116,40 +108,6 @@ export const openAVLocationEditor = (options: AVLocationEditorOptions) => {
const isOwnerConnected = () => (!options.ownerElement || options.ownerElement.isConnected) &&
(!options.isValid || options.isValid());
- const currentPoint = () => ({
- longitude: parseAVLocationCoordinate(longitudeInput.value),
- latitude: parseAVLocationCoordinate(latitudeInput.value),
- });
- root.querySelector<HTMLButtonElement>('[data-action="pick"]').addEventListener("click", event => {
- if (mapPicker || saving || closing || composing) return;
- if (!isOwnerConnected()) {
- dialog.destroy();
- return;
- }
- (event.currentTarget as HTMLElement).classList.add("fn__none");
- /// #if MOBILE
- if (mobile) activeBlur(true);
- /// #endif
- mapPicker = createAVLocationPicker({
- canvas: root.querySelector<HTMLElement>('[data-role="map-canvas"]'),
- status: root.querySelector<HTMLElement>('[data-role="map-status"]'),
- point: currentPoint(),
- isCurrent: () => {
- if (closing) return false;
- if (isOwnerConnected()) return true;
- dialog.destroy();
- return false;
- },
- onPick: point => {
- if (saving || closing || composing) return false;
- longitudeInput.value = formatAVLocationCoordinate(point.longitude);
- latitudeInput.value = formatAVLocationCoordinate(point.latitude);
- originalInput = undefined;
- setError();
- return true;
- },
- });
- });
const submit = async (clear = false) => {
if (saving || closing || composing) {
return;
@@ -206,7 +164,6 @@ export const openAVLocationEditor = (options: AVLocationEditorOptions) => {
const clearProvenance = () => {
originalInput = undefined;
setError();
- mapPicker?.setPoint(currentPoint());
};
[latitudeInput, longitudeInput].forEach(input => input.addEventListener("input", clearProvenance));
root.addEventListener("compositionstart", () => composing = true);
diff --git a/app/src/protyle/render/av/locationIntegration.test.ts b/app/src/protyle/render/av/locationIntegration.test.ts
index bffde69c41..161f39301b 100644
--- a/app/src/protyle/render/av/locationIntegration.test.ts
+++ b/app/src/protyle/render/av/locationIntegration.test.ts
@@ -61,7 +61,7 @@ test("location cells display longitude first in every layout, row attributes and
const value: IAVCellValue = {type: "location", location: {
name: "<Home>", latitude: 0, longitude: 180, originalInput: "untrusted raw",
}};
- for (const type of ["table", "list", "gallery", "kanban", "map"] as TAVView[]) {
+ for (const type of ["table", "list", "gallery", "kanban"] as TAVView[]) {
const html = cell.renderCell(value, 0, false, type);
assert.match(html, /&lt;Home&gt; 180, 0/);
assert.doesNotMatch(html, /\[WGS84\]/);
diff --git a/app/src/protyle/render/av/map/attribution.ts b/app/src/protyle/render/av/map/attribution.ts
deleted file mode 100644
index efbba6fb5a..0000000000
--- a/app/src/protyle/render/av/map/attribution.ts
+++ /dev/null
@@ -1,145 +0,0 @@
-import {AV_MAP_ATTRIBUTION_LINKS, AVMapAttributionLink, AVMapProvider, AVMapViewport} from "./protocol";
-
-export interface AVMapAttributionController {
- onReady: () => void;
- setVisible: (visible: boolean, viewport?: AVMapViewport) => void;
- destroy: () => void;
-}
-
-export const createAVMapAttribution = (provider: AVMapProvider, sdk: any, map: any, container: HTMLElement,
- onClick?: (link: AVMapAttributionLink) => void): AVMapAttributionController => {
- const doc = container.ownerDocument;
- const scope = doc.defaultView;
- const maplibre = AV_MAP_ATTRIBUTION_LINKS[provider].find(link => link.id === "maplibre");
- const control = new sdk.AttributionControl({compact: true,
- customAttribution: `<a href="${maplibre.href}" target="_blank">${maplibre.label}</a>`});
- let attribution: HTMLDetailsElement;
- let attributionText: HTMLElement;
- let destroyed = false, loaded = false, visible = false, expanded = true, automatic = true;
- let viewport: AVMapViewport;
- let frame = 0, visibleSince: number;
- const syncAttribution = () => {
- if (destroyed) return;
- // MapLibre 的紧凑控件同时使用 details 状态和此 CSS 类。
- attribution.open = expanded;
- attribution.classList.toggle("maplibregl-compact-show", expanded);
- };
- const cancelFrame = () => {
- scope.cancelAnimationFrame(frame);
- frame = 0;
- };
- const attributionVisible = () => {
- if (!viewport || doc.hidden || !attributionText.getClientRects().length || !attributionText.textContent?.trim()) return false;
- const rect = attribution.getBoundingClientRect();
- if (rect.width <= 0 || rect.height <= 0 || rect.left < 0 || rect.top < 0 ||
- rect.right > scope.innerWidth || rect.bottom > scope.innerHeight ||
- rect.left < viewport.x || rect.top < viewport.y || rect.right > viewport.x + viewport.width ||
- rect.bottom > viewport.y + viewport.height) return false;
- // 紧凑控件的圆角属于透明区域,遮挡检查应命中实际展示的版权文字。
- const textRect = attributionText.getBoundingClientRect();
- if (textRect.width <= 0 || textRect.height <= 0) return false;
- return [textRect.left + 1, textRect.right - 1].every(x => [textRect.top + 1, textRect.bottom - 1].every(y =>
- attribution.contains(doc.elementFromPoint(x, y))));
- };
- const tickAttribution = (now: number) => {
- frame = 0;
- if (destroyed || !automatic || !loaded || !visible || doc.hidden) return;
- if (attributionVisible()) {
- if (visibleSince === undefined) visibleSince = now;
- if (now - visibleSince >= 5000) {
- automatic = false;
- expanded = false;
- syncAttribution();
- return;
- }
- } else {
- visibleSince = undefined;
- }
- frame = scope.requestAnimationFrame(tickAttribution);
- };
- const updateVisibility = () => {
- cancelFrame();
- if (destroyed || !automatic || !loaded || !visible || doc.hidden) {
- visibleSince = undefined;
- return;
- }
- // 尺寸变化后仍完整可见时延续计时;裁剪或遮挡立即中断连续展示。
- if (!attributionVisible()) visibleSince = undefined;
- frame = scope.requestAnimationFrame(tickAttribution);
- };
- const onInteraction = (event: Event) => {
- if (destroyed || !event.isTrusted) return;
- automatic = false;
- cancelFrame();
- visibleSince = undefined;
- };
- const onAttributionClick = (event: MouseEvent) => {
- const target = event.target as Element;
- const anchor = target.closest<HTMLAnchorElement>("a");
- const summary = target.closest("summary");
- if (!anchor && !summary) return;
- // 不向供应商文档授予导航或弹窗权限。
- event.preventDefault();
- event.stopImmediatePropagation();
- if (destroyed || !event.isTrusted || event.button !== 0) return;
- if (summary) {
- // 本地展开不依赖跨宿主可见性消息或外链所需的瞬时激活状态。
- onInteraction(event);
- expanded = !expanded;
- syncAttribution();
- } else if (visible && attribution.contains(anchor) &&
- (scope.navigator as Navigator & {userActivation?: {isActive: boolean}}).userActivation?.isActive) {
- onInteraction(event);
- const link = AV_MAP_ATTRIBUTION_LINKS[provider].find(item => item.href === anchor.getAttribute("href"));
- if (link) onClick?.(link.id);
- }
- };
- const controller: AVMapAttributionController = {
- onReady: () => {
- if (destroyed || loaded) return;
- loaded = true;
- syncAttribution();
- updateVisibility();
- },
- setVisible: (nextVisible, nextViewport) => {
- if (destroyed || visible === nextVisible && viewport?.x === nextViewport?.x && viewport?.y === nextViewport?.y &&
- viewport?.width === nextViewport?.width && viewport?.height === nextViewport?.height) return;
- visible = nextVisible;
- viewport = nextViewport;
- updateVisibility();
- },
- destroy: () => {
- if (destroyed) return;
- destroyed = true;
- cancelFrame();
- visibleSince = undefined;
- attribution?.removeEventListener("click", onAttributionClick, true);
- attribution?.removeEventListener("auxclick", onAttributionClick, true);
- attribution?.removeEventListener("pointerdown", onInteraction, true);
- attribution?.removeEventListener("keydown", onInteraction, true);
- doc.removeEventListener("visibilitychange", updateVisibility);
- map.off("drag", syncAttribution);
- map.off("resize", syncAttribution);
- },
- };
- try {
- map.addControl(control);
- attribution = container.querySelector<HTMLDetailsElement>(".maplibregl-ctrl-attrib");
- attributionText = attribution?.querySelector<HTMLElement>(".maplibregl-ctrl-attrib-inner");
- if (!attribution || !attributionText) throw new Error("mapUnavailable");
- attribution.addEventListener("click", onAttributionClick, true);
- attribution.addEventListener("auxclick", onAttributionClick, true);
- attribution.addEventListener("pointerdown", onInteraction, true);
- attribution.addEventListener("keydown", onInteraction, true);
- doc.addEventListener("visibilitychange", updateVisibility);
- // SDK 控件先处理拖动和尺寸事件,再恢复首次展示或用户主动选择的状态。
- map.on("drag", syncAttribution);
- map.on("resize", syncAttribution);
- syncAttribution();
- return controller;
- } catch (error) {
- controller.destroy();
- if (!map.hasControl?.(control)) control.onRemove?.();
- throw error;
- }
-};
diff --git a/app/src/protyle/render/av/map/bootstrap.ts b/app/src/protyle/render/av/map/bootstrap.ts
deleted file mode 100644
index efd890ed94..0000000000
--- a/app/src/protyle/render/av/map/bootstrap.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import {AVMapProvider, isAVMapProvider} from "./protocol";
-import {prepareAVMapAssets} from "./providersLoader";
-
-// 此策略与响应策略共同生效,在创建 Worker 前移除本地来源权限。
-export const getAVMapLockedPolicy = (provider: AVMapProvider): string => {
- if (!isAVMapProvider(provider)) throw new Error("invalidConfiguration");
- return "default-src 'none'; script-src 'none'; connect-src https://tiles.openfreemap.org; " +
- "img-src data: blob: https://tiles.openfreemap.org; " +
- "style-src 'unsafe-inline'; font-src 'none'; worker-src blob:; child-src blob:; " +
- "frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'";
-};
-
-export const prepareAVMapBootstrap = async (scope: Window, provider: AVMapProvider, signal: AbortSignal): Promise<() => void> => {
- const assets = await prepareAVMapAssets(scope, provider, signal);
- try {
- if (signal.aborted) throw new Error("hostUnavailable");
- const policy = scope.document.createElement("meta");
- policy.httpEquiv = "Content-Security-Policy";
- policy.content = getAVMapLockedPolicy(provider);
- scope.document.head.appendChild(policy);
- assets.lock();
- return assets.destroy;
- } catch (_error) {
- assets.destroy();
- throw new Error("hostUnavailable");
- }
-};
diff --git a/app/src/protyle/render/av/map/createRecord.test.ts b/app/src/protyle/render/av/map/createRecord.test.ts
deleted file mode 100644
index 39b390193f..0000000000
--- a/app/src/protyle/render/av/map/createRecord.test.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {test} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import * as closest from "../../../util/hasClosest";
-import * as escape from "../../../../util/escape";
-import {DOMFixture, requireFixture} from "./testDOM";
-
-const compile = (path: string) => transpileModule(readFileSync(path, "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
-}).outputText;
-const actionSource = compile("src/protyle/render/av/action.ts");
-const templateSource = compile("src/protyle/render/av/newItemTemplate.ts");
-
-const setup = (type: string, layout: string, templateID = "") => {
- const document = new DOMFixture();
- const block = document.createElement("div");
- block.dataset.type = "NodeAttributeView";
- block.dataset.avId = "database";
- block.dataset.nodeId = "carrier";
- block.dataset.avType = layout;
- block.setAttribute("custom-sy-av-view", "view");
- block.innerHTML = `<div class="av__header" data-default-template-id="${templateID}"></div>
- <div class="av__body" data-group-id=""><button data-type="${type}"><span>Create</span></button></div>`;
- document.body.append(block);
- const requests: Array<{templateID: string; previousID: string; groupID: string; avID: string; blockID: string; viewID: string}> = [];
- const opened: Array<{itemID: string; focusPrimary: boolean}> = [];
- const insertions: Array<{previousID: string; groupID: string}> = [];
- const messages: string[] = [];
- let callback: (response: unknown) => void;
- let rendered = 0;
- const modules: Record<string, unknown> = {};
- // 只允许已知但本入口不应调用的依赖;新增依赖或意外走入其他业务路径均立即失败。
- for (const id of ["./viewType", "../../../plugin/Menu", "../../wysiwyg/transaction", "../../../menus/util",
- "../../../menus/commonMenuItem", "./cell", "./col", "../../../plugin/EventBus", "./openMenuPanel",
- "../../hint/extend", "../../util/selection", "../../util/selectionOffsets", "../../preview/image",
- "../../../emoji", "dayjs", "./calc", "./view", "./rangeSelect", "./relation", "../../ui/hideElements",
- "../../../util/highlightById", "./gallery/util", "../../util/clear", "../../../util/image",
- "../../../mobile/util/mobileAppUtil", "./kanban/groupMenu", "./groupFold", "./publishState",
- "./readonlyState", "./batchEdit", "../../../util/functions", "./viewVisibility",
- "./cellValue", "./blockIcon", "./itemLink", "../../../editor/openLink", "./richText", "../../../search/util",
- "../../../mobile/menu/search", "../../../mobile/util/keyboardToolbar", "./capabilities", "./fieldValueEditor",
- "./locationValue", "../../../dialog", "../../../menus/Menu", "../../../util/upDownHint",
- "../../../mobile/util/bindBottomSheetDialog"]) {
- modules[id] = new Proxy({}, {get: (_target, name: string) => assert.fail(`Unexpected dependency call: ${id}.${name}`)});
- }
- Object.assign(modules, {
- "../../util/hasClosest": closest,
- "../../util/compatibility": {isOnlyMeta: () => false},
- "./attributeValue": {getAVTemplateInteractiveElement: () => null},
- "./coverPosition": {isCardCoverPositioning: () => false},
- "./row": {insertRows: (position: typeof insertions[number]) => insertions.push(position)},
- "./virtualScroll": {getAvBodyData: () => ({rows: [{id: "previous-row"}]})},
- "./calendar/state": {getCalendarCreationDate: () => undefined},
- "../../../constants": {Constants: {CUSTOM_SY_AV_VIEW: "custom-sy-av-view"}},
- "../../../util/escape": escape,
- "../../../dialog/message": {showMessage: (message: string) => messages.push(message)},
- "../../../util/fetch": {fetchPost: (url: string, payload: typeof requests[number], response: typeof callback) => {
- assert.equal(url, "/api/av/createAttributeViewItem");
- requests.push(payload);
- callback = response;
- }},
- "./render": {avRender: () => { rendered++; }},
- "./openDatabaseRow": {openDatabaseRowByData: (_protyle: unknown, record: typeof opened[number]) => opened.push(record)},
- });
- const context = {document, require: requireFixture(modules), window: {siyuan: {languages: {
- newItemTemplateUnavailableNotebookTip: "Unavailable notebook", untitled: "Untitled",
- }}}};
- const template = {} as typeof import("../newItemTemplate");
- runInNewContext(templateSource, {...context, exports: template});
- modules["./newItemTemplate"] = template;
- const action = {} as typeof import("../action");
- runInNewContext(actionSource, {...context, exports: action});
- const protyle = {app: {appId: "app"}, id: "editor", notebookId: "notebook", options: {}} as IProtyle;
- return {requests, opened, insertions, messages, protyle, block, rendered: () => rendered,
- click: () => action.avClick(protyle, {target: block.querySelector("span"), preventDefault() {}, stopPropagation() {}} as unknown as MouseEvent & {target: HTMLElement}),
- respond: (response: unknown = {code: 0, data: {itemID: "new-record", content: "New record", isDetached: true}}) => callback(response)};
-};
-
-for (const type of ["av-add-more", "av-add-bottom"]) {
- test(`map ${type} dispatches through avClick and opens created records with optional templates`, () => {
- for (const layout of ["map", "table"]) {
- for (const templateID of ["", "template-id"]) {
- const scenario = setup(type, layout, templateID);
- assert.equal(scenario.click(), true);
- assert.equal(scenario.opened.length, 0);
- if (layout === "table" && !templateID) {
- assert.equal(scenario.insertions.length, 1);
- assert.equal(scenario.requests.length, 0);
- assert.equal(scenario.insertions[0].previousID, type === "av-add-bottom" ? "previous-row" : "");
- } else {
- assert.equal(scenario.insertions.length, 0);
- assert.equal(scenario.requests.length, 1);
- const request = scenario.requests[0];
- assert.equal(request.templateID, templateID);
- assert.equal(request.previousID, type === "av-add-bottom" ? "previous-row" : "");
- assert.equal(request.groupID, "");
- assert.equal(request.avID, "database");
- assert.equal(request.blockID, "carrier");
- assert.equal(request.viewID, "view");
- scenario.respond();
- assert.equal(scenario.rendered(), 1);
- }
- assert.equal(scenario.opened.length, layout === "map" ? 1 : 0);
- if (layout === "map") {
- assert.equal(scenario.opened[0].itemID, "new-record");
- assert.equal(scenario.opened[0].focusPrimary, true);
- }
- }
- }
- });
-}
-
-test("disabled map creation actions cannot issue requests or insert records", () => {
- for (const type of ["av-add-more", "av-add-bottom"]) {
- const scenario = setup(type, "map");
- scenario.protyle.disabled = true;
- assert.equal(scenario.click(), false);
- assert.equal(scenario.requests.length, 0);
- assert.equal(scenario.insertions.length, 0);
- }
-});
-
-test("failed map record creation cannot open a detail and preserves unavailable-notebook feedback", () => {
- for (const unavailableNotebook of [false, true]) {
- const scenario = setup("av-add-more", "map", "template-id");
- scenario.click();
- scenario.respond({code: 1, data: {unavailableNotebook}});
- assert.equal(scenario.opened.length, 0);
- assert.deepEqual(scenario.messages, unavailableNotebook ? ["Unavailable notebook"] : []);
- assert.equal(scenario.rendered(), unavailableNotebook ? 0 : 1);
- }
-});
diff --git a/app/src/protyle/render/av/map/desktopTransport.test.ts b/app/src/protyle/render/av/map/desktopTransport.test.ts
deleted file mode 100644
index 41ea297ed0..0000000000
--- a/app/src/protyle/render/av/map/desktopTransport.test.ts
+++ /dev/null
@@ -1,557 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {webcrypto} from "node:crypto";
-import {describe, it} from "node:test";
-import * as ts from "typescript";
-import * as protocol from "./protocol";
-import * as loadingBudget from "./loadingBudget";
-import {getAVMapVisibility} from "./host";
-
-const source = readFileSync(__dirname + "/desktopTransport.ts", "utf8");
-const load = (ipc: unknown, browser = false, warnings: unknown[][] = []) => {
- // Exercise the same compile-time branches as webpack without importing Electron into Node.
- let keep = true;
- const code = source.split("\n").filter((line) => {
- if (line.includes("/// #if !BROWSER")) { keep = !browser; return false; }
- if (line.includes("/// #else")) { keep = browser; return false; }
- if (line.includes("/// #endif")) { keep = true; return false; }
- return keep;
- }).join("\n");
- const result: any = {};
- const requireModule = (name: string) => {
- if (name === "./protocol") { return protocol; }
- if (name === "./loadingBudget") { return loadingBudget; }
- if (name === "./host") { return {getAVMapVisibility}; }
- assert.equal(name, "electron");
- assert.equal(browser, false, "browser must not import Electron");
- return {ipcRenderer: ipc};
- };
- new Function("require", "exports", "console", ts.transpileModule(code, {
- compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2021},
- }).outputText)(requireModule, result, {warn: (...values: unknown[]) => warnings.push(values)});
- return result;
-};
-
-const fixture = (warnings: unknown[][] = [], origin = "http://127.0.0.1:6806", picking = false) => {
- const calls: Array<[string, any]> = [];
- const listeners = new Map<string, (...args: any[]) => void>();
- const domListeners = new Map<string, () => void>();
- const frames = new Map<number, () => void>();
- const timers = new Map<number, {callback: () => void; delay: number}>();
- let resolveCreate: (value: unknown) => void;
- let rejectCreate: (value: unknown) => void;
- let nextFrame = 0, nextTimer = 0;
- const ipc = {
- invoke: (name: string, value: unknown) => {
- calls.push([name, value]);
- return new Promise((resolve, reject) => { resolveCreate = resolve; rejectCreate = reject; });
- },
- send: (name: string, value: unknown) => calls.push([name, value]),
- on: (name: string, fn: (...args: any[]) => void) => listeners.set(name, fn),
- removeListener: (name: string) => listeners.delete(name),
- };
- const rect = {x: 10, y: 20, width: 400, height: 300, get left() { return this.x; }, get top() { return this.y; },
- get right() { return this.x + this.width; }, get bottom() { return this.y + this.height; }};
- const guests: Array<{tag: string; attributes: Map<string, string>; style: {cssText: string}; removed: boolean;
- setAttribute: (name: string, value: string) => void; remove: () => void}> = [];
- const attachments: unknown[] = [];
- const doc: any = {hidden: false, documentElement: {}, querySelectorAll: (): HTMLElement[] => [],
- elementFromPoint: () => container,
- createElement: (tag: string) => {
- const attributes = new Map<string, string>();
- const guest = {tag, attributes, style: {cssText: ""}, removed: false,
- setAttribute: (name: string, value: string) => attributes.set(name, value),
- remove: () => { guest.removed = true; }};
- guests.push(guest);
- return guest;
- },
- addEventListener: (name: string, fn: () => void) => domListeners.set(name, fn),
- removeEventListener: (name: string) => domListeners.delete(name)};
- const scope = {crypto: webcrypto, location: {origin},
- innerWidth: 1000, innerHeight: 800,
- setTimeout: (callback: () => void, delay: number) => {
- timers.set(++nextTimer, {callback, delay});
- return nextTimer;
- },
- clearTimeout: (id: number) => timers.delete(id),
- requestAnimationFrame: (fn: () => void) => { frames.set(++nextFrame, fn); return nextFrame; },
- cancelAnimationFrame: (id: number) => frames.delete(id),
- addEventListener: (name: string, fn: () => void) => domListeners.set(name, fn),
- removeEventListener: (name: string) => domListeners.delete(name),
- getComputedStyle: () => ({display: "block", visibility: "visible", opacity: "1", overflowX: "visible", overflowY: "visible",
- transform: "none", filter: "none", boxShadow: "none", outlineStyle: "none",
- getPropertyValue: () => ""})};
- doc.defaultView = scope;
- const container: any = {ownerDocument: doc, isConnected: true, parentElement: null, closest: (): HTMLElement | null => null,
- clientWidth: 400, clientHeight: 300, append: (guest: unknown) => attachments.push(guest),
- getClientRects: () => [rect], getBoundingClientRect: () => rect, contains: (target: unknown) => target === container || attachments.includes(target)};
- const errors: string[] = [], clicks: unknown[] = [], attributionClicks: string[] = [], pointClicks: unknown[] = [];
- let ready = 0;
- const api = load(ipc, false, warnings);
- const host = api.createDesktopAVMapHost(container, {provider: "openfreemap", theme: "light",
- onError: (value: string) => errors.push(value),
- onAttributionClick: (link: string) => attributionClicks.push(link),
- ...(picking && {onPointClick: (...args: unknown[]) => pointClicks.push(args)}),
- onMarkerClick: (...args: unknown[]) => clicks.push(args), onReady: () => ready++});
- const instanceID = calls[0][1].instanceID;
- return {host, calls, listeners, domListeners, frames, timers, errors, clicks, attributionClicks, pointClicks, doc, container, rect, guests, attachments,
- api, instanceID,
- ready: () => ready,
- reply: (value: object) => listeners.get("siyuan-map-reply")?.({}, {version: 1, instanceID, ...value}),
- rejected: async () => {
- rejectCreate(new Error("https://private.invalid/?key=secret"));
- await new Promise<void>((resolve) => setImmediate(resolve));
- },
- created: async (overrides: object = {}) => {
- resolveCreate({version: 1, instanceID, mode: "webview",
- src: `${origin}/stage/map/index.html?provider=openfreemap#${instanceID}:${"b".repeat(48)}`,
- partition: `siyuan-map-${"c".repeat(48)}`, ...overrides});
- await new Promise<void>((resolve) => setImmediate(resolve));
- },
- advance: () => {
- const pending = [...frames.values()];
- frames.clear();
- pending.forEach((fn) => fn());
- }};
-};
-
-describe("desktop map transport", () => {
- it("opts in once and passes only current visible coordinate selections to the parent", async () => {
- const oldResize = globalThis.ResizeObserver;
- globalThis.ResizeObserver = class { observe() {} disconnect() {} } as any;
- try {
- for (const picking of [false, true]) {
- const f = fixture([], "http://127.0.0.1:6806", picking);
- assert.equal(f.calls[0][1].picking, picking ? true : undefined);
- f.host.setPoints([], 1);
- await f.created();
- const point = {type: "pointClick", longitude: 121.4, latitude: 31.2, revision: 1};
- f.reply(point);
- assert.deepEqual(f.pointClicks, []);
- f.reply({type: "ready"});
- f.reply({...point, revision: 0});
- f.reply({...point, latitude: 90});
- f.doc.hidden = true; f.reply(point); f.doc.hidden = false;
- f.container.isConnected = false; f.reply(point); f.container.isConnected = true;
- assert.deepEqual(f.pointClicks, []);
- f.reply({...point, name: "private"});
- assert.deepEqual(f.pointClicks, picking ? [[{longitude: 121.4, latitude: 31.2}, 1]] : []);
- f.host.setPoints([], 2);
- f.reply(point);
- f.host.destroy();
- f.reply({...point, revision: 2});
- assert.equal(f.pointClicks.length, picking ? 1 : 0);
- }
- } finally {
- globalThis.ResizeObserver = oldResize;
- }
- });
- it("accepts only the fixed owner-origin map document and ephemeral webview partition", () => {
- const api = load({});
- const instanceID = "a".repeat(48);
- const origin = "http://127.0.0.1:6806";
- const src = `${origin}/stage/map/index.html?provider=openfreemap#${instanceID}:${"b".repeat(48)}`;
- const partition = `siyuan-map-${"c".repeat(48)}`;
- const valid = {version: 1, instanceID, mode: "webview", src, partition};
- assert.deepEqual(api.parseDesktopMapCreation(valid, instanceID, origin), {mode: "webview", src, partition});
- assert.equal(api.parseDesktopMapCreation({version: 1, instanceID, mode: "native"}, instanceID, origin), undefined);
- const invalidCreations: unknown[] = [null, [], {version: 1, instanceID}, {...valid, mode: "iframe"},
- {...valid, src: undefined}, {...valid, partition: undefined}, {...valid, preload: "/private/preload.js"},
- {...valid, mode: "native"}, {...valid, partition: "persist:" + partition}, {...valid, partition: "siyuan-map-other"},
- {...valid, src: src.replace(origin, "https://other.invalid")}, {...valid, src: src.replace("index.html", "../index.html")},
- {...valid, src: src.replace("provider=openfreemap", "provider=other")}, {...valid, src: src + "?extra"},
- {...valid, src: src.replace(instanceID, "d".repeat(48))}, {...valid, src: src.slice(0, -1)}];
- for (const value of invalidCreations) {
- assert.equal(api.parseDesktopMapCreation(value, instanceID, origin), undefined, JSON.stringify(value));
- }
- });
-
- for (const origin of ["http://127.0.0.1:6806", "https://notes.example.test"]) {
- it(`keeps the same webview through menus, scrolling and resize for ${origin}`, async () => {
- const oldMutation = globalThis.MutationObserver, oldResize = globalThis.ResizeObserver;
- let mutations = 0, resizes = 0, disconnects = 0;
- globalThis.MutationObserver = class {
- constructor() { mutations++; }
- observe() {}
- disconnect() {}
- } as any;
- globalThis.ResizeObserver = class {
- constructor() { resizes++; }
- observe() {}
- disconnect() { disconnects++; }
- } as any;
- const f = fixture([], origin);
- const src = `${f.doc.defaultView.location.origin}/stage/map/index.html?provider=openfreemap#${f.instanceID}:${"b".repeat(48)}`;
- const partition = `siyuan-map-${"c".repeat(48)}`;
- const command = () => f.calls.filter(([name, value]) => name === "siyuan-map-command" && value.type === "visibility").at(-1)?.[1];
- try {
- f.host.setPoints([{id: "row", longitude: 1, latitude: 2, name: "private"}], 1);
- f.host.setTheme("dark");
- await f.created({mode: "webview", src, partition});
- assert.equal(f.guests.length, 1);
- const guest = f.guests[0];
- assert.equal(guest.tag, "webview");
- assert.deepEqual([...guest.attributes], [["title", ""], ["partition", partition], ["src", src]]);
- assert.deepEqual(f.attachments, [guest]);
- assert.equal(mutations, 0, "webview composition must not install a stability/occlusion observer");
- assert.equal(resizes, 1);
- f.reply({type: "ready"});
- assert.equal(f.ready(), 1);
- assert.deepEqual(command().viewport, {x: 0, y: 0, width: 400, height: 300});
- const pointCommand = f.calls.find(([name, value]) => name === "siyuan-map-command" && value.type === "setPoints")[1];
- assert.equal(pointCommand.points[0].name, undefined);
- const themeCommand = f.calls.find(([name, value]) => name === "siyuan-map-command" && value.type === "theme")[1];
- assert.equal(themeCommand.theme, "dark");
- const scrim = {className: "av__panel", contains: () => false, getClientRects: () => [f.rect],
- getBoundingClientRect: () => f.rect};
- f.doc.querySelectorAll = () => [scrim];
- f.doc.elementFromPoint = () => scrim;
- f.advance();
- assert.equal(command().visible, false, "a full menu scrim suppresses attribution interaction only");
- assert.equal(guest.removed, false, "menus cannot detach or hide the guest map");
- assert.deepEqual([...guest.attributes], [["title", ""], ["partition", partition], ["src", src]]);
- f.doc.querySelectorAll = (): HTMLElement[] => [];
- f.doc.elementFromPoint = () => f.container;
- f.rect.y = -40;
- f.domListeners.get("scroll")();
- assert.equal(command().visible, true, "scrolling has no native settle delay");
- assert.deepEqual(command().viewport, {x: 0, y: 40, width: 400, height: 260});
- f.host.resize();
- assert.ok(f.calls.some(([name, value]) => name === "siyuan-map-command" && value.type === "resize"));
- assert.equal(f.calls.some(([name]) => name === "siyuan-map-geometry"), false);
- assert.equal(f.guests.length, 1);
- f.doc.hidden = true;
- f.domListeners.get("visibilitychange")();
- assert.equal(command().visible, false);
- f.host.destroy();
- assert.equal(guest.removed, true);
- assert.equal(disconnects, 1);
- assert.equal(f.frames.size, 0);
- assert.equal(f.listeners.size, 0);
- assert.equal(f.domListeners.size, 0);
- assert.deepEqual(f.errors, []);
- } finally {
- f.host.destroy();
- globalThis.MutationObserver = oldMutation;
- globalThis.ResizeObserver = oldResize;
- }
- });
- }
-
- it("dismisses existing menus only for fixed trusted-main signals from the live visible map", async () => {
- const oldResize = globalThis.ResizeObserver, oldWindow = globalThis.window;
- globalThis.ResizeObserver = class { observe() {} disconnect() {} } as any;
- let dismissed = 0;
- globalThis.window = {siyuan: {menus: {menu: {remove: () => dismissed++}}}} as any;
- const f = fixture();
- try {
- const src = `${f.doc.defaultView.location.origin}/stage/map/index.html?provider=openfreemap#${f.instanceID}:${"b".repeat(48)}`;
- await f.created({mode: "webview", src, partition: `siyuan-map-${"c".repeat(48)}`});
- f.reply({type: "dismissMenu"});
- assert.equal(dismissed, 0);
- f.reply({type: "ready"});
- f.reply({type: "dismissMenu", instanceID: "other"});
- f.reply({type: "dismissMenu", event: "click"});
- assert.equal(dismissed, 0);
- f.reply({type: "dismissMenu"});
- assert.equal(dismissed, 1);
- f.doc.hidden = true;
- f.reply({type: "dismissMenu"});
- f.doc.hidden = false;
- f.container.isConnected = false;
- f.reply({type: "dismissMenu"});
- f.host.destroy();
- f.reply({type: "dismissMenu"});
- assert.equal(dismissed, 1);
- } finally {
- f.host.destroy();
- globalThis.ResizeObserver = oldResize;
- globalThis.window = oldWindow;
- }
- });
-
- it("fails closed on missing modes and defers early ready callbacks until creation is validated", async () => {
- const invalidReplies: Array<Record<string, unknown>> = [
- {mode: undefined}, {mode: "other"}, {mode: "native"}, {src: undefined}, {partition: undefined},
- ];
- for (const invalid of invalidReplies) {
- const f = fixture();
- f.host.setPoints([{id: "row", longitude: 1, latitude: 2}], 1);
- f.reply({type: "ready"});
- assert.equal(f.ready(), 0);
- await f.created(invalid);
- assert.equal(f.ready(), 0);
- assert.deepEqual(f.errors, ["hostCreateInvalidResponse"]);
- assert.equal(f.guests.length, 0);
- assert.equal(f.calls.some(([name]) => name === "siyuan-map-command"), false);
- }
- const disposed = fixture();
- const src = `${disposed.doc.defaultView.location.origin}/stage/map/index.html?provider=openfreemap#${disposed.instanceID}:${"b".repeat(48)}`;
- disposed.host.destroy();
- await disposed.created({mode: "webview", src, partition: `siyuan-map-${"c".repeat(48)}`});
- assert.equal(disposed.guests.length, 0, "a late response cannot recreate a disposed guest");
- });
-
- it("forwards only ready current fixed attribution replies already verified by main", async () => {
- class Observer { observe() {} disconnect() {} }
- const oldMutation = globalThis.MutationObserver, oldResize = globalThis.ResizeObserver;
- globalThis.MutationObserver = Observer as any;
- globalThis.ResizeObserver = Observer as any;
- const f = fixture();
- try {
- f.reply({type: "attributionClick", link: "maplibre"});
- assert.deepEqual(f.attributionClicks, []);
- await f.created(); f.reply({type: "ready"});
- f.reply({type: "attributionClick", link: "maplibre", instanceID: "old"});
- f.reply({type: "attributionClick", link: "https://evil.invalid/"});
- f.reply({type: "attributionClick", link: "maplibre", url: "https://evil.invalid/"});
- assert.deepEqual(f.attributionClicks, ["maplibre"]);
- f.host.destroy();
- f.reply({type: "attributionClick", link: "maplibre"});
- assert.deepEqual(f.attributionClicks, ["maplibre"]);
- } finally {
- f.host.destroy();
- globalThis.MutationObserver = oldMutation;
- globalThis.ResizeObserver = oldResize;
- }
- });
-
- it("releases buffered commands only after validated creation and ready, and rejects stale marker replies", async () => {
- const oldResize = globalThis.ResizeObserver;
- globalThis.ResizeObserver = class { observe() {} disconnect() {} } as any;
- const f = fixture([], "https://notes.example.test");
- try {
- f.host.setPoints([{id: "row", latitude: 2, longitude: 1, name: "private"}], 1);
- f.host.setTheme("dark");
- f.host.resize();
- f.reply({type: "ready", instanceID: "old"});
- f.reply({type: "ready"});
- assert.equal(f.ready(), 0);
- assert.equal(f.calls.some(([name]) => name === "siyuan-map-command"), false);
- await f.created();
- assert.equal(f.ready(), 1);
- f.reply({type: "ready"});
- assert.equal(f.ready(), 1);
- const commands = f.calls.filter(([name]) => name === "siyuan-map-command").map(([, value]) => value);
- assert.deepEqual(commands.map(command => command.type), ["setPoints", "theme", "visibility"]);
- assert.equal(commands[0].points[0].name, undefined);
- assert.equal(commands[1].theme, "dark");
- assert.equal(commands[2].visible, true);
- assert.match(f.instanceID, /^[a-f0-9]{48}$/);
- assert.equal(f.calls[0][1].credentials, undefined);
- for (const mismatch of [{instanceID: "old"}, {revision: 0}, {id: "missing"}]) {
- f.reply({type: "markerClick", id: "row", revision: 1, ...mismatch});
- }
- assert.deepEqual(f.clicks, []);
- f.reply({type: "markerClick", id: "row", revision: 1});
- assert.deepEqual(f.clicks, [["row", 1]]);
- f.host.setPoints([], 2);
- f.host.setPoints([{id: "row", latitude: 2, longitude: 1}], 1);
- f.reply({type: "markerClick", id: "row", revision: 2});
- assert.equal(f.clicks.length, 1);
- f.host.destroy();
- const sent = f.calls.length;
- f.host.resize();
- f.host.setPoints([], 3);
- f.host.setTheme("light");
- f.reply({type: "markerClick", id: "row", revision: 1});
- f.advance();
- assert.equal(f.calls.length, sent);
- assert.equal(f.frames.size, 0);
- assert.equal(f.timers.size, 0);
- assert.equal(f.listeners.size, 0);
- assert.equal(f.domListeners.size, 0);
- assert.equal(f.guests[0].removed, true);
- } finally {
- f.host.destroy();
- globalThis.ResizeObserver = oldResize;
- }
- });
-
- it("updates attribution visibility through clipping, overlap, focus and hidden owners without changing the guest", async () => {
- const oldResize = globalThis.ResizeObserver;
- globalThis.ResizeObserver = class { observe() {} disconnect() {} } as any;
- const warnings: unknown[][] = [];
- const f = fixture(warnings, "https://notes.example.test");
- const visibility = () => f.calls.filter(([name, value]) => name === "siyuan-map-command" &&
- value.type === "visibility").at(-1)?.[1];
- try {
- await f.created();
- f.reply({type: "ready"});
- const guest = f.guests[0];
- const attributes = [...guest.attributes];
- const scroll = f.domListeners.get("scroll");
- const focus = f.domListeners.get("focus");
- assert.equal(f.domListeners.has("blur"), false);
- focus();
- assert.equal(visibility().visible, true);
- const menu = {contains: () => false, getClientRects: () => [f.rect],
- getBoundingClientRect: () => ({...f.rect, width: 5, height: 5})};
- f.doc.querySelectorAll = () => [menu];
- focus();
- assert.equal(visibility().visible, true, "a small menu leaves ordinary map composition active");
- assert.equal(visibility().viewport, undefined, "overlap suppresses attribution interaction");
- f.doc.querySelectorAll = (): unknown[] => [];
- f.doc.elementFromPoint = (_x: number, y: number) => y < 100 ? menu : f.container;
- scroll();
- assert.equal(visibility().visible, true);
- assert.equal(visibility().viewport, undefined, "partial unknown occlusion cannot authorize attribution");
- f.doc.elementFromPoint = () => menu;
- f.advance();
- assert.equal(visibility().visible, false);
- f.doc.elementFromPoint = () => f.container;
- for (let i = 0; i < 8; i++) {
- f.rect.y = -10 - i * 7;
- scroll();
- assert.equal(visibility().visible, true);
- assert.equal(visibility().viewport.y, -f.rect.y);
- }
- f.doc.hidden = true;
- f.domListeners.get("visibilitychange")();
- assert.equal(visibility().visible, false);
- f.doc.hidden = false;
- f.container.isConnected = false;
- focus();
- assert.equal(visibility().visible, false);
- f.container.isConnected = true;
- f.advance();
- assert.equal(visibility().visible, true);
- assert.deepEqual([...guest.attributes], attributes);
- assert.equal(guest.removed, false);
- assert.equal(f.guests.length, 1);
- assert.deepEqual(warnings, []);
- f.host.destroy();
- const sent = f.calls.length;
- scroll();
- focus();
- f.advance();
- assert.equal(f.calls.length, sent);
- } finally {
- f.host.destroy();
- globalThis.ResizeObserver = oldResize;
- }
- });
- it("preserves fixed creation failures and never logs rejected IPC details", async () => {
- for (const code of ["hostLimitReached", "hostSetupFailed", "hostAttachFailed"] as const) {
- const warnings: unknown[][] = [];
- const f = fixture(warnings);
- await f.created({error: code, details: "https://private.invalid/?key=secret"});
- assert.deepEqual(f.errors, [code]);
- assert.deepEqual(warnings, [["Database map failed:", code]]);
- assert.equal(f.timers.size, 0);
- }
- for (const response of [{version: 2}, {instanceID: "other"}, {error: "secret"}]) {
- const f = fixture();
- await f.created(response);
- assert.deepEqual(f.errors, ["hostCreateInvalidResponse"]);
- }
- const warnings: unknown[][] = [];
- const f = fixture(warnings);
- await f.rejected();
- assert.deepEqual(f.errors, ["hostCreateRejected"]);
- assert.deepEqual(warnings, [["Database map failed:", "hostCreateRejected"]]);
- assert.equal(f.listeners.size, 0);
- });
- it("lets main report a late SDK failure before the owner fallback and cleans the fallback", async () => {
- const f = fixture();
- assert.deepEqual([...f.timers.values()].map((timer) => timer.delay), [90000]);
- f.reply({type: "error", code: "hostSDKTimeout"});
- assert.deepEqual(f.errors, ["hostSDKTimeout"]);
- assert.equal(f.timers.size, 0);
- await f.created();
- assert.equal(f.frames.size, 0, "late create must not revive a failed host");
- const stalled = fixture();
- const callback = [...stalled.timers.values()][0].callback;
- callback();
- assert.deepEqual(stalled.errors, ["hostReadyTimeout"]);
- assert.equal(stalled.listeners.size, 0);
- assert.equal(stalled.timers.size, 0);
- await stalled.created();
- assert.equal(stalled.frames.size, 0);
- const disposed = fixture();
- const late = [...disposed.timers.values()][0].callback;
- disposed.host.destroy();
- late();
- assert.deepEqual(disposed.errors, []);
- });
- it("logs only allowlisted diagnostics for the current instance and ignores provider text", () => {
- const warnings: unknown[][] = [];
- const f = fixture(warnings);
- f.reply({type: "diagnostic", code: "cspWorker", detail: "https://secret.invalid/?key=private"});
- f.reply({type: "diagnostic", code: "https://secret.invalid/?key=private"});
- f.reply({type: "diagnostic", code: "cspScript", instanceID: "wrong"});
- assert.deepEqual(warnings, [["Database map diagnostic:", "cspWorker"]]);
- assert.deepEqual(f.errors, []);
- f.host.destroy();
- f.reply({type: "diagnostic", code: "cspScript"});
- assert.equal(warnings.length, 1);
- const {mapDiagnosticCodes} = require("../../../../../electron/mapHostDiagnostics");
- for (const code of mapDiagnosticCodes) assert.ok(source.includes(`"${code}"`));
- });
- it("validates CSP resource categories and never logs arbitrary resource values", () => {
- const warnings: unknown[][] = [];
- const f = fixture(warnings);
- const {mapCSPResourceCodes, mapCSPDiagnosticCodes} = require("../../../../../electron/mapHostDiagnostics");
- for (const resource of mapCSPResourceCodes) {
- f.reply({type: "diagnostic", code: "cspConnect", resource, detail: "private-token"});
- }
- assert.deepEqual(warnings, mapCSPResourceCodes.map((resource: string) => ["Database map diagnostic:", "cspConnect", resource]));
- for (const code of mapCSPDiagnosticCodes) assert.ok(source.includes(`"${code}"`));
- for (const resource of ["https://webapi.amap.com/?key=secret", "https:private.invalid", "private-token", null,
- {toString: () => "secret"}, ["blob"]]) {
- f.reply({type: "diagnostic", code: "cspConnect", resource});
- }
- f.reply({type: "diagnostic", code: "storageUnavailable", resource: "blob"});
- f.reply({type: "diagnostic", code: "cspWorker", resource: "blob", instanceID: "wrong"});
- assert.equal(warnings.length, mapCSPResourceCodes.length);
- f.host.destroy();
- f.reply({type: "diagnostic", code: "cspWorker", resource: "data"});
- assert.equal(warnings.length, mapCSPResourceCodes.length);
- assert.equal(JSON.stringify(warnings).includes("secret"), false);
- });
- it("deduplicates allowed resources and rejects arbitrary public hostnames", () => {
- const warnings: unknown[][] = [];
- const f = fixture(warnings);
- for (let i = 0; i < 100; i++) {
- f.reply({type: "diagnostic", code: "cspConnect", resource: "https:tiles.openfreemap.org"});
- f.reply({type: "diagnostic", code: "cspConnect", resource: "https:map" + i + ".invalid"});
- }
- assert.deepEqual(warnings, [["Database map diagnostic:", "cspConnect", "https:tiles.openfreemap.org"]]);
- f.host.destroy();
- });
- it("logs only approved capability reason codes and never exception or response details", async () => {
- for (const reason of ["ownerUnavailable", "notMainFrame", "notInitialized", "unregisteredOwner", "invalidKernelOrigin",
- "originMismatch", "unsupportedDocument", "invalidDocument", "unsafeProcessSwitches"]) {
- const warnings: unknown[][] = [];
- assert.equal(await load({invoke: async () => ({version: 1, supported: false, reason,
- url: "https://private.invalid/?token=secret", credentials: "secret"})}, false, warnings)
- .isDesktopAVMapHostSupported(), false);
- assert.deepEqual(warnings, [["Database map host unavailable:", reason]]);
- }
- const warnings: unknown[][] = [];
- assert.equal(await load({invoke: async () => ({version: 1, supported: false, reason: "secret"})}, false, warnings)
- .isDesktopAVMapHostSupported(), false);
- assert.equal(await load({invoke: async () => { throw new Error("secret"); }}, false, warnings)
- .isDesktopAVMapHostSupported(), false);
- assert.deepEqual(warnings, [["Database map host unavailable:", "unsupportedCapability"],
- ["Database map host unavailable:", "capabilityUnavailable"]]);
- const browserWarnings: unknown[][] = [];
- assert.equal(await load(undefined, true, browserWarnings).isDesktopAVMapHostSupported(), false);
- assert.deepEqual(browserWarnings, []);
- });
- it("fails closed for missing capability and omits Electron from browser compilation", async () => {
- assert.equal(await load(undefined, true).isDesktopAVMapHostSupported(), false);
- assert.equal(await load({invoke: async () => ({version: 1, supported: true})}).isDesktopAVMapHostSupported(), true);
- assert.equal(await load({invoke: async () => ({version: 2, supported: true})}).isDesktopAVMapHostSupported(), false);
- assert.equal(await load({invoke: async () => { throw new Error("old main"); }}).isDesktopAVMapHostSupported(), false);
- });
- it("destroys a create that resolves after disposal and never recreates listeners", async () => {
- const f = fixture();
- f.host.destroy();
- await f.created();
- assert.equal(f.calls.filter(([name]) => name === "siyuan-map-destroy").length, 2);
- assert.equal(f.listeners.size, 0);
- assert.equal(f.frames.size, 0);
- assert.deepEqual(f.errors, []);
- });
-});
diff --git a/app/src/protyle/render/av/map/desktopTransport.ts b/app/src/protyle/render/av/map/desktopTransport.ts
deleted file mode 100644
index a50409fc61..0000000000
--- a/app/src/protyle/render/av/map/desktopTransport.ts
+++ /dev/null
@@ -1,292 +0,0 @@
-/// #if !BROWSER
-import {ipcRenderer} from "electron";
-/// #endif
-import type {AVMapHost, AVMapHostOptions} from "./host";
-import {getAVMapVisibility} from "./host";
-import {AV_MAP_OWNER_TIMEOUT} from "./loadingBudget";
-import {
- AV_MAP_PROTOCOL_VERSION, AVMapCommand, AVMapErrorCode, AVMapPoint, isAVMapHostErrorCode, isAVMapProvider, isAVMapRevision,
- isAVMapTheme, parseAVMapReply, sanitizeAVMapPoints,
-} from "./protocol";
-
-const getIPC = () => {
- /// #if !BROWSER
- return ipcRenderer;
- /// #else
- return undefined;
- /// #endif
-};
-
-const capabilityFailureReasons = new Set([
- "ownerUnavailable", "notMainFrame", "notInitialized", "unregisteredOwner", "invalidKernelOrigin",
- "originMismatch", "unsupportedDocument", "invalidDocument", "unsafeProcessSwitches",
-]);
-
-const mapDiagnosticCodes = new Set([
- "hostSetupFailed", "assetUnavailable", "documentLoadFailed", "bootstrapTimeout", "sdkTimeout",
- "providerRequestDenied", "providerInsecureRequest", "providerHTTPFailure", "providerNetworkFailure",
- "cspScript", "cspWorker", "cspConnect", "cspImage", "cspStyle", "cspEval", "cspWasm",
- "storageUnavailable", "webglUnavailable",
-]);
-const mapCSPDiagnosticCodes = new Set(["cspScript", "cspWorker", "cspConnect", "cspImage", "cspStyle", "cspEval", "cspWasm"]);
-const mapCSPResourceCodes = new Set([
- "blob", "data", "inline", "eval", "wasm", "other",
- "owner-origin", "local-address", "redacted",
-]);
-const isMapCSPResource = (value: unknown): value is string => {
- if (typeof value !== "string" || value.length > 102) return false;
- if (mapCSPResourceCodes.has(value)) return true;
- return value === "https:tiles.openfreemap.org" || value === "http:tiles.openfreemap.org";
-};
-const logMapDiagnostic = (code: unknown, resource?: unknown) => {
- if (typeof code === "string" && mapDiagnosticCodes.has(code)) {
- if (resource === undefined) {
- console.warn("Database map diagnostic:", code);
- } else if (mapCSPDiagnosticCodes.has(code) && isMapCSPResource(resource)) {
- console.warn("Database map diagnostic:", code, resource);
- }
- }
-};
-
-type DesktopMapCreation = {mode: "webview"; src: string; partition: string};
-
-// 主进程只可返回固定地图文档和临时分区;不接受通用 webview 属性或其他导航目标。
-export const parseDesktopMapCreation = (value: unknown, instanceID: string, origin: string): DesktopMapCreation | undefined => {
- if (!/^[a-f0-9]{48}$/.test(instanceID) || !value || typeof value !== "object" || Array.isArray(value)) return;
- const reply = value as Record<string, unknown>;
- if (reply.version !== AV_MAP_PROTOCOL_VERSION || reply.instanceID !== instanceID) return;
- const keys = Object.keys(reply);
- if (reply.mode !== "webview" || keys.length !== 5 || typeof reply.src !== "string" ||
- typeof reply.partition !== "string" || !/^siyuan-map-[a-f0-9]{48}$/.test(reply.partition)) return;
- let owner: URL;
- try { owner = new URL(origin); } catch (_error) { return; }
- if (!/^https?:$/.test(owner.protocol) || owner.origin !== origin) return;
- const prefix = `${origin}/stage/map/index.html?provider=openfreemap#${instanceID}:`;
- if (!reply.src.startsWith(prefix) || !/^[a-f0-9]{48}$/.test(reply.src.substring(prefix.length))) return;
- return {mode: "webview", src: reply.src, partition: reply.partition};
-};
-
-export const isDesktopAVMapHostSupported = async (): Promise<boolean> => {
- const ipc = getIPC();
- if (!ipc) {
- return false;
- }
- try {
- const reply = await ipc.invoke("siyuan-map-capability");
- if (reply?.version === AV_MAP_PROTOCOL_VERSION && reply.supported === true) {
- return true;
- }
- // 主进程返回值也仅按固定码记录,避免日志输出任意异常、URL 或凭据。
- const reason = reply?.version === AV_MAP_PROTOCOL_VERSION && capabilityFailureReasons.has(reply.reason) ?
- reply.reason : "unsupportedCapability";
- console.warn("Database map host unavailable:", reason);
- } catch (_error) {
- console.warn("Database map host unavailable:", "capabilityUnavailable");
- }
- return false;
-};
-
-export const createDesktopAVMapHost = (container: HTMLElement, options: AVMapHostOptions): AVMapHost => {
- const scope = container.ownerDocument.defaultView;
- const ipc = getIPC();
- let destroyed = false, ready = false, created = false, pendingReady = false;
- let webview: HTMLElement;
- let instanceID = "", revision = -1, theme = options.theme;
- let points: AVMapPoint[] = [];
- let ids = new Set<string>();
- let frame = 0, timeout = 0;
- let lastVisibility = "";
- const diagnostics = new Set<string>();
- let resizeObserver: ResizeObserver;
- const envelope = () => ({version: AV_MAP_PROTOCOL_VERSION, instanceID} as const);
- const send = (command: AVMapCommand) => {
- if (!destroyed && ready) {
- ipc.send("siyuan-map-command", command);
- }
- };
- const updateVisibility = () => {
- if (destroyed) return;
- const next = ready ? getAVMapVisibility(container) : {visible: false};
- const key = JSON.stringify(next);
- if (key !== lastVisibility) {
- lastVisibility = key;
- send({...envelope(), type: "visibility", ...next});
- }
- };
- const invalidate = () => {
- if (!destroyed && scope) {
- updateVisibility();
- send({...envelope(), type: "resize"});
- }
- };
- const tick = () => {
- if (destroyed) {
- return;
- }
- updateVisibility();
- frame = scope.requestAnimationFrame(tick);
- };
- const destroy = () => {
- if (destroyed) {
- return;
- }
- destroyed = true;
- ready = false;
- if (instanceID) {
- ipc?.send("siyuan-map-destroy", envelope());
- }
- ipc?.removeListener("siyuan-map-reply", onReply);
- scope?.clearTimeout(timeout);
- scope?.cancelAnimationFrame(frame);
- scope?.removeEventListener("pagehide", destroy);
- scope?.removeEventListener("scroll", updateVisibility, true);
- scope?.removeEventListener("resize", invalidate);
- scope?.removeEventListener("focus", updateVisibility);
- container.ownerDocument.removeEventListener("visibilitychange", invalidate);
- resizeObserver?.disconnect();
- webview?.remove();
- points = [];
- ids.clear();
- };
- const fail = (code: AVMapErrorCode) => {
- if (!destroyed) {
- console.warn("Database map failed:", code);
- destroy();
- options.onError(code);
- }
- };
- const postPoints = () => {
- if (revision >= 0) {
- send({...envelope(), type: "setPoints", points, revision});
- }
- };
- const onReply = (_event: unknown, value: unknown) => {
- if (destroyed) {
- return;
- }
- const diagnostic = value as {version?: unknown; instanceID?: unknown; type?: unknown; code?: unknown; resource?: unknown};
- if (ready && diagnostic?.version === AV_MAP_PROTOCOL_VERSION &&
- diagnostic.instanceID === instanceID && diagnostic.type === "dismissMenu") {
- if (Object.keys(diagnostic).length === 3 && getAVMapVisibility(container).visible) {
- // 只消费主进程由真实 guest 鼠标输入产生的固定信号,不合成编辑器事件。
- window.siyuan.menus.menu.remove();
- }
- return;
- }
- if (diagnostic?.version === AV_MAP_PROTOCOL_VERSION && diagnostic.instanceID === instanceID && diagnostic.type === "diagnostic") {
- if (typeof diagnostic.code !== "string" || !mapDiagnosticCodes.has(diagnostic.code) ||
- diagnostic.resource !== undefined && (!mapCSPDiagnosticCodes.has(diagnostic.code) ||
- !isMapCSPResource(diagnostic.resource))) return;
- const key = diagnostic.code + ":" + (diagnostic.resource || "");
- if (diagnostics.has(key) || diagnostics.size >= 64) return;
- diagnostics.add(key);
- logMapDiagnostic(diagnostic.code, diagnostic.resource);
- return;
- }
- const reply = parseAVMapReply(value, instanceID);
- if (reply?.type === "ready" && !ready) {
- if (!created) {
- pendingReady = true;
- return;
- }
- ready = true;
- scope.clearTimeout(timeout);
- postPoints();
- send({...envelope(), type: "theme", theme});
- lastVisibility = "";
- updateVisibility();
- options.onReady?.();
- } else if (reply?.type === "markerClick" && ready && reply.revision === revision && ids.has(reply.id)) {
- options.onMarkerClick(reply.id, reply.revision);
- } else if (reply?.type === "pointClick" && ready && reply.revision === revision && revision >= 0 &&
- getAVMapVisibility(container).visible) {
- options.onPointClick?.({longitude: reply.longitude, latitude: reply.latitude}, reply.revision);
- } else if (reply?.type === "attributionClick" && ready) {
- // 主进程已校验 guest 可见区域,并消费一次可信用户输入。
- options.onAttributionClick?.(reply.link);
- } else if (reply?.type === "error") {
- fail(reply.code);
- }
- };
- const host: AVMapHost = {
- setPoints: (input, nextRevision) => {
- if (!destroyed && isAVMapRevision(nextRevision) && nextRevision > revision) {
- revision = nextRevision;
- points = sanitizeAVMapPoints(input);
- ids = new Set(points.map((point) => point.id));
- postPoints();
- }
- },
- resize: invalidate,
- setTheme: (nextTheme) => {
- if (!destroyed && isAVMapTheme(nextTheme)) {
- theme = nextTheme;
- send({...envelope(), type: "theme", theme});
- }
- },
- destroy,
- };
- if (!scope || !ipc) {
- queueMicrotask(() => fail("unsupportedEnvironment"));
- return host;
- }
- if (!isAVMapProvider(options.provider) || !isAVMapTheme(options.theme)) {
- queueMicrotask(() => fail("invalidConfiguration"));
- return host;
- }
- const start = async () => {
- const bytes = new Uint8Array(24);
- scope.crypto.getRandomValues(bytes);
- instanceID = Array.from(bytes, (value) => value.toString(16).padStart(2, "0")).join("");
- ipc.on("siyuan-map-reply", onReply);
- scope.addEventListener("pagehide", destroy, {once: true});
- // 主进程分别限制资源准备与地图就绪;此预算只处理主进程或 IPC 未能返回结果的情况。
- timeout = scope.setTimeout(() => fail("hostReadyTimeout"), AV_MAP_OWNER_TIMEOUT);
- let reply: {version?: number; instanceID?: string; error?: unknown; diagnostic?: unknown};
- try {
- reply = await ipc.invoke("siyuan-map-create", {...envelope(), provider: options.provider, theme,
- ...(options.onPointClick && {picking: true})});
- } catch (_error) {
- fail("hostCreateRejected");
- return;
- }
- // 创建可能在销毁后才完成;再次通知主进程,覆盖第一次销毁早于创建的情况。
- if (destroyed) {
- ipc.send("siyuan-map-destroy", envelope());
- return;
- }
- if (reply?.version !== AV_MAP_PROTOCOL_VERSION || reply.instanceID !== instanceID) {
- fail("hostCreateInvalidResponse");
- return;
- }
- if (reply.error) {
- logMapDiagnostic(reply?.diagnostic);
- fail(reply.error === "unsupportedEnvironment" ? "unsupportedEnvironment" :
- isAVMapHostErrorCode(reply.error) ? reply.error : "hostCreateInvalidResponse");
- return;
- }
- const creation = parseDesktopMapCreation(reply, instanceID, scope.location?.origin || "");
- if (!creation) {
- fail("hostCreateInvalidResponse");
- return;
- }
- created = true;
- webview = container.ownerDocument.createElement("webview");
- webview.setAttribute("title", options.title || "");
- webview.style.cssText = "width:100%;height:100%;border:0;display:flex";
- // 分区必须在 src 和连接 DOM 之前指定,主进程再次校验并强制安全偏好。
- webview.setAttribute("partition", creation.partition);
- webview.setAttribute("src", creation.src);
- container.append(webview);
- scope.addEventListener("scroll", updateVisibility, true);
- scope.addEventListener("resize", invalidate);
- scope.addEventListener("focus", updateVisibility);
- container.ownerDocument.addEventListener("visibilitychange", invalidate);
- resizeObserver = new ResizeObserver(invalidate);
- resizeObserver.observe(container);
- if (pendingReady) onReply(undefined, {...envelope(), type: "ready"});
- tick();
- };
- void start().catch(() => fail("hostOwnerSetupFailed"));
- return host;
-};
diff --git a/app/src/protyle/render/av/map/host.test.ts b/app/src/protyle/render/av/map/host.test.ts
deleted file mode 100644
index 5ba0cc0ee5..0000000000
--- a/app/src/protyle/render/av/map/host.test.ts
+++ /dev/null
@@ -1,249 +0,0 @@
-import * as assert from "node:assert/strict";
-import {webcrypto} from "node:crypto";
-import {afterEach, describe, it} from "node:test";
-import {createAVMapHost, getAVMapVisibility, isAVMapHostEnvironmentSupported} from "./host";
-import {isAVMapRuntimeIsolated} from "./hostRuntime";
-
-describe("map host boundary", () => {
- const cleanups: Array<() => void> = [];
- afterEach(() => { cleanups.splice(0).reverse().forEach((cleanup) => cleanup()); });
- it("preserves fixed preparation failures through the wrapper and strips unknown codes", async () => {
- for (const input of ["sdkScriptLoadFailed", "sdkGlobalMissing", "https://private.invalid/?token=secret"]) {
- const listeners = new Map<string, (event?: any) => void>();
- const failures: string[] = [];
- let removed = 0;
- const iframe = {src: "", style: {}, contentWindow: {postMessage() {}}, setAttribute() {},
- addEventListener() {}, remove() { removed++; }};
- const scope = {location: {protocol: "https:", origin: "https://fixture.invalid"},
- navigator: {userAgent: "Chromium"}, HTMLIFrameElement: {prototype: {}}, crypto: webcrypto,
- setTimeout: () => 1, clearTimeout() {}, cancelAnimationFrame() {},
- addEventListener: (name: string, listener: (event?: any) => void) => listeners.set(name, listener),
- removeEventListener: (name: string) => listeners.delete(name)};
- const container = {ownerDocument: {defaultView: scope, createElement: () => iframe,
- addEventListener() {}, removeEventListener() {}}, appendChild() {}};
- const host = createAVMapHost(container as unknown as HTMLElement, {provider: "openfreemap", theme: "light",
- onMarkerClick() {}, onError: code => failures.push(code)});
- cleanups.push(host.destroy);
- await new Promise<void>(resolve => setImmediate(resolve));
- const [instanceID, nonce] = iframe.src.split("#")[1].split(":");
- const receive = listeners.get("message");
- const data = {version: 1, instanceID, nonce, type: "wrapperHello"};
- const event = {source: iframe.contentWindow, origin: scope.location.origin, ports: [] as MessagePort[], data};
- receive({...event, data: Object.assign([], data)});
- receive(event);
- receive({...event, data: {...data, type: "bootstrapError", code: input, message: "secret"}});
- assert.deepEqual(failures, [input.startsWith("sdk") ? input : "hostBootstrapFailed"]);
- assert.equal(removed, 1);
- receive({...event, data: {...data, type: "bootstrapError", code: input}});
- assert.equal(failures.length, 1);
- }
- });
- it("fails closed for Electron and unguarded native bridges but does not require credentialless", async () => {
- const browser = {location: {protocol: "http:"}, navigator: {userAgent: "Chromium"},
- HTMLIFrameElement: {prototype: {credentialless: false}}};
- assert.equal(await isAVMapHostEnvironmentSupported(browser as unknown as Window), true);
- for (const unsafe of [{require() {}}, {process: {}}, {webkit: {messageHandlers: {}}}, {JSAndroid: {}},
- {Android: {}}, {Harmony: {}}, {JSHarmony: {}}, {location: {protocol: "file:"}}, {navigator: {userAgent: "Electron/44"}},
- {HTMLIFrameElement: undefined as unknown}]) {
- assert.equal(await isAVMapHostEnvironmentSupported({...browser, ...unsafe,
- setTimeout, clearTimeout} as unknown as Window), false);
- }
- assert.equal(await isAVMapHostEnvironmentSupported({...browser,
- HTMLIFrameElement: {prototype: {}}} as unknown as Window), true);
- assert.equal(isAVMapRuntimeIsolated({parent: {document: {}}} as Window), false);
- const isolated = {origin: "null", credentialless: true,
- parent: Object.defineProperty({}, "document", {get() { throw new Error("sandbox"); }})};
- assert.equal(isAVMapRuntimeIsolated(isolated as unknown as Window), true);
- assert.equal(isAVMapRuntimeIsolated({...isolated, require() {}} as unknown as Window), false);
- assert.equal(isAVMapRuntimeIsolated({...isolated, JSAndroid: {}} as unknown as Window), false);
- assert.equal(isAVMapRuntimeIsolated({...isolated, JSHarmony: {}} as unknown as Window), false);
- assert.equal(isAVMapRuntimeIsolated({...isolated, origin: "https://app.invalid"} as unknown as Window), false);
- assert.equal(isAVMapRuntimeIsolated({...isolated, credentialless: false} as unknown as Window), true);
- assert.equal(isAVMapRuntimeIsolated({...isolated, credentialless: undefined} as unknown as Window), true);
- assert.equal(isAVMapRuntimeIsolated({...isolated, JSHarmony: {}} as unknown as Window, true), true);
- });
- it("binds one exact wrapper and nonce, waits for locked bootstrap, and discards stale replies", async () => {
- const channels: any[] = [];
- const original = globalThis.MessageChannel;
- class Port {
- onmessage: (event: {data: unknown}) => void;
- messages: any[] = [];
- closed = false;
- postMessage(data: unknown) { this.messages.push(data); }
- start() {}
- close() { this.closed = true; }
- }
- globalThis.MessageChannel = class {
- port1 = new Port();
- port2 = new Port();
- constructor() { channels.push(this); }
- } as any;
- cleanups.push(() => { globalThis.MessageChannel = original; });
- const attributes: Record<string, string> = {};
- const listeners = new Map<string, (event?: unknown) => void>();
- const transfers: any[] = [];
- const timers = new Map<number, {callback: () => void; delay: number}>();
- let nextTimer = 0;
- const iframe = {
- src: "", style: {}, removed: false, credentialless: false,
- contentWindow: {postMessage: (...args: any[]) => transfers.push(args)},
- setAttribute: (name: string, value: string) => { attributes[name] = value; },
- addEventListener() {}, remove() { iframe.removed = true; },
- };
- const scope = {
- location: {protocol: "https:", origin: "https://fixture.invalid"},
- navigator: {userAgent: "Chromium", userActivation: {isActive: true}}, crypto: webcrypto,
- innerWidth: 1000, innerHeight: 800,
- getComputedStyle: () => ({display: "block", visibility: "visible", opacity: "1", getPropertyValue: () => ""}),
- requestAnimationFrame: () => 1, cancelAnimationFrame() {},
- HTMLIFrameElement: {prototype: {credentialless: false}},
- clearTimeout(id: number) { timers.delete(id); },
- setTimeout(callback: () => void, delay: number) {
- timers.set(++nextTimer, {callback, delay});
- return nextTimer;
- },
- addEventListener: (name: string, listener: (event?: unknown) => void) => listeners.set(name, listener),
- removeEventListener: (name: string) => listeners.delete(name),
- };
- const rect = {left: 0, top: 0, right: 400, bottom: 300, width: 400, height: 300};
- const doc = {defaultView: scope, createElement: () => iframe, hidden: false,
- elementFromPoint: () => iframe, querySelectorAll: (): HTMLElement[] => [], addEventListener() {}, removeEventListener() {}};
- const container = {ownerDocument: doc, appendChild() {}, isConnected: true, clientWidth: 400, clientHeight: 300,
- getClientRects: () => [rect],
- getBoundingClientRect: () => rect, contains: (element: unknown) => element === iframe};
- let ready = 0;
- const clicked: any[] = [];
- const pointsClicked: any[] = [];
- const links: string[] = [];
- const host = createAVMapHost(container as unknown as HTMLElement, {
- provider: "openfreemap", theme: "light",
- onReady: () => ready++, onMarkerClick: (...args) => clicked.push(args), onError: () => assert.fail("unexpected error"),
- onAttributionClick: link => links.push(link),
- onPointClick: (...args) => pointsClicked.push(args),
- });
- cleanups.push(host.destroy);
- await new Promise<void>((resolve) => setImmediate(resolve));
- assert.deepEqual([...timers.values()].map((timer) => timer.delay), [30000]);
- assert.equal(attributes.sandbox, "allow-scripts allow-same-origin");
- assert.equal(iframe.credentialless, true);
- assert.equal(iframe.src.split("#")[0], "/stage/map/wrapper.html?provider=openfreemap");
- const [instanceID, nonce] = iframe.src.split("#")[1].split(":");
- const onMessage = listeners.get("message");
- const handshake = {source: iframe.contentWindow, origin: scope.location.origin, ports: [] as unknown[],
- data: {version: 1, type: "wrapperHello", instanceID, nonce}};
- const point = {id: "row-1", longitude: 0, latitude: 0};
- host.setPoints([{...point, title: "private"} as any], 1);
- onMessage({...handshake, source: {}});
- onMessage({...handshake, origin: "https://attacker.invalid"});
- onMessage({...handshake, data: {...handshake.data, nonce: "old"}});
- assert.equal(channels.length, 0);
- onMessage({...handshake, data: {...handshake.data, type: "bootstrapReady"}});
- assert.equal(channels.length, 0);
- onMessage(handshake);
- assert.equal(channels.length, 0);
- assert.deepEqual(transfers[0][0], {version: 1, instanceID, nonce, type: "prepare", nativeBoundary: false});
- onMessage({...handshake, data: {...handshake.data, type: "bootstrapReady"}});
- assert.equal(channels.length, 1);
- assert.deepEqual([...timers.values()].map((timer) => timer.delay), [45000],
- "locked assets start a separate finite budget for map creation and readiness");
- assert.equal(listeners.has("message"), false);
- onMessage(handshake);
- assert.equal(channels.length, 1);
- assert.equal(transfers.length, 2);
- const port = channels[0].port1 as Port;
- assert.deepEqual(port.messages[0], {version: 1, instanceID, type: "init", provider: "openfreemap",
- theme: "light", picking: true});
- const reply = (data: Record<string, unknown>) => port.onmessage({data: {version: 1, instanceID, ...data}});
- reply({type: "attributionClick", link: "maplibre"});
- assert.equal(links.length, 0);
- reply({type: "ready", instanceID: "old"});
- assert.equal(ready, 0);
- reply({type: "ready"});
- reply({type: "ready"});
- assert.equal(timers.size, 0, "ready clears the SDK deadline");
- assert.equal(ready, 1);
- reply({type: "attributionClick", link: "maplibre", instanceID: "old"});
- reply({type: "attributionClick", link: "https://evil.invalid/"});
- scope.navigator.userActivation.isActive = false;
- reply({type: "attributionClick", link: "maplibre"});
- scope.navigator.userActivation.isActive = true;
- doc.hidden = true; reply({type: "attributionClick", link: "maplibre"}); doc.hidden = false;
- assert.equal(links.length, 0);
- rect.top = -100;
- reply({type: "attributionClick", link: "maplibre"});
- assert.deepEqual(links, ["maplibre"], "visible attribution remains clickable when the map top is cropped");
- assert.deepEqual(port.messages.find((message) => message.type === "setPoints").points, [point]);
- assert.equal(port.messages.some((message) => message.type === "fit"), false);
- reply({type: "markerClick", id: "row-1", revision: 0});
- reply({type: "markerClick", id: "missing", revision: 1});
- reply({type: "markerClick", id: "row-1", revision: 1});
- assert.deepEqual(clicked, [["row-1", 1]]);
- reply({type: "pointClick", longitude: 0, latitude: 0, revision: 0});
- scope.navigator.userActivation.isActive = false;
- reply({type: "pointClick", longitude: 0, latitude: 0, revision: 1});
- scope.navigator.userActivation.isActive = true;
- doc.hidden = true;
- reply({type: "pointClick", longitude: 0, latitude: 0, revision: 1});
- doc.hidden = false;
- assert.equal(pointsClicked.length, 0);
- reply({type: "pointClick", longitude: 0, latitude: 0, revision: 1, name: "private"});
- assert.deepEqual(pointsClicked, [[{longitude: 0, latitude: 0}, 1]]);
- host.setPoints([], 2);
- reply({type: "pointClick", longitude: 0, latitude: 0, revision: 1});
- assert.equal(pointsClicked.length, 1);
- reply({type: "markerClick", id: "row-1", revision: 1});
- reply({type: "markerClick", id: "row-1", revision: 2});
- assert.equal(clicked.length, 1);
- const lateReply = port.onmessage;
- host.destroy();
- assert.equal(iframe.removed, true);
- assert.equal(port.closed, true);
- lateReply({data: {version: 1, instanceID, type: "markerClick", id: "row-1", revision: 2}});
- lateReply({data: {version: 1, instanceID, type: "attributionClick", link: "maplibre"}});
- assert.equal(links.length, 1);
- assert.equal(clicked.length, 1);
- });
- it("does not create a frame after destruction while an asynchronous native report is pending", async () => {
- let finish: (value: unknown) => void;
- const scope = {location: {protocol: "http:"}, navigator: {userAgent: "SiYuanAndroid"}, JSAndroid: {},
- HTMLIFrameElement: {prototype: {}}, setTimeout, clearTimeout, removeEventListener() {},
- getAVMapNativeBoundary: () => new Promise((resolve) => { finish = resolve; })};
- const container = {ownerDocument: {defaultView: {...scope, cancelAnimationFrame() {}}, removeEventListener() {},
- createElement: () => assert.fail("late native response must not create an iframe")}};
- const host = createAVMapHost(container as unknown as HTMLElement, {provider: "openfreemap", theme: "light",
- onMarkerClick() {}, onError: () => assert.fail("destroyed host must not emit errors")});
- await Promise.resolve();
- host.destroy();
- finish({version: 1, enabled: true});
- await new Promise<void>((resolve) => setImmediate(resolve));
- });
- it("distinguishes partial visibility from safe attribution display time and checks clipping", () => {
- const rect = {left: 10, top: -10, right: 410, bottom: 290, width: 400, height: 300};
- const style = {display: "block", visibility: "visible", opacity: "1", overflowX: "visible", overflowY: "visible",
- getPropertyValue: () => ""};
- const doc: any = {hidden: false, defaultView: {innerWidth: 800, innerHeight: 600, getComputedStyle: () => style},
- elementFromPoint: () => container, querySelectorAll: (): HTMLElement[] => []};
- const container: any = {ownerDocument: doc, isConnected: true, clientWidth: 400, clientHeight: 300, getClientRects: () => [rect],
- getBoundingClientRect: () => rect, contains: (element: unknown) => element === container};
- assert.deepEqual(getAVMapVisibility(container), {visible: true, viewport: {x: 0, y: 10, width: 400, height: 290}});
- rect.top = 10;
- rect.bottom = 310;
- assert.equal(getAVMapVisibility(container).visible, true);
- doc.hidden = true; assert.equal(getAVMapVisibility(container).visible, false); doc.hidden = false;
- style.opacity = "0"; assert.equal(getAVMapVisibility(container).visible, false); style.opacity = "1";
- doc.elementFromPoint = () => ({}); assert.equal(getAVMapVisibility(container).visible, false);
- doc.elementFromPoint = () => container;
- rect.width = 800; rect.right = 810; rect.height = 600; rect.bottom = 610;
- assert.deepEqual(getAVMapVisibility(container), {visible: true, viewport: {x: 0, y: 0, width: 395, height: 295}},
- "parent CSS scaling is removed before forwarding iframe viewport coordinates");
- container.parentElement = {parentElement: null, clientLeft: 0, clientTop: 0, clientWidth: 350, clientHeight: 500,
- offsetWidth: 350, offsetHeight: 500, getBoundingClientRect: () => ({left: 20, top: 30, width: 350, height: 500})};
- style.overflowX = "hidden"; style.overflowY = "scroll";
- assert.deepEqual(getAVMapVisibility(container), {visible: true, viewport: {x: 5, y: 10, width: 175, height: 250}},
- "ancestor scroll clipping is converted in the same coordinate system");
- doc.querySelectorAll = () => [{contains: () => false, getClientRects: () => [{}],
- getBoundingClientRect: () => ({left: 100, right: 120, top: 250, bottom: 270, width: 20, height: 20})}];
- assert.deepEqual(getAVMapVisibility(container), {visible: true},
- "a small parent overlay blocks counting even when it misses every sampled point");
- });
-});
diff --git a/app/src/protyle/render/av/map/host.ts b/app/src/protyle/render/av/map/host.ts
deleted file mode 100644
index a7ef39a79e..0000000000
--- a/app/src/protyle/render/av/map/host.ts
+++ /dev/null
@@ -1,282 +0,0 @@
-import {
- AV_MAP_PROTOCOL_VERSION, AVMapAttributionLink, AVMapCommand, AVMapCoordinate, AVMapErrorCode, AVMapPoint, AVMapProvider, AVMapTheme, AVMapVisibility,
- isAVMapBootstrapMessage, isAVMapLoadErrorCode, isAVMapProvider, isAVMapRevision, isAVMapTheme, parseAVMapReply,
- sanitizeAVMapPoints,
-} from "./protocol";
-import {getAVMapHostCapabilities} from "./hostCapabilities";
-import {AV_MAP_BOOTSTRAP_TIMEOUT, AV_MAP_HOST_READY_TIMEOUT} from "./loadingBudget";
-
-export interface AVMapHostOptions {
- provider: AVMapProvider;
- theme: AVMapTheme;
- title?: string;
- onReady?: () => void;
- onMarkerClick: (id: string, revision: number) => void;
- onPointClick?: (point: AVMapCoordinate, revision: number) => void;
- onError: (code: AVMapErrorCode) => void;
- onAttributionClick?: (link: AVMapAttributionLink) => void;
-}
-
-export interface AVMapHost {
- setPoints: (points: AVMapPoint[], revision: number) => void;
- resize: () => void;
- setTheme: (theme: AVMapTheme) => void;
- destroy: () => void;
-}
-
-export const isAVMapHostEnvironmentSupported = async (scope: Window = window): Promise<boolean> =>
- (await getAVMapHostCapabilities(scope)).supported;
-
-const randomID = (scope: Window): string => {
- const bytes = new Uint8Array(24);
- scope.crypto.getRandomValues(bytes);
- return Array.from(bytes, (value) => value.toString(16).padStart(2, "0")).join("");
-};
-
-// 将父页面裁剪区域换算为隔离 iframe 视口的 CSS 像素。
-export const getAVMapVisibility = (container: HTMLElement): AVMapVisibility => {
- const doc = container.ownerDocument;
- const scope = doc.defaultView;
- const hidden = {visible: false};
- if (!scope || doc.hidden || !container.isConnected || !container.getClientRects().length) return hidden;
- const rect = container.getBoundingClientRect();
- if (rect.width <= 0 || rect.height <= 0 || container.clientWidth <= 0 || container.clientHeight <= 0) return hidden;
- let left = Math.max(0, rect.left), top = Math.max(0, rect.top);
- let right = Math.min(scope.innerWidth, rect.right), bottom = Math.min(scope.innerHeight, rect.bottom);
- for (let element = container; element; element = element.parentElement) {
- const style = scope.getComputedStyle(element);
- if (style.display === "none" || style.visibility !== "visible" || Number(style.opacity) === 0 ||
- style.getPropertyValue("content-visibility") === "hidden") return hidden;
- if (element !== container) {
- const clip = element.getBoundingClientRect();
- const scaleX = element.offsetWidth ? clip.width / element.offsetWidth : 1;
- const scaleY = element.offsetHeight ? clip.height / element.offsetHeight : 1;
- if (/hidden|clip|scroll|auto/.test(style.overflowX)) {
- const x = clip.left + element.clientLeft * scaleX;
- left = Math.max(left, x); right = Math.min(right, x + element.clientWidth * scaleX);
- }
- if (/hidden|clip|scroll|auto/.test(style.overflowY)) {
- const y = clip.top + element.clientTop * scaleY;
- top = Math.max(top, y); bottom = Math.min(bottom, y + element.clientHeight * scaleY);
- }
- }
- }
- if (right - left < 2 || bottom - top < 2) return hidden;
- const hits = [left + 0.5, (left + right) / 2, right - 0.5].flatMap(x =>
- [top + 0.5, (top + bottom) / 2, bottom - 0.5].map(y => container.contains(doc.elementFromPoint(x, y))));
- if (!hits.some(Boolean)) return hidden;
- if (!hits.every(Boolean)) return {visible: true};
- // 内层无法命中检测父页面浮层;小浮层也可能遮住署名而避开上面的采样点。
- const overlays = doc.querySelectorAll<HTMLElement>(
- ".b3-menu, .b3-dialog, .av__panel, .protyle-util, .protyle-toolbar, .block__popover, [popover]");
- for (const overlay of Array.from(overlays)) {
- if (overlay.contains(container) || !overlay.getClientRects().length) continue;
- const style = scope.getComputedStyle(overlay);
- const bounds = overlay.getBoundingClientRect();
- if (style.display !== "none" && style.visibility === "visible" && Number(style.opacity) !== 0 &&
- bounds.width > 0 && bounds.height > 0 && bounds.left < right && bounds.right > left &&
- bounds.top < bottom && bounds.bottom > top) return {visible: true};
- }
- const scaleX = rect.width / container.clientWidth, scaleY = rect.height / container.clientHeight;
- return {visible: true, viewport: {x: (left - rect.left) / scaleX, y: (top - rect.top) / scaleY,
- width: (right - left) / scaleX, height: (bottom - top) / scaleY}};
-};
-
-export const createAVMapHost = (container: HTMLElement, options: AVMapHostOptions): AVMapHost => {
- const scope = container.ownerDocument.defaultView;
- let destroyed = false;
- let ready = false;
- let port: MessagePort;
- let iframe: HTMLIFrameElement;
- let timeout: number;
- let observer: ResizeObserver;
- let revision = -1;
- let points: AVMapPoint[] = [];
- let ids = new Set<string>();
- let theme = options.theme;
- let instanceID = "";
- let nonce = "";
- let nativeBoundary = false;
- let preparing = false;
- let frame = 0, visible = false, lastVisibility = "";
-
- const send = (command: AVMapCommand) => {
- if (!destroyed && port) {
- port.postMessage(command);
- }
- };
- const envelope = () => ({version: AV_MAP_PROTOCOL_VERSION, instanceID} as const);
- const updateVisibility = () => {
- const next = ready ? getAVMapVisibility(container) : {visible: false};
- const key = JSON.stringify(next);
- if (key !== lastVisibility) {
- visible = next.visible;
- lastVisibility = key;
- send({...envelope(), type: "visibility", ...next});
- }
- };
- const tickVisibility = () => {
- if (destroyed) return;
- updateVisibility();
- frame = scope.requestAnimationFrame(tickVisibility);
- };
- const destroy = () => {
- if (destroyed) {
- return;
- }
- send({...envelope(), type: "destroy"});
- destroyed = true;
- ready = false;
- scope?.clearTimeout(timeout);
- scope?.cancelAnimationFrame(frame);
- scope?.removeEventListener("message", onMessage);
- scope?.removeEventListener("pagehide", destroy);
- container.ownerDocument.removeEventListener("visibilitychange", updateVisibility);
- observer?.disconnect();
- if (port) {
- port.onmessage = null;
- port.close();
- }
- iframe?.remove();
- points = [];
- ids.clear();
- };
- const fail = (code: AVMapErrorCode) => {
- if (destroyed) {
- return;
- }
- destroy();
- options.onError(code);
- };
- const postPoints = () => {
- if (ready && revision >= 0) {
- send({...envelope(), type: "setPoints", points, revision});
- }
- };
- const onMessage = (event: MessageEvent) => {
- if (destroyed || port || event.source !== iframe?.contentWindow || event.origin !== scope.location.origin ||
- event.ports.length !== 0) {
- return;
- }
- if (!preparing && isAVMapBootstrapMessage(event.data, "wrapperHello", instanceID, nonce)) {
- preparing = true;
- iframe.contentWindow.postMessage({...envelope(), type: "prepare", nonce, nativeBoundary}, scope.location.origin);
- return;
- }
- if (preparing && isAVMapBootstrapMessage(event.data, "bootstrapError", instanceID, nonce)) {
- fail(isAVMapLoadErrorCode(event.data.code) ? event.data.code : "hostBootstrapFailed");
- return;
- }
- if (!preparing || !isAVMapBootstrapMessage(event.data, "bootstrapReady", instanceID, nonce)) {
- return;
- }
- scope.removeEventListener("message", onMessage);
- // 打包资源和 CSP 已准备完成;此预算仅保护后续地图创建与 load 就绪。
- scope.clearTimeout(timeout);
- timeout = scope.setTimeout(() => fail("hostSDKTimeout"), AV_MAP_HOST_READY_TIMEOUT);
- const channel = new MessageChannel();
- port = channel.port1;
- port.onmessage = (replyEvent) => {
- if (destroyed) {
- return;
- }
- const reply = parseAVMapReply(replyEvent.data, instanceID);
- if (reply?.type === "ready" && !ready) {
- ready = true;
- scope.clearTimeout(timeout);
- postPoints();
- send({...envelope(), type: "theme", theme});
- options.onReady?.();
- tickVisibility();
- } else if (reply?.type === "markerClick" && ready && reply.revision === revision && ids.has(reply.id)) {
- options.onMarkerClick(reply.id, reply.revision);
- } else if (reply?.type === "pointClick" && ready && reply.revision === revision && revision >= 0 &&
- options.onPointClick && visible && getAVMapVisibility(container).visible &&
- (scope.navigator as Navigator & {userActivation?: {isActive: boolean}}).userActivation?.isActive) {
- options.onPointClick({longitude: reply.longitude, latitude: reply.latitude}, reply.revision);
- } else if (reply?.type === "attributionClick" && ready && visible &&
- getAVMapVisibility(container).visible &&
- (scope.navigator as Navigator & {userActivation?: {isActive: boolean}}).userActivation?.isActive) {
- options.onAttributionClick?.(reply.link);
- } else if (reply?.type === "error") {
- fail(reply.code);
- }
- };
- port.start();
- iframe.contentWindow.postMessage({...envelope(), type: "connect", nonce}, scope.location.origin, [channel.port2]);
- // 端口建立后清除全局监听;地图初始化期间不再接受窗口消息。
- send({...envelope(), type: "init", provider: options.provider, theme,
- ...(options.onPointClick && {picking: true})});
- };
-
- const host: AVMapHost = {
- setPoints: (input, nextRevision) => {
- if (destroyed || !isAVMapRevision(nextRevision) || nextRevision <= revision) {
- return;
- }
- revision = nextRevision;
- points = sanitizeAVMapPoints(input);
- ids = new Set(points.map((point) => point.id));
- postPoints();
- },
- resize: () => {
- if (ready) {
- send({...envelope(), type: "resize"});
- }
- },
- setTheme: (nextTheme) => {
- if (!isAVMapTheme(nextTheme)) {
- return;
- }
- theme = nextTheme;
- if (ready) {
- send({...envelope(), type: "theme", theme});
- }
- },
- destroy,
- };
- if (!scope) {
- queueMicrotask(() => fail("unsupportedEnvironment"));
- return host;
- }
- if (!isAVMapProvider(options.provider) || !isAVMapTheme(options.theme)) {
- queueMicrotask(() => fail("invalidConfiguration"));
- return host;
- }
- const start = async () => {
- const capabilities = await getAVMapHostCapabilities(scope);
- if (destroyed) {
- return;
- }
- if (!capabilities.supported) {
- fail("unsupportedEnvironment");
- return;
- }
- nativeBoundary = capabilities.nativeBoundary;
- instanceID = randomID(scope);
- nonce = randomID(scope);
- iframe = container.ownerDocument.createElement("iframe");
- if (capabilities.credentialless) {
- (iframe as HTMLIFrameElement & {credentialless: boolean}).credentialless = true;
- }
- // 此层只包含固定的可信本地代码;加载 SDK 的内层绝不获得 allow-same-origin。
- iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
- iframe.setAttribute("allow", "geolocation 'none'; camera 'none'; microphone 'none'; clipboard-read 'none'; clipboard-write 'none'");
- iframe.referrerPolicy = "no-referrer";
- iframe.title = options.title || "";
- iframe.style.cssText = "width:100%;height:100%;border:0;display:block";
- iframe.src = `/stage/map/wrapper.html?provider=${options.provider}#${instanceID}:${nonce}`;
- iframe.addEventListener("error", () => fail("hostDocumentLoadFailed"), {once: true});
- scope.addEventListener("message", onMessage);
- scope.addEventListener("pagehide", destroy, {once: true});
- container.ownerDocument.addEventListener("visibilitychange", updateVisibility);
- timeout = scope.setTimeout(() => fail("hostBootstrapTimeout"), AV_MAP_BOOTSTRAP_TIMEOUT);
- container.appendChild(iframe);
- if (typeof ResizeObserver !== "undefined") {
- observer = new ResizeObserver(host.resize);
- observer.observe(container);
- }
- };
- void start().catch(() => fail("hostUnavailable"));
- return host;
-};
diff --git a/app/src/protyle/render/av/map/hostCapabilities.test.ts b/app/src/protyle/render/av/map/hostCapabilities.test.ts
deleted file mode 100644
index 7c1f7e1b74..0000000000
--- a/app/src/protyle/render/av/map/hostCapabilities.test.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import * as assert from "node:assert/strict";
-import {describe, it} from "node:test";
-import {getAVMapHostCapabilities} from "./hostCapabilities";
-
-const browser = () => ({location: {protocol: "https:"}, navigator: {userAgent: "WebKit"},
- HTMLIFrameElement: {prototype: {}}, setTimeout, clearTimeout});
-
-describe("shared map host capabilities", () => {
- it("supports a plain HTTP browser without requiring credentialless", async () => {
- assert.deepEqual(await getAVMapHostCapabilities(browser() as unknown as Window),
- {supported: true, nativeBoundary: false, credentialless: false});
- });
- it("requires an exact successful native boundary report and accepts asynchronous Android replies", async () => {
- for (const report of [undefined, {enabled: true}, {version: 2, enabled: true}, {version: 1, enabled: false}, true]) {
- const scope = {...browser(), JSAndroid: {}, getAVMapNativeBoundary: async () => report};
- assert.equal((await getAVMapHostCapabilities(scope as unknown as Window)).supported, false);
- }
- const scope = {...browser(), JSAndroid: {}, getAVMapNativeBoundary: async () => ({version: 1, enabled: true})};
- assert.deepEqual(await getAVMapHostCapabilities(scope as unknown as Window),
- {supported: true, nativeBoundary: true, credentialless: false});
- });
- it("uses only the dedicated iOS capability receiver and fails closed on rejection", async () => {
- let calls = 0;
- const receiver = {postMessage: async (input: unknown) => {
- assert.equal(input, null);
- calls++;
- return {version: 1, enabled: true};
- }};
- const scope = {...browser(), webkit: {messageHandlers: {getAVMapNativeBoundary: receiver}}};
- assert.equal((await getAVMapHostCapabilities(scope as unknown as Window)).nativeBoundary, true);
- assert.equal(calls, 1);
- receiver.postMessage = async () => { throw new Error("untrusted frame"); };
- assert.equal((await getAVMapHostCapabilities(scope as unknown as Window)).supported, false);
- });
- it("does not let a reported native capability override Electron, Node or file restrictions", async () => {
- for (const override of [{process: {}}, {require() {}}, {navigator: {userAgent: "Electron/44"}},
- {location: {protocol: "file:"}}]) {
- const scope = {...browser(), JSAndroid: {}, ...override,
- getAVMapNativeBoundary: () => assert.fail("must not call native capability")};
- assert.equal((await getAVMapHostCapabilities(scope as unknown as Window)).supported, false);
- }
- });
-});
diff --git a/app/src/protyle/render/av/map/hostCapabilities.ts b/app/src/protyle/render/av/map/hostCapabilities.ts
deleted file mode 100644
index cbec5a85c2..0000000000
--- a/app/src/protyle/render/av/map/hostCapabilities.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-export interface AVMapHostCapabilities {
- supported: boolean;
- nativeBoundary: boolean;
- credentialless: boolean;
-}
-
-// 此报告仅代表壳已经安装桥接和导航防护,不代表 Cookie、网络或 DOM 隔离。
-export const getAVMapHostCapabilities = async (scope: Window): Promise<AVMapHostCapabilities> => {
- const environment = scope as unknown as Record<string, any>;
- const credentialless = !!environment.HTMLIFrameElement &&
- "credentialless" in environment.HTMLIFrameElement.prototype;
- const unsupported = {supported: false, nativeBoundary: false, credentialless};
- if (!/^https?:$/.test(scope.location.protocol) || environment.require || environment.process ||
- /Electron/i.test(scope.navigator.userAgent) || !environment.HTMLIFrameElement) {
- return unsupported;
- }
- const native = !!(environment.webkit?.messageHandlers || environment.Android || environment.JSAndroid ||
- environment.Harmony || environment.JSHarmony || /SiYuan\/|SiYuanAndroid|SiYuanIOS|SiYuanHarmony/i.test(scope.navigator.userAgent));
- if (!native) {
- return {supported: true, nativeBoundary: false, credentialless};
- }
- let timer: number;
- try {
- // 原生壳只在可信主文档安装该只读方法;不能用 URL 参数或可见桥名称替代。
- const read = () => typeof environment.getAVMapNativeBoundary === "function" ?
- environment.getAVMapNativeBoundary() :
- environment.webkit?.messageHandlers?.getAVMapNativeBoundary?.postMessage(null);
- const report = await Promise.race([Promise.resolve().then(read), new Promise<undefined>((resolve) => {
- timer = scope.setTimeout(() => resolve(undefined), 3000);
- })]);
- return {supported: report?.version === 1 && report.enabled === true,
- nativeBoundary: report?.version === 1 && report.enabled === true, credentialless};
- } catch (_error) {
- return unsupported;
- } finally {
- scope.clearTimeout(timer);
- }
-};
diff --git a/app/src/protyle/render/av/map/hostEntry.ts b/app/src/protyle/render/av/map/hostEntry.ts
deleted file mode 100644
index bac729f126..0000000000
--- a/app/src/protyle/render/av/map/hostEntry.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import {connectAVMapRuntime} from "./hostRuntime";
-
-connectAVMapRuntime(window);
diff --git a/app/src/protyle/render/av/map/hostRuntime.test.ts b/app/src/protyle/render/av/map/hostRuntime.test.ts
deleted file mode 100644
index 5507eb2f64..0000000000
--- a/app/src/protyle/render/av/map/hostRuntime.test.ts
+++ /dev/null
@@ -1,342 +0,0 @@
-import * as assert from "node:assert/strict";
-import {describe, it} from "node:test";
-import {connectAVMapRuntime, startAVMapRuntime} from "./hostRuntime";
-import {AVMapAdapter, AVMapAdapterCallbacks} from "./providers";
-import {AVMapLoadError} from "./protocol";
-
-const tick = () => new Promise<void>((resolve) => setImmediate(resolve));
-const fixture = () => {
- const replies: any[] = [];
- const calls: Array<[string, ...any[]]> = [];
- const port = {onmessage: null as any, postMessage: (data: unknown) => replies.push(data),
- start() {}, close: () => calls.push(["close"])};
- const adapter: AVMapAdapter = {
- setPoints: (...args) => { calls.push(["setPoints", ...args]); },
- fit: () => { calls.push(["fit"]); }, resize: () => { calls.push(["resize"]); },
- setTheme: (...args) => { calls.push(["theme", ...args]); }, destroy: () => { calls.push(["destroy"]); },
- setVisible: (...args) => { calls.push(["visibility", ...args]); },
- };
- const send = (data: Record<string, unknown>) => port.onmessage?.({data: {version: 1, instanceID: "one", ...data}});
- return {replies, calls, port, adapter, send};
-};
-
-describe("isolated map runtime lifecycle", () => {
- it("keeps picking opt-in and gates sanitized coordinate replies by the latest snapshot and lifetime", async () => {
- for (const picking of [false, true]) {
- const f = fixture();
- let callbacks: AVMapAdapterCallbacks;
- const stop = startAVMapRuntime(f.port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async (_init, _container, value) => { callbacks = value; return f.adapter; });
- await f.send({type: "init", provider: "openfreemap", theme: "light", picking});
- assert.equal(typeof callbacks.onPointClick, picking ? "function" : "undefined");
- if (picking) {
- const point = {longitude: 0, latitude: 0};
- callbacks.onPointClick(point, -1);
- await f.send({type: "setPoints", points: [], revision: 2});
- callbacks.onPointClick(point, 1);
- callbacks.onPointClick({...point, latitude: 90}, 2);
- callbacks.onPointClick({...point, name: "private"} as any, 2);
- assert.deepEqual(f.replies.filter(reply => reply.type === "pointClick"), [
- {version: 1, instanceID: "one", type: "pointClick", longitude: 0, latitude: 0, revision: 2},
- ]);
- stop();
- callbacks.onPointClick(point, 2);
- assert.equal(f.replies.length, 2);
- }
- stop();
- }
- });
- it("rejects duplicate init, other providers, old revisions and nonmember marker clicks", async () => {
- const {port, adapter, replies, calls, send} = fixture();
- let callbacks: AVMapAdapterCallbacks;
- let starts = 0;
- const stop = startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async (_init, _container, value) => { starts++; callbacks = value; return adapter; });
- await send({type: "init", provider: "amap", theme: "light"});
- assert.equal(starts, 0);
- await send({type: "init", provider: "openfreemap", theme: "light"});
- await send({type: "init", provider: "openfreemap", theme: "dark"});
- assert.equal(starts, 1);
- assert.deepEqual(replies, [{version: 1, instanceID: "one", type: "ready"}]);
- const point = {id: "row-1", longitude: 0, latitude: 0};
- await send({type: "setPoints", revision: 2, points: [{...point, title: "private"},
- {...point, id: "invalid", latitude: 91}]});
- assert.deepEqual(calls.find((call) => call[0] === "setPoints"), ["setPoints", [point], 2]);
- assert.equal(calls.filter((call) => call[0] === "fit").length, 1);
- await send({type: "setPoints", revision: 1, points: []});
- await send({type: "setPoints", revision: 2, points: []});
- await send({type: "setPoints", instanceID: "old", revision: 3, points: []});
- callbacks.onMarkerClick("row-1", 1);
- callbacks.onMarkerClick("not-present", 2);
- callbacks.onMarkerClick("row-1", 2);
- assert.equal(replies.length, 2);
- assert.deepEqual(replies[1], {version: 1, instanceID: "one", type: "markerClick", id: "row-1", revision: 2});
- await send({type: "setPoints", revision: 3, points: []});
- assert.equal(calls.filter((call) => call[0] === "fit").length, 1);
- callbacks.onMarkerClick("row-1", 2);
- callbacks.onMarkerClick("row-1", 3);
- assert.equal(replies.length, 2);
- stop();
- callbacks.onMarkerClick("row-1", 3);
- callbacks.onError("mapUnavailable");
- stop();
- assert.equal(calls.filter((call) => call[0] === "destroy").length, 1);
- assert.equal(replies.length, 2);
- });
- it("destroys a provider that finishes loading after teardown", async () => {
- const {port, adapter, replies, calls, send} = fixture();
- let finish: (value: AVMapAdapter) => void;
- let signal: AbortSignal;
- startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async (_init, _container, _callbacks, value) => {
- signal = value;
- return new Promise<AVMapAdapter>((resolve) => { finish = resolve; });
- });
- const pending = send({type: "init", provider: "openfreemap", theme: "light"});
- await send({type: "destroy"});
- assert.equal(signal.aborted, true);
- finish(adapter);
- await pending;
- await tick();
- assert.equal(replies.length, 0);
- assert.equal(calls.filter((call) => call[0] === "destroy").length, 1);
- });
- it("fits only the first nonempty snapshot and rejects the removed external fit command", async () => {
- const {port, adapter, calls, send} = fixture();
- const stop = startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async () => adapter);
- await send({type: "init", provider: "openfreemap", theme: "light"});
- await send({type: "fit"});
- await send({type: "setPoints", revision: 0, points: []});
- assert.equal(calls.some(call => call[0] === "fit"), false);
- await send({type: "setPoints", revision: 1, points: [{id: "row-1", longitude: 0, latitude: 0}]});
- assert.equal(calls.filter(call => call[0] === "fit").length, 1);
- await send({type: "fit"});
- await send({type: "visibility", visible: false});
- await send({type: "resize"});
- await send({type: "visibility", visible: true});
- await send({type: "setPoints", revision: 2, points: []});
- await send({type: "setPoints", revision: 3, points: [{id: "row-2", longitude: 20, latitude: 20}]});
- assert.equal(calls.filter(call => call[0] === "fit").length, 1);
- stop();
- });
- it("passes only fixed attribution identifiers and visibility booleans through the runtime", async () => {
- const {port, adapter, replies, calls, send} = fixture();
- let callbacks: AVMapAdapterCallbacks;
- const stop = startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async (_init, _container, value) => {
- callbacks = value;
- value.onAttributionClick("maplibre");
- return adapter;
- });
- await send({type: "visibility", visible: true, viewport: {x: 0, y: 0, width: 800, height: 600}});
- await send({type: "init", provider: "openfreemap", theme: "light"});
- assert.deepEqual(replies.map(reply => reply.type), ["ready"]);
- await send({type: "visibility", visible: "true"});
- const viewport = {x: 0, y: 50, width: 800, height: 550};
- await send({type: "visibility", visible: true, viewport});
- await send({type: "visibility", visible: false});
- assert.deepEqual(calls.filter(call => call[0] === "visibility"), [["visibility", true, viewport], ["visibility", false, undefined]]);
- callbacks.onAttributionClick("maplibre");
- callbacks.onAttributionClick("https://evil.invalid/" as any);
- assert.deepEqual(replies[1], {version: 1, instanceID: "one", type: "attributionClick", link: "maplibre"});
- stop(); callbacks.onAttributionClick("maplibre");
- assert.equal(replies.length, 2);
- });
- it("never initializes a removed provider", async () => {
- for (const provider of ["amap", "tencent", "baidu"]) {
- const {port, replies, send} = fixture();
- startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async () => assert.fail("must not load an SDK"));
- await send({type: "init", provider, theme: "light"});
- assert.deepEqual(replies, []);
- }
- });
- it("returns only a stable code when SDK loading fails with a secret-bearing exception", async () => {
- const {port, replies, send} = fixture();
- startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async () => { throw new Error("https://sdk.invalid?key=secret"); });
- await send({type: "init", provider: "openfreemap", theme: "light"});
- assert.deepEqual(replies, [{version: 1, instanceID: "one", type: "error", code: "sdkUnavailable"}]);
- });
- it("preserves only controlled loading stages without passing exception fields to the owner", async () => {
- for (const code of ["sdkScriptLoadFailed", "sdkGlobalMissing", "mapCreationFailed", "mapReadyTimeout"] as const) {
- const {port, replies, send} = fixture();
- startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async () => { throw Object.assign(new AVMapLoadError(code), {message: "https://sdk.invalid?key=secret"}); });
- await send({type: "init", provider: "openfreemap", theme: "light"});
- assert.deepEqual(replies, [{version: 1, instanceID: "one", type: "error", code}]);
- }
- const {port, replies, send} = fixture();
- startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async () => { throw Object.assign(new Error("https://sdk.invalid?key=secret"), {code: "mapCreationFailed"}); });
- await send({type: "init", provider: "openfreemap", theme: "light"});
- assert.deepEqual(replies, [{version: 1, instanceID: "one", type: "error", code: "sdkUnavailable"}]);
- });
- it("does not report a provider rejection caused by teardown", async () => {
- const {port, replies, send} = fixture();
- startAVMapRuntime(port as unknown as MessagePort, "one", "openfreemap", {} as HTMLElement,
- async (_init, _container, _callbacks, signal) => new Promise<AVMapAdapter>((_resolve, reject) => {
- signal.addEventListener("abort", () => reject(new AVMapLoadError("mapReadyTimeout")), {once: true});
- }));
- const pending = send({type: "init", provider: "openfreemap", theme: "light"});
- await send({type: "destroy"});
- await pending;
- assert.deepEqual(replies, []);
- });
-});
-
-describe("isolated map bootstrap ordering", () => {
- const bootstrapFixture = (desktop = false, native = false, timing = {setTimeout, clearTimeout}) => {
- const instanceID = "a".repeat(48);
- const nonce = "b".repeat(48);
- const events: any[] = [];
- const listeners = new Map<string, (event?: any) => void>();
- const parent = Object.defineProperty({postMessage: (message: unknown) => events.push(message)},
- "document", {get() { throw new Error("opaque sandbox"); }});
- const scope: any = {
- origin: "null", location: {hash: `#${instanceID}:${nonce}`, search: "?provider=openfreemap"},
- parent, ...timing, maplibregl: {Map() {}, AttributionControl() {}, setWorkerUrl() {}},
- fetch: async () => ({ok: true, text: async () => "worker"}),
- addEventListener: (name: string, callback: (event?: any) => void) => listeners.set(name, callback),
- removeEventListener: (name: string) => listeners.delete(name),
- document: {createElement: (tag: string) => ({tag, remove() {}}),
- head: {appendChild: (element: any) => {
- if (element.tag === "meta") events.push({type: "policy", content: element.content});
- else queueMicrotask(() => element.onload?.());
- }},
- getElementById: () => ({})},
- };
- if (desktop) {
- scope.parent = scope;
- scope.siyuanMapDesktop = {version: 1};
- }
- if (native) {
- scope.JSAndroid = {};
- }
- const port = {onmessage: null as any, closed: 0, start() {}, close() { this.closed++; },
- postMessage: (message: unknown) => events.push(message)};
- connectAVMapRuntime(scope);
- const message = (type: string, values: Record<string, unknown> = {}, ports: unknown[] = []) => ({
- source: desktop ? scope : parent, origin: "https://fixture.invalid", ports,
- data: {version: 1, instanceID, nonce, type, ...values},
- });
- return {scope, events, listeners, port, message};
- };
- it("rejects early ports and locks CSP before exposing bootstrap readiness", async () => {
- const {events, listeners, port, message} = bootstrapFixture();
- const receive = listeners.get("message");
- assert.equal(events[0].type, "hello");
- receive(message("connect", {}, [port]));
- assert.equal(port.onmessage, null);
- receive({...message("prepare"), source: {}});
- assert.equal(events.length, 1);
- receive(message("prepare"));
- await tick();
- assert.deepEqual(events.map((event) => event.type), ["hello", "policy", "bootstrapReady"]);
- receive(message("connect", {}, [port]));
- assert.equal(typeof port.onmessage, "function");
- const handler = port.onmessage;
- receive(message("connect", {}, [port]));
- assert.equal(port.onmessage, handler);
- listeners.get("pagehide")();
- assert.equal(port.onmessage, null);
- });
- it("requires the verified native boundary before permitting preparation in a native frame", async () => {
- const denied = bootstrapFixture(false, true);
- denied.listeners.get("message")(denied.message("prepare", {nativeBoundary: false}));
- await tick();
- assert.deepEqual(denied.events.map((event) => event.type), ["hello", "bootstrapError"]);
- const allowed = bootstrapFixture(false, true);
- allowed.listeners.get("message")(allowed.message("prepare", {nativeBoundary: true}));
- await tick();
- assert.deepEqual(allowed.events.map((event) => event.type), ["hello", "policy", "bootstrapReady"]);
- allowed.listeners.get("pagehide")();
- });
- it("accepts a desktop preload port once and returns readiness only after the same CSP lock", async () => {
- const {events, listeners, port, message} = bootstrapFixture(true);
- const receive = listeners.get("message");
- const valid = message("siyuan-map-desktop-connect", {provider: "openfreemap"}, [port]);
- receive({...valid, source: {}});
- receive({...valid, data: {...valid.data, provider: "baidu"}});
- receive({...valid, data: {...valid.data, nonce: "old"}});
- assert.equal(events.length, 0);
- receive(valid);
- receive(valid);
- await tick();
- assert.deepEqual(events.map((event) => event.type), ["policy", "bootstrapReady"]);
- assert.equal(events[1].nonce, undefined);
- assert.equal(typeof port.onmessage, "function");
- assert.equal(listeners.has("message"), false);
- listeners.get("pagehide")();
- });
- it("reports preparation failures once with fixed codes and closes a transferred desktop port", async () => {
- for (const desktop of [false, true]) {
- for (const failure of ["script", "global", "policy"]) {
- const {scope, events, listeners, port, message} = bootstrapFixture(desktop);
- if (failure === "global" || failure === "script") scope.maplibregl = undefined;
- const append = scope.document.head.appendChild;
- scope.document.head.appendChild = (element: any) => {
- if (failure === "script" && element.tag === "script") {
- queueMicrotask(() => element.onerror?.(new Error("https://private.invalid/?token=secret")));
- } else if (failure === "policy" && element.tag === "meta") {
- throw new Error("https://private.invalid/?token=secret");
- } else append(element);
- };
- const receive = listeners.get("message");
- const request = desktop ? message("siyuan-map-desktop-connect", {provider: "openfreemap"}, [port]) : message("prepare");
- receive(request);
- await tick();
- const code = failure === "script" ? "sdkScriptLoadFailed" : failure === "global" ? "sdkGlobalMissing" : "hostUnavailable";
- const replies = events.filter(event => event.type === "error" || event.type === "bootstrapError");
- assert.equal(replies.length, 1);
- assert.equal(replies[0].code, code);
- assert.equal(JSON.stringify(events).includes("secret"), false);
- assert.equal(events.some(event => event.type === "bootstrapReady"), false);
- assert.equal(listeners.has("message"), false);
- assert.equal(port.closed, desktop ? 1 : 0);
- receive(request);
- listeners.get("pagehide")();
- assert.equal(events.filter(event => event.type === "error" || event.type === "bootstrapError").length, 1);
- }
- }
- });
- it("keeps slow CSS and script loading inside one bootstrap deadline and ignores late completion", async () => {
- for (const desktop of [false, true]) {
- let now = 0, nextTimer = 0, removed = 0;
- const timers = new Map<number, {at: number; callback: () => void}>();
- const timing = {
- setTimeout: (callback: () => void, delay: number) => {
- timers.set(++nextTimer, {at: now + delay, callback});
- return nextTimer;
- }, clearTimeout: (id: number) => timers.delete(id),
- } as unknown as {setTimeout: typeof setTimeout; clearTimeout: typeof clearTimeout};
- const {scope, events, listeners, port, message} = bootstrapFixture(desktop, false, timing);
- const assets: any[] = [];
- scope.document.createElement = (tag: string) => ({tag, remove() { removed++; }});
- scope.document.head.appendChild = (element: any) => assets.push(element);
- listeners.get("message")(desktop ? message("siyuan-map-desktop-connect", {provider: "openfreemap"}, [port]) : message("prepare"));
- assert.equal(assets[0].tag, "link");
- now = 19000;
- assets[0].onload();
- await tick();
- assert.equal(assets[1].tag, "script");
- const lateLoad = assets[1].onload;
- now = 30000;
- for (const [id, timer] of Array.from(timers)) {
- if (timer.at <= now) { timers.delete(id); timer.callback(); }
- }
- await tick();
- assert.equal(assets[1].onload, null);
- assert.equal(assets[1].onerror, null);
- assert.equal(removed, 1);
- assert.equal(timers.size, 0);
- assert.equal(port.closed, desktop ? 1 : 0);
- lateLoad();
- await tick();
- assert.equal(events.some(event => event.type === "bootstrapReady" || event.type === "error"), false);
- assert.equal(assets.some(element => element.tag === "meta"), false);
- assert.equal(listeners.has("message"), false);
- }
- });
-});
diff --git a/app/src/protyle/render/av/map/hostRuntime.ts b/app/src/protyle/render/av/map/hostRuntime.ts
deleted file mode 100644
index 65e4af258a..0000000000
--- a/app/src/protyle/render/av/map/hostRuntime.ts
+++ /dev/null
@@ -1,231 +0,0 @@
-import {
- AV_MAP_PROTOCOL_VERSION, AVMapErrorCode, AVMapInit, AVMapReply, getAVMapLoadErrorCode, isAVMapAttributionLink, isAVMapBootstrapMessage, isAVMapProvider,
- parseAVMapCommand, parseAVMapCoordinate,
-} from "./protocol";
-import {AVMapAdapter, AVMapAdapterCallbacks} from "./providers";
-import {loadAVMapAdapter} from "./providersLoader";
-import {prepareAVMapBootstrap} from "./bootstrap";
-import {AV_MAP_BOOTSTRAP_TIMEOUT} from "./loadingBudget";
-
-export type AVMapAdapterFactory = (init: AVMapInit, container: HTMLElement,
- callbacks: AVMapAdapterCallbacks, signal: AbortSignal) => Promise<AVMapAdapter>;
-
-export const isAVMapRuntimeIsolated = (scope: Window, nativeBoundary = false): boolean => {
- const environment = scope as unknown as Record<string, any>;
- if (scope.origin !== "null" || environment.require || environment.process || (!nativeBoundary &&
- (environment.JSAndroid || environment.Android || environment.JSHarmony || environment.Harmony ||
- environment.webkit?.messageHandlers))) {
- return false;
- }
- try {
- // 无法读取父文档是最低运行门槛;桌面关闭 webSecurity 的环境不会获准加载 SDK。
- void scope.parent.document;
- return false;
- } catch (_error) {
- return true;
- }
-};
-
-export const startAVMapRuntime = (port: MessagePort, instanceID: string, provider: AVMapInit["provider"],
- container: HTMLElement, factory: AVMapAdapterFactory = loadAVMapAdapter) => {
- let destroyed = false;
- let initializing = false;
- let adapter: AVMapAdapter;
- let revision = -1;
- let initiallyFitted = false;
- let ids = new Set<string>();
- const abort = new AbortController();
- const envelope = {version: AV_MAP_PROTOCOL_VERSION, instanceID} as const;
- const send = (reply: AVMapReply) => {
- if (!destroyed) {
- port.postMessage(reply);
- }
- };
- const destroy = () => {
- if (destroyed) {
- return;
- }
- destroyed = true;
- abort.abort();
- ids.clear();
- port.onmessage = null;
- port.close();
- adapter?.destroy();
- };
- const fail = (code: AVMapErrorCode) => {
- send({...envelope, type: "error", code});
- destroy();
- };
- port.onmessage = async (event) => {
- if (destroyed) {
- return;
- }
- const command = parseAVMapCommand(event.data, instanceID, provider);
- if (!command) {
- return;
- }
- if (command.type === "destroy") {
- destroy();
- return;
- }
- try {
- if (command.type === "init") {
- if (initializing || adapter || command.provider !== provider) {
- return;
- }
- initializing = true;
- const next = await factory(command, container, {
- onMarkerClick: (id, clickedRevision) => {
- if (clickedRevision === revision && ids.has(id)) {
- send({...envelope, type: "markerClick", id, revision});
- }
- },
- ...(command.picking && {onPointClick: (input, clickedRevision) => {
- const point = parseAVMapCoordinate(input);
- if (adapter && point && clickedRevision === revision && revision >= 0) {
- send({...envelope, type: "pointClick", ...point, revision});
- }
- }}),
- onError: fail,
- onAttributionClick: link => {
- if (adapter && isAVMapAttributionLink(link)) {
- send({...envelope, type: "attributionClick", link});
- }
- },
- }, abort.signal);
- if (destroyed) {
- next.destroy();
- return;
- }
- adapter = next;
- adapter.setTheme(command.theme);
- send({...envelope, type: "ready"});
- } else if (adapter && command.type === "setPoints" && command.revision > revision) {
- revision = command.revision;
- ids = new Set(command.points.map((point) => point.id));
- adapter.setPoints(command.points, revision);
- if (!initiallyFitted && command.points.length > 0) {
- adapter.fit();
- initiallyFitted = true;
- }
- } else if (adapter && command.type === "theme") {
- adapter.setTheme(command.theme);
- } else if (adapter && command.type === "resize") {
- adapter.resize();
- } else if (adapter && command.type === "visibility") {
- adapter.setVisible(command.visible, command.viewport);
- }
- } catch (error) {
- fail(getAVMapLoadErrorCode(error) || (adapter ? "mapUnavailable" : "sdkUnavailable"));
- }
- };
- port.start();
- return destroy;
-};
-
-export const connectAVMapRuntime = (scope: Window) => {
- const [instanceID, nonce] = scope.location.hash.slice(1).split(":");
- const provider = new URLSearchParams(scope.location.search).get("provider");
- if (!/^[a-f0-9]{48}$/.test(instanceID || "") || !/^[a-f0-9]{48}$/.test(nonce || "") ||
- !isAVMapProvider(provider)) {
- return;
- }
- const environment = scope as unknown as Record<string, any>;
- const desktop = scope.parent === scope && environment.siyuanMapDesktop?.version === 1 &&
- !environment.require && !environment.process;
- // 此检查仅准许等待可信 wrapper 的无秘密 prepare,尚未准许加载 SDK。
- if (!desktop && (scope.parent === scope || !isAVMapRuntimeIsolated(scope, true))) {
- return;
- }
- let destroy: () => void;
- let destroyAssets: () => void;
- let preparing = false;
- let locked = false;
- let connected = false;
- let closed = false;
- let desktopPort: MessagePort;
- const abort = new AbortController();
- const envelope = {version: AV_MAP_PROTOCOL_VERSION, instanceID, nonce};
- const cleanup = () => {
- if (closed) {
- return;
- }
- closed = true;
- abort.abort();
- scope.removeEventListener("message", onConnect);
- scope.clearTimeout(timer);
- destroy?.();
- desktopPort?.close();
- destroyAssets?.();
- };
- const prepare = async () => {
- preparing = true;
- try {
- const dispose = await prepareAVMapBootstrap(scope, provider, abort.signal);
- if (closed) {
- dispose();
- return;
- }
- destroyAssets = dispose;
- locked = true;
- if (desktop) {
- scope.removeEventListener("message", onConnect);
- scope.clearTimeout(timer);
- destroy = startAVMapRuntime(desktopPort, instanceID, provider, scope.document.getElementById("map"));
- desktopPort.postMessage({version: AV_MAP_PROTOCOL_VERSION, type: "bootstrapReady", instanceID});
- } else {
- scope.parent.postMessage({...envelope, type: "bootstrapReady"}, "*");
- }
- } catch (error) {
- if (!closed) {
- const code = getAVMapLoadErrorCode(error) || "hostUnavailable";
- if (desktop) {
- desktopPort?.postMessage({version: AV_MAP_PROTOCOL_VERSION, type: "error", instanceID, code});
- } else {
- scope.parent.postMessage({...envelope, type: "bootstrapError", code}, "*");
- }
- }
- cleanup();
- }
- };
- const onConnect = (event: MessageEvent) => {
- if (closed || connected) {
- return;
- }
- if (desktop) {
- if (!preparing && event.source === scope && event.ports.length === 1 && event.data?.provider === provider &&
- isAVMapBootstrapMessage(event.data, "siyuan-map-desktop-connect", instanceID, nonce)) {
- desktopPort = event.ports[0];
- connected = true;
- void prepare();
- }
- return;
- }
- if (event.source !== scope.parent) {
- return;
- }
- if (!preparing && event.ports.length === 0 &&
- isAVMapBootstrapMessage(event.data, "prepare", instanceID, nonce)) {
- if (!isAVMapRuntimeIsolated(scope, event.data.nativeBoundary === true)) {
- scope.parent.postMessage({...envelope, type: "bootstrapError"}, "*");
- cleanup();
- return;
- }
- void prepare();
- return;
- }
- if (!locked || event.ports.length !== 1 || !isAVMapBootstrapMessage(event.data, "connect", instanceID, nonce)) {
- return;
- }
- connected = true;
- scope.removeEventListener("message", onConnect);
- scope.clearTimeout(timer);
- destroy = startAVMapRuntime(event.ports[0], instanceID, provider, scope.document.getElementById("map"));
- };
- const timer = scope.setTimeout(cleanup, AV_MAP_BOOTSTRAP_TIMEOUT);
- scope.addEventListener("message", onConnect);
- scope.addEventListener("pagehide", cleanup, {once: true});
- if (!desktop) {
- scope.parent.postMessage({...envelope, type: "hello"}, "*");
- }
-};
diff --git a/app/src/protyle/render/av/map/loadingBudget.ts b/app/src/protyle/render/av/map/loadingBudget.ts
deleted file mode 100644
index c210ae2e7a..0000000000
--- a/app/src/protyle/render/av/map/loadingBudget.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-// CSS、脚本和 worker 各阶段受限,同时受宿主准备总期限约束。
-export const AV_MAP_ASSET_TIMEOUT = 20000;
-export const AV_MAP_READY_TIMEOUT = 20000;
-// 文档、资源准备和 CSP 锁定共用此预算;bootstrapReady 后仅等待地图就绪。
-export const AV_MAP_BOOTSTRAP_TIMEOUT = 30000;
-export const AV_MAP_HOST_READY_TIMEOUT = 45000;
-// 桌面创建请求与 IPC 失联的最外层兜底,不延长各阶段的独立期限。
-export const AV_MAP_OWNER_TIMEOUT = 90000;
diff --git a/app/src/protyle/render/av/map/locate.test.ts b/app/src/protyle/render/av/map/locate.test.ts
deleted file mode 100644
index 712bf3dc0a..0000000000
--- a/app/src/protyle/render/av/map/locate.test.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {test} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import * as locateState from "../locateState";
-import {isTableLikeView} from "../viewType";
-import {requireFixture} from "./testDOM";
-
-const setup = (open: () => Promise<boolean> = () => Promise.resolve(true)) => {
- const opened: unknown[] = [];
- const scrolled: unknown[] = [];
- const messages: string[] = [];
- const block = {isConnected: true, dataset: {avId: "database", nodeId: "carrier"}} as unknown as HTMLElement;
- const protyle = {notebookId: "notebook"} as IProtyle;
- const data = {viewType: "map", view: {rows: [{id: "row", cells: [{id: "primary-value", valueType: "block",
- value: {type: "block", isDetached: true, block: {content: "Record"}}}]}]},
- target: {itemID: "row", status: "visible"}} as IAV;
- const languages = {databaseItemNotFound: "not found", databaseItemFiltered: "filtered"};
- const modules: Record<string, unknown> = {
- "./locateState": locateState,
- "./viewType": {isTableLikeView},
- "../../../dialog/message": {showMessage: (message: string) => messages.push(message)},
- "../../../util/highlightById": {scrollCenter: (_protyle: unknown, element: unknown) => scrolled.push(element)},
- "./backlinkScroll": {scrollBacklinkTarget: () => false},
- "../../../constants": {}, "./publishState": {}, "./readonlyState": {}, "./gallery/style": {},
- "../../wysiwyg/transaction": {}, "../../util/clear": {}, "./rangeSelect": {}, "./virtualScroll": {},
- "./locateView": {}, "./color": {},
- "../openDatabaseRow": {openDatabaseRowByData: (_protyle: unknown, record: unknown) => {
- opened.push(record);
- return open();
- }},
- };
- const load = (path: string) => {
- const exports = {};
- runInNewContext(transpileModule(readFileSync(path, "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
- }).outputText, {exports, require: requireFixture(modules), window: {siyuan: {languages}}});
- return exports;
- };
- modules["./map/openRecord"] = load("src/protyle/render/av/map/openRecord.ts");
- const methods = load("src/protyle/render/av/locate.ts") as typeof import("../locate");
- return {methods, opened, scrolled, messages, block, protyle, data};
-};
-
-test("explicit map record locating opens existing detail once without selecting hidden rows", () => {
- const scenario = setup();
- scenario.methods.setAVLocateRequest(scenario.block, {itemID: "row"});
- const reset = {virtualData: {}};
- scenario.methods.prepareAVLocate(scenario.block, scenario.data, reset);
- assert.deepEqual(reset.virtualData, {});
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- assert.equal(scenario.opened.length, 1);
- assert.equal((scenario.opened[0] as {itemID: string}).itemID, "row");
- assert.equal((scenario.opened[0] as {focusPrimary: boolean}).focusPrimary, true);
- assert.deepEqual(scenario.scrolled, []);
-});
-
-test("map backlink and search previews locate the container without opening row details", () => {
- for (const request of [
- {itemID: "row", keyID: "location", persistView: false, select: false, highlight: true, scroll: true, defIDs: ["ref"]},
- {itemID: "row", keyID: "location", persistView: false, select: false, highlight: true, isValid: () => true},
- ]) {
- const scenario = setup();
- scenario.methods.setAVLocateRequest(scenario.block, request);
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- assert.deepEqual(scenario.opened, []);
- assert.deepEqual(scenario.scrolled, [scenario.block]);
- assert.equal(locateState.locateRequests.has(scenario.block), false);
- }
-});
-
-test("invalid, filtered and previously located map requests never reopen a record", async () => {
- for (const mode of ["invalid", "filtered", "located", "missing"]) {
- const scenario = setup();
- scenario.methods.setAVLocateRequest(scenario.block, {itemID: "row", located: mode === "located",
- isValid: () => mode !== "invalid"});
- if (mode === "filtered") scenario.data.target.status = "filtered";
- if (mode === "missing") (scenario.data.view as IAVTable).rows = [];
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- await new Promise(resolve => setImmediate(resolve));
- assert.deepEqual(scenario.opened, []);
- assert.deepEqual(scenario.scrolled, []);
- assert.deepEqual(scenario.messages, mode === "missing" ? ["not found"] : []);
- }
-});
-
-test("failed or rejected map record opens report a current failure once", async () => {
- for (const open of [() => Promise.resolve(false), () => Promise.reject(new Error("unavailable"))]) {
- const scenario = setup(open);
- scenario.methods.setAVLocateRequest(scenario.block, {itemID: "row"});
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- await new Promise(resolve => setImmediate(resolve));
- assert.equal(scenario.opened.length, 1);
- assert.deepEqual(scenario.messages, ["not found"]);
- }
-});
-
-test("late map record failures cannot interrupt closed, invalidated or newer navigation", async () => {
- for (const mode of ["closed", "rendered", "invalid", "new-request", "opened"]) {
- let fail: (result: boolean) => void;
- let valid = true;
- const scenario = setup(() => new Promise(resolve => { fail = resolve; }));
- scenario.methods.setAVLocateRequest(scenario.block, {itemID: "row", isValid: () => valid});
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- const previousFail = fail;
- if (mode === "closed") Object.assign(scenario.block, {isConnected: false});
- if (mode === "rendered") scenario.methods.beginAVRender(scenario.block);
- if (mode === "invalid") valid = false;
- if (mode === "new-request" || mode === "opened") {
- scenario.methods.setAVLocateRequest(scenario.block, {itemID: "row"});
- }
- if (mode === "opened") {
- scenario.methods.finishAVLocate(scenario.block, scenario.protyle, scenario.data);
- fail(true);
- }
- previousFail(false);
- await new Promise(resolve => setImmediate(resolve));
- assert.deepEqual(scenario.messages, []);
- }
-});
diff --git a/app/src/protyle/render/av/map/locationPicker.test.ts b/app/src/protyle/render/av/map/locationPicker.test.ts
deleted file mode 100644
index e198902939..0000000000
--- a/app/src/protyle/render/av/map/locationPicker.test.ts
+++ /dev/null
@@ -1,268 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {describe, it} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import type {AVMapHostOptions} from "./host";
-import * as protocol from "./protocol";
-import {canLoadMapHost} from "./state";
-import {DOMFixture, requireFixture} from "./testDOM";
-
-const compiled = transpileModule(readFileSync("src/protyle/render/av/map/locationPicker.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2020},
-}).outputText;
-
-const setup = (options: {point?: {longitude: number; latitude: number}; desktop?: boolean; published?: boolean;
- online?: boolean; protocol?: string; supported?: boolean | Promise<boolean>; acceptPick?: boolean;
- failDuringCreate?: boolean; runtime?: () => Promise<unknown>} = {}) => {
- const document = new DOMFixture();
- const canvas = document.createElement("div");
- canvas.classList.add("fn__none");
- document.body.append(canvas);
- const status = document.createElement("div");
- const calls: string[] = [];
- const events = new Map<string, () => void>();
- const observers: Array<{callback: () => void; disconnects: number}> = [];
- const hosts: Array<{options: AVMapHostOptions; points: Array<{points: protocol.AVMapPoint[]; revision: number}>;
- destroys: number; themes: string[]}> = [];
- const selected: Array<{longitude: number; latitude: number}> = [];
- const links: unknown[][] = [];
- const navigator = {onLine: options.online !== false};
- let ownerCurrent = true;
- const createHost = (_canvas: unknown, configuration: AVMapHostOptions) => {
- assert.equal(_canvas, canvas);
- const host = {options: configuration, points: [] as typeof hosts[number]["points"], destroys: 0, themes: [] as string[]};
- hosts.push(host);
- if (options.failDuringCreate) configuration.onError("hostUnavailable");
- return {
- destroy: () => host.destroys++,
- setPoints: (points: protocol.AVMapPoint[], revision: number) =>
- host.points.push({points: JSON.parse(JSON.stringify(points)), revision}),
- resize() {},
- setTheme: (theme: string) => host.themes.push(theme),
- };
- };
- const methods = {} as typeof import("./locationPicker");
- runInNewContext(compiled, {
- exports: methods,
- require: requireFixture({
- "../../../../util/fetch": {fetchSyncPost: async (url: string, payload: unknown) => {
- assert.equal(JSON.stringify(payload), "{}");
- calls.push(url);
- return options.runtime ? options.runtime() : {code: 0, data: {provider: "openfreemap"}};
- }},
- "./host": {
- isAVMapHostEnvironmentSupported: () => { calls.push("browser-capability"); return options.supported ?? true; },
- createAVMapHost: createHost,
- },
- "./desktopTransport": {
- isDesktopAVMapHostSupported: async () => { calls.push("desktop-capability"); return !!options.desktop; },
- createDesktopAVMapHost: (...args: Parameters<typeof createHost>) => {
- calls.push("desktop-host");
- return createHost(...args);
- },
- },
- "./protocol": protocol,
- "./state": {canLoadMapHost},
- }),
- window: {
- siyuan: {languages: new Proxy({}, {get: (_target, key) => String(key)}), isPublish: !!options.published},
- location: {protocol: options.protocol || "https:"},
- addEventListener: (type: string, callback: () => void) => events.set(type, callback),
- removeEventListener: (type: string) => events.delete(type),
- open: (...args: unknown[]) => links.push(args),
- },
- document,
- navigator,
- MutationObserver: class {
- record: typeof observers[number];
- constructor(callback: () => void) {
- this.record = {callback, disconnects: 0};
- observers.push(this.record);
- }
- observe() {}
- disconnect() { this.record.disconnects++; }
- },
- });
- const picker = methods.createAVLocationPicker({
- canvas: canvas as unknown as HTMLElement,
- status: status as unknown as HTMLElement,
- point: options.point,
- isCurrent: () => ownerCurrent,
- onPick: point => {
- selected.push(JSON.parse(JSON.stringify(point)));
- return options.acceptPick !== false;
- },
- });
- return {picker, hosts, calls, events, observers, selected, links, navigator, canvas, status, document,
- detach: () => { ownerCurrent = false; },
- settle: () => new Promise<void>(resolve => setImmediate(resolve)),
- click: (point: {longitude: number; latitude: number}, revision?: number) => {
- const host = hosts[0];
- host.options.onPointClick(point, revision ?? host.points[host.points.length - 1].revision);
- }};
-};
-
-describe("embedded database location picker", () => {
- it("loads an empty picker without requiring an existing location, on browser and desktop hosts", async () => {
- for (const desktop of [false, true]) {
- const scenario = setup({desktop});
- await scenario.settle();
- assert.equal(scenario.hosts.length, 1);
- assert.deepEqual(scenario.hosts[0].points, [{points: [], revision: 1}]);
- assert.equal(scenario.calls.includes("desktop-host"), desktop);
- assert.equal(scenario.calls.includes("browser-capability"), !desktop);
- assert.equal(scenario.status.textContent, "mapLoading");
- assert.equal(scenario.canvas.classList.contains("fn__none"), false);
- scenario.hosts[0].options.onReady();
- assert.equal(scenario.status.textContent, "");
- }
- });
-
- it("sends only the coordinate draft and updates its marker with strictly increasing revisions", async () => {
- const scenario = setup({point: {longitude: 30, latitude: 20, name: "Private name",
- originalInput: "Private source"} as {longitude: number; latitude: number}});
- await scenario.settle();
- const host = scenario.hosts[0];
- assert.deepEqual(host.points[0], {points: [{id: "location-draft", longitude: 30, latitude: 20}], revision: 1});
- scenario.click({longitude: 40, latitude: 10});
- scenario.click({longitude: 0, latitude: 0});
- assert.deepEqual(scenario.selected, [{longitude: 40, latitude: 10}, {longitude: 0, latitude: 0}]);
- assert.deepEqual(host.points[2], {points: [{id: "location-draft", longitude: 0, latitude: 0}], revision: 3});
- assert.equal(scenario.hosts.length, 1);
- scenario.picker.setPoint({longitude: 50, latitude: 25});
- assert.deepEqual(host.points[3], {points: [{id: "location-draft", longitude: 50, latitude: 25}], revision: 4});
- assert.equal(JSON.stringify(host.points).includes("Private"), false);
- });
-
- it("ignores stale or invalid point clicks and leaves a rejected draft unchanged", async () => {
- const scenario = setup();
- await scenario.settle();
- for (const point of [{longitude: 181, latitude: 0}, {longitude: 0, latitude: 86},
- {longitude: NaN, latitude: 0}, {longitude: 0, latitude: Infinity}]) scenario.click(point);
- scenario.click({longitude: 40, latitude: 10}, 0);
- scenario.click({longitude: 40, latitude: 10}, 2);
- assert.equal(scenario.selected.length, 0);
- assert.equal(scenario.hosts[0].points.length, 1);
- const rejected = setup({acceptPick: false});
- await rejected.settle();
- rejected.click({longitude: 40, latitude: 10});
- assert.equal(rejected.hosts[0].points.length, 1);
- });
-
- it("removes the selected marker for invalid manual coordinates without changing the form draft", async () => {
- const scenario = setup({point: {longitude: 30, latitude: 20}});
- await scenario.settle();
- scenario.picker.setPoint({longitude: 30, latitude: 90});
- scenario.picker.setPoint();
- assert.deepEqual(scenario.hosts[0].points.slice(1), [{points: [], revision: 2}, {points: [], revision: 3}]);
- assert.equal(scenario.selected.length, 0);
- });
-
- it("shows a local fallback and makes no runtime request for unsupported, published or offline clients", async () => {
- for (const [options, message] of [
- [{protocol: "file:"}, "mapUnsupportedClient"], [{published: true}, "mapPublicFallback"],
- [{online: false}, "mapOffline"], [{supported: false}, "mapUnsupportedClient"],
- ] as const) {
- const scenario = setup(options);
- await scenario.settle();
- assert.equal(scenario.calls.includes("/api/map/getRuntime"), false);
- assert.equal(scenario.hosts.length, 0);
- assert.equal(scenario.status.textContent, message);
- assert.equal(scenario.events.size, 0);
- assert.equal(scenario.canvas.classList.contains("fn__none"), true);
- }
- });
-
- it("retains the newest manual draft while capability and runtime checks are pending", async () => {
- let resolveCapability: (value: boolean) => void;
- const scenario = setup({supported: new Promise(resolve => resolveCapability = resolve)});
- scenario.picker.setPoint({longitude: 40, latitude: 10});
- resolveCapability(true);
- await scenario.settle();
- assert.deepEqual(scenario.hosts[0].points[0].points, [{id: "location-draft", longitude: 40, latitude: 10}]);
- });
-
- it("does not create a late host after disposal, owner invalidation or going offline during runtime loading", async () => {
- for (const action of ["destroy", "detach", "offline"]) {
- let complete: (value: unknown) => void;
- const scenario = setup({runtime: () => new Promise(resolve => complete = resolve)});
- await scenario.settle();
- if (action === "destroy") scenario.picker.destroy();
- else if (action === "detach") scenario.detach();
- else {
- scenario.navigator.onLine = false;
- scenario.events.get("offline")();
- }
- complete({code: 0, data: {provider: "openfreemap"}});
- await scenario.settle();
- assert.equal(scenario.hosts.length, 0);
- assert.equal(scenario.events.size, 0);
- }
- });
-
- it("does not fetch runtime after a capability result returns to a disposed picker", async () => {
- let complete: (value: boolean) => void;
- const scenario = setup({supported: new Promise(resolve => complete = resolve)});
- await scenario.settle();
- scenario.picker.destroy();
- complete(true);
- await scenario.settle();
- assert.equal(scenario.calls.includes("/api/map/getRuntime"), false);
- });
-
- it("handles authentication, provider, request and synchronous host failures without exposing errors", async () => {
- for (const [options, message] of [
- [{runtime: async () => ({code: -1, msg: "mapAuthenticationBypass"})}, "mapAuthenticationBypass"],
- [{runtime: async () => ({code: 0, data: {provider: "untrusted"}})}, "mapLoadError"],
- [{runtime: async () => { throw new Error("Private runtime detail"); }}, "mapLoadError"],
- [{failDuringCreate: true}, "mapLoadError"],
- ] as const) {
- const scenario = setup(options);
- await scenario.settle();
- assert.equal(scenario.status.textContent, message);
- assert.equal(scenario.canvas.classList.contains("fn__none"), true);
- assert.equal(scenario.events.size, 0);
- assert.equal(scenario.observers.length, 0);
- if (scenario.hosts.length) assert.equal(scenario.hosts[0].destroys, 1);
- }
- });
-
- it("disposes the host and all listeners once and ignores late events after close, error or owner loss", async () => {
- for (const action of ["destroy", "detach", "offline", "error"]) {
- const scenario = setup();
- await scenario.settle();
- const host = scenario.hosts[0];
- if (action === "destroy") scenario.picker.destroy();
- else if (action === "detach") {
- scenario.detach();
- scenario.click({longitude: 40, latitude: 10});
- } else if (action === "offline") {
- scenario.navigator.onLine = false;
- scenario.events.get("offline")();
- } else host.options.onError("hostUnavailable");
- scenario.click({longitude: 40, latitude: 10});
- host.options.onReady();
- scenario.observers[0].callback();
- scenario.picker.destroy();
- assert.equal(host.destroys, 1);
- assert.equal(scenario.selected.length, 0);
- assert.equal(scenario.observers[0].disconnects, 1);
- assert.equal(scenario.events.size, 0);
- }
- });
-
- it("updates theme and opens only fixed attribution destinations while active", async () => {
- const scenario = setup();
- await scenario.settle();
- scenario.document.documentElement.setAttribute("data-theme-mode", "dark");
- scenario.observers[0].callback();
- assert.deepEqual(scenario.hosts[0].themes, ["dark"]);
- const link = protocol.AV_MAP_ATTRIBUTION_LINKS.openfreemap[0];
- scenario.hosts[0].options.onAttributionClick(link.id);
- assert.deepEqual(scenario.links, [[link.href, "_blank", "noopener,noreferrer"]]);
- scenario.picker.destroy();
- scenario.hosts[0].options.onAttributionClick(link.id);
- assert.equal(scenario.links.length, 1);
- });
-});
diff --git a/app/src/protyle/render/av/map/locationPicker.ts b/app/src/protyle/render/av/map/locationPicker.ts
deleted file mode 100644
index 886527558e..0000000000
--- a/app/src/protyle/render/av/map/locationPicker.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import {fetchSyncPost} from "../../../../util/fetch";
-import {createAVMapHost, isAVMapHostEnvironmentSupported} from "./host";
-import type {AVMapHost} from "./host";
-import {createDesktopAVMapHost, isDesktopAVMapHostSupported} from "./desktopTransport";
-import {AV_MAP_ATTRIBUTION_LINKS, sanitizeAVMapPoints} from "./protocol";
-import type {AVMapCoordinate} from "./protocol";
-import {canLoadMapHost} from "./state";
-
-interface AVLocationPickerOptions {
- canvas: HTMLElement;
- status: HTMLElement;
- point?: AVMapCoordinate;
- isCurrent: () => boolean;
- onPick: (point: AVMapCoordinate) => boolean;
-}
-
-// 地图仅接收固定草稿标识和坐标,不传递地点名称、来源或数据库内容。
-const getPoints = (point?: AVMapCoordinate) => point ? sanitizeAVMapPoints([
- {id: "location-draft", longitude: point.longitude, latitude: point.latitude},
-]) : [];
-
-export const createAVLocationPicker = (options: AVLocationPickerOptions) => {
- const languages = window.siyuan.languages;
- const getTheme = () => document.documentElement.getAttribute("data-theme-mode") === "dark" ? "dark" : "light";
- let host: AVMapHost;
- let themeObserver: MutationObserver;
- let disposed = false;
- let failed = false;
- let revision = 0;
- let points = getPoints(options.point);
- const offline = () => fallback(languages.mapOffline);
- const releaseHost = () => {
- revision++;
- const previous = host;
- host = undefined;
- themeObserver?.disconnect();
- themeObserver = undefined;
- window.removeEventListener("offline", offline);
- previous?.destroy();
- };
- const destroy = () => {
- if (disposed) return;
- disposed = true;
- releaseHost();
- };
- const current = () => {
- if (disposed || failed) return false;
- if (options.isCurrent()) return true;
- destroy();
- return false;
- };
- const fallback = (message: string) => {
- if (!current()) return;
- failed = true;
- releaseHost();
- options.status.textContent = message;
- options.canvas.classList.add("fn__none");
- };
- const setPoint = (point?: AVMapCoordinate) => {
- if (!current()) return;
- points = getPoints(point);
- host?.setPoints(points, ++revision);
- };
- const start = async () => {
- if (!current()) return;
- if (window.siyuan.isPublish) {
- fallback(languages.mapPublicFallback);
- return;
- }
- if (!canLoadMapHost(window.location.protocol)) {
- fallback(languages.mapUnsupportedClient);
- return;
- }
- if (!navigator.onLine) {
- fallback(languages.mapOffline);
- return;
- }
- options.status.textContent = languages.mapLoading;
- window.addEventListener("offline", offline);
- const desktop = await isDesktopAVMapHostSupported();
- if (!current()) return;
- const supported = desktop || await isAVMapHostEnvironmentSupported();
- if (!current()) return;
- if (!supported) {
- fallback(languages.mapUnsupportedClient);
- return;
- }
- if (!navigator.onLine) {
- fallback(languages.mapOffline);
- return;
- }
- const response = await fetchSyncPost("/api/map/getRuntime", {});
- if (!current()) return;
- if (response.code !== 0 || response.data?.provider !== "openfreemap") {
- fallback(response.msg === "mapAuthenticationBypass" ? languages.mapAuthenticationBypass : languages.mapLoadError);
- return;
- }
- options.canvas.classList.remove("fn__none");
- const nextHost = (desktop ? createDesktopAVMapHost : createAVMapHost)(options.canvas, {
- provider: "openfreemap",
- theme: getTheme(),
- title: languages.locationPickOnMap,
- onReady: () => {
- if (current()) options.status.textContent = "";
- },
- onMarkerClick: () => {},
- onPointClick: (point, pointRevision) => {
- if (!current() || pointRevision !== revision) return;
- const selected = getPoints(point)[0];
- if (!selected) return;
- const coordinates = {longitude: selected.longitude, latitude: selected.latitude};
- if (options.onPick(coordinates)) setPoint(coordinates);
- },
- onAttributionClick: id => {
- if (!current()) return;
- const link = AV_MAP_ATTRIBUTION_LINKS.openfreemap.find(item => item.id === id);
- if (link) window.open(link.href, "_blank", "noopener,noreferrer");
- },
- onError: () => fallback(navigator.onLine ? languages.mapLoadError : languages.mapOffline),
- });
- if (!current()) {
- nextHost.destroy();
- return;
- }
- host = nextHost;
- host.setPoints(points, ++revision);
- themeObserver = new MutationObserver(() => {
- if (current()) host?.setTheme(getTheme());
- });
- themeObserver.observe(document.documentElement, {attributes: true, attributeFilter: ["data-theme-mode"]});
- };
- void start().catch(() => fallback(navigator.onLine ? languages.mapLoadError : languages.mapOffline));
- return {setPoint, destroy};
-};
diff --git a/app/src/protyle/render/av/map/openRecord.ts b/app/src/protyle/render/av/map/openRecord.ts
deleted file mode 100644
index c5aa3efeb4..0000000000
--- a/app/src/protyle/render/av/map/openRecord.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import {openDatabaseRowByData} from "../openDatabaseRow";
-
-export const openMapRecord = (protyle: IProtyle, blockElement: HTMLElement, row: IAVRow, keyID?: string) => {
- const primary = row?.cells.find(cell => cell.valueType === "block" || cell.value?.type === "block");
- if (!primary?.value) {
- return false;
- }
- return openDatabaseRowByData(protyle, {
- avID: blockElement.dataset.avId, databaseBlockID: blockElement.dataset.nodeId, notebookID: protyle.notebookId,
- itemID: row.id, valueID: primary.id || primary.value.id,
- title: primary.value.block?.content || window.siyuan.languages.untitled,
- boundBlockID: primary.value.block?.id, isDetached: !!primary.value.isDetached,
- focusPrimary: !keyID, matchedKeyID: keyID,
- });
-};
diff --git a/app/src/protyle/render/av/map/pointPicking.test.ts b/app/src/protyle/render/av/map/pointPicking.test.ts
deleted file mode 100644
index c36b57eb3e..0000000000
--- a/app/src/protyle/render/av/map/pointPicking.test.ts
+++ /dev/null
@@ -1,400 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {describe, it} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import * as escape from "../../../../util/escape";
-import * as locationValue from "../locationValue";
-import * as protocol from "./protocol";
-import {getMapSettings} from "./state";
-import {DOMElement, DOMFixture, requireFixture} from "./testDOM";
-
-const compile = (file: string) => transpileModule(readFileSync(file, "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2020},
-}).outputText;
-
-const setup = () => {
- const document = new DOMFixture();
- const editor = document.createElement("div");
- editor.className = "protyle-wysiwyg";
- document.body.append(editor);
- const otherEditor = document.createElement("div");
- otherEditor.className = "protyle-wysiwyg";
- document.body.append(otherEditor);
- const block = document.createElement("div");
- block.dataset.nodeId = "carrier";
- block.dataset.avId = "database";
- block.setAttribute("custom-sy-av-view", "map-view");
- block.setAttribute("updated", "20261010120000");
- block.setAttribute("data-render", "true");
- editor.append(block);
- const canvas = document.createElement("div");
- block.append(canvas);
- const protyle = {options: {}, notebookId: "notebook"} as IProtyle;
- const data = {id: "database", viewID: "map-view", viewType: "map", view: {
- columns: [{id: "location", name: "Location", type: "location"}], map: {locationKeyID: "location"}, rows: [],
- }} as IAV;
- const view = data.view as IAVTable;
- const sharedMenu = {data: undefined as Element, element: document.createElement("div"), remove: () => {}};
- sharedMenu.element.classList.add("fn__none");
- const context = {siyuan: {
- menus: {menu: sharedMenu},
- isPublish: false,
- config: {readonly: false},
- notebooks: [{id: "notebook", encrypted: true, closed: false}],
- languages: new Proxy<Record<string, string>>({}, {get: (_target, key: string) => key}),
- }};
- const copied: string[] = [];
- const opened: Array<Parameters<typeof import("../openDatabaseRow").openDatabaseRowByData>[1]> = [];
- const transactions: Array<{perform: IOperation[]; undo: IOperation[]; callback: () => void; resolve: () => void}> = [];
- const menus: MenuStub[] = [];
- let current = true;
- let pending = Promise.resolve();
- let nextID = 0;
- let renders = 0;
- let throwTransaction = false;
- class MenuStub {
- items: Array<{option: IMenu; element: DOMElement}> = [];
- closes = 0;
- position: IPosition;
- constructor(_id?: string, private onClose?: () => void) { sharedMenu.remove(); menus.push(this); }
- addItem(option: IMenu) {
- const element = document.createElement("button");
- element.innerHTML = option.label || "";
- document.body.append(element);
- this.items.push({option, element});
- return element;
- }
- open(position: IPosition) { this.position = position; sharedMenu.element.classList.remove("fn__none"); }
- close() {
- if (this.closes) return;
- this.closes++;
- sharedMenu.data = undefined;
- sharedMenu.element.classList.add("fn__none");
- this.items.forEach(item => item.element.remove());
- this.onClose?.();
- }
- item(label: string) { return this.items.find(item => item.option.label === label); }
- click(label: string) {
- const item = this.item(label);
- assert.ok(item, `Missing point menu item: ${label}`);
- return item.option.click?.(item.element as unknown as HTMLElement, {} as MouseEvent);
- }
- }
- sharedMenu.remove = () => {
- menus[menus.length - 1]?.close();
- sharedMenu.data = undefined;
- sharedMenu.element.classList.add("fn__none");
- };
- const menuToggle = {} as typeof import("../../../../menus/menuToggle");
- runInNewContext(compile("src/menus/menuToggle.ts"), {exports: menuToggle, window: context});
- const modules: Record<string, unknown> = {
- dayjs: () => ({format: () => "20261011090000"}),
- "../../../../plugin/Menu": {Menu: MenuStub},
- "../../../../menus/menuToggle": menuToggle,
- "../../../../menus/Menu": {MenuItem: class {}},
- "../../../../util/escape": escape,
- "../../../../util/functions": {isMobile: () => false},
- "../../../util/compatibility": {writeText: (text: string) => copied.push(text)},
- "../../../util/transactionQueue": {waitForPendingTransactions: () => pending},
- "../../../wysiwyg/transaction": {transaction: (_protyle: IProtyle, perform: IOperation[], undo: IOperation[],
- options: {callback: () => void}) => {
- if (throwTransaction) throw new Error("Transaction rejected");
- pending = new Promise(resolve => transactions.push({perform, undo, callback: options.callback, resolve}));
- }},
- "../filteredTip": {
- getAVFilteredTipContext: (scope: string, owner: IProtyle) => {
- assert.equal(scope, "target");
- assert.equal(owner, protyle);
- return {filteredTipScope: "target", filteredTipToken: "filtered-token"};
- },
- getAVViewID: (element: DOMElement) => element.getAttribute("custom-sy-av-view"),
- },
- "../locationValue": locationValue,
- "../openDatabaseRow": {openDatabaseRowByData: (_protyle: IProtyle, value: typeof opened[number]) => opened.push(value)},
- "../render": {avRender: () => { renders++; }},
- "./protocol": protocol,
- "./state": {getMapSettings},
- };
- const settings = {} as typeof import("./settings");
- runInNewContext(compile("src/protyle/render/av/map/settings.ts"), {
- exports: settings, require: requireFixture(modules), window: context,
- });
- modules["./settings"] = settings;
- const methods = {} as typeof import("./pointPicking");
- runInNewContext(compile("src/protyle/render/av/map/pointPicking.ts"), {
- exports: methods, require: requireFixture(modules), window: context, Lute: {NewNodeID: () => `generated-${++nextID}`},
- });
- const binding = methods.bindMapPointPicking({canvas: canvas as unknown as HTMLElement,
- blockElement: block as unknown as HTMLElement, protyle, data, current: () => current});
- return {binding, methods, block, canvas, data, view, context, protyle, copied, opened, transactions, menus,
- stale: () => { current = false; },
- reparent: () => otherEditor.append(block),
- setTransactionFailure: (fail: boolean) => { throwTransaction = fail; },
- renders: () => renders,
- menu: () => menus[menus.length - 1],
- settle: () => new Promise<void>(resolve => setImmediate(resolve)),
- complete: async (success = true) => {
- const batch = transactions[transactions.length - 1];
- if (success) batch.callback();
- batch.resolve();
- await new Promise<void>(resolve => setImmediate(resolve));
- },
- create: (location: IAVCellLocationValue = {longitude: 120.5, latitude: 30.25}) =>
- methods.createMapRecordAtPoint({protyle, blockElement: block as unknown as HTMLElement,
- avID: "database", viewID: "map-view", locationKeyID: "location", location, current: () => current}),
- };
-};
-
-describe("map point actions", () => {
- it("copies canonical WGS84 text and only uses escaped names already held in the parent view", () => {
- const scenario = setup();
- const location = {name: ' <img src=x onerror="alert(1)"> & Office ', longitude: 120.5, latitude: 30.25,
- originalInput: "Private source"};
- scenario.view.rows.push({id: "row", cells: [{value: {type: "location", keyID: "location", location}}]} as IAVRow);
- scenario.binding.show({longitude: 120.5, latitude: 30.25, name: "Untrusted supplier name"} as protocol.AVMapCoordinate);
- const menu = scenario.menu();
- const canonical = locationValue.getAVLocationText(location);
- assert.equal(menu.items[1].option.label, escape.escapeHtml(canonical));
- assert.equal(menu.items[1].element.children.length, 0);
- assert.equal(menu.position.target, scenario.canvas);
- menu.click("copy");
- assert.deepEqual(scenario.copied, [canonical]);
- assert.match(canonical, /30\.25, 120\.5 \[WGS84\]$/);
- assert.doesNotMatch(canonical, /Private source|Untrusted supplier/);
- assert.equal(scenario.transactions.length, 0);
- });
-
- it("offers copying without creation in readonly, published and history contexts", () => {
- for (const mode of ["readonly", "global-readonly", "published", "created", "snapshot"]) {
- const scenario = setup();
- if (mode === "readonly") scenario.protyle.disabled = true;
- else if (mode === "global-readonly") scenario.context.siyuan.config.readonly = true;
- else if (mode === "published") scenario.context.siyuan.isPublish = true;
- else scenario.protyle.options.history = {[mode]: "history"};
- scenario.binding.show({longitude: 0, latitude: 0});
- assert.equal(scenario.menu().item("mapCreateAtPoint"), undefined);
- scenario.menu().click("copy");
- assert.deepEqual(scenario.copied, ["0, 0 [WGS84]"]);
- assert.equal(scenario.transactions.length, 0);
- }
- });
-
- it("never exposes actions for invalid points or a stale, detached, reidentified, switched or locked owner", () => {
- for (const point of [{longitude: 181, latitude: 0}, {longitude: NaN, latitude: 0},
- {longitude: 0, latitude: 86}, {longitude: 0, latitude: Infinity},
- {longitude: 0, latitude: 0, coordinateSystem: "GCJ02"}]) {
- const scenario = setup();
- scenario.binding.show(point);
- assert.equal(scenario.menus.length, 0);
- }
- for (const mode of ["stale", "detached", "carrier", "database", "view", "field", "editor", "notebook", "locked"]) {
- const scenario = setup();
- if (mode === "stale") scenario.stale();
- else if (mode === "detached") scenario.block.remove();
- else if (mode === "carrier") scenario.block.dataset.nodeId = "other-carrier";
- else if (mode === "database") scenario.block.dataset.avId = "other-database";
- else if (mode === "view") scenario.block.setAttribute("custom-sy-av-view", "other-view");
- else if (mode === "field") scenario.view.map.locationKeyID = "other-field";
- else if (mode === "editor") scenario.reparent();
- else if (mode === "notebook") scenario.protyle.notebookId = "other-notebook";
- else scenario.context.siyuan.notebooks[0].closed = true;
- scenario.binding.show({longitude: 0, latitude: 0});
- assert.equal(scenario.menus.length, 0, mode);
- }
- });
-
- it("revalidates owner and editability before actions from an already open menu", () => {
- for (const mode of ["stale", "view", "editor", "notebook", "locked", "readonly", "global-readonly", "published", "history"]) {
- const scenario = setup();
- scenario.binding.show({longitude: 0, latitude: 0});
- if (mode === "stale") scenario.stale();
- else if (mode === "view") scenario.block.setAttribute("custom-sy-av-view", "other-view");
- else if (mode === "editor") scenario.reparent();
- else if (mode === "notebook") scenario.protyle.notebookId = "other-notebook";
- else if (mode === "locked") scenario.context.siyuan.notebooks[0].closed = true;
- else if (mode === "readonly") scenario.protyle.disabled = true;
- else if (mode === "global-readonly") scenario.context.siyuan.config.readonly = true;
- else if (mode === "published") scenario.context.siyuan.isPublish = true;
- else scenario.protyle.options.history = {created: "history"};
- scenario.menu().click("mapCreateAtPoint");
- assert.equal(scenario.transactions.length, 0, mode);
- if (["stale", "view", "editor", "notebook", "locked"].includes(mode)) {
- scenario.menu().click("copy");
- assert.equal(scenario.copied.length, 0, mode);
- }
- }
- });
-
- it("creates the detached row and full coordinate replacement in one transaction and one remove undo", async () => {
- const scenario = setup();
- scenario.binding.show({longitude: 120.5, latitude: 30.25});
- scenario.menu().click("mapCreateAtPoint");
- assert.equal(scenario.transactions.length, 1);
- const batch = scenario.transactions[0];
- assert.deepEqual(Array.from(batch.perform, operation => operation.action),
- ["insertAttrViewBlock", "updateAttrViewCell", "doUpdateUpdated"]);
- const [insert, update] = batch.perform;
- assert.equal(insert.avID, "database");
- assert.equal(insert.blockID, "carrier");
- assert.equal(insert.viewID, "map-view");
- assert.equal(insert.srcs.length, 1);
- assert.equal(insert.srcs[0].isDetached, true);
- assert.equal(insert.srcs[0].content, "");
- assert.equal(update.rowID, insert.srcs[0].itemID);
- assert.equal(update.keyID, "location");
- assert.deepEqual(JSON.parse(JSON.stringify(update.data)), {id: update.id, keyID: "location",
- blockID: insert.srcs[0].itemID, type: "location", location: {
- longitude: 120.5, latitude: 30.25, name: "", originalInput: "",
- }});
- assert.deepEqual(JSON.parse(JSON.stringify(batch.undo)), [
- {action: "removeAttrViewBlock", avID: "database", blockID: "carrier", srcIDs: [insert.srcs[0].itemID]},
- {action: "doUpdateUpdated", id: "carrier", data: "20261010120000"},
- ]);
- assert.equal(scenario.opened.length, 0);
- await scenario.complete();
- assert.equal(scenario.renders(), 1);
- assert.equal(scenario.block.getAttribute("updated"), "20261011090000");
- assert.equal(scenario.block.hasAttribute("data-render"), false);
- assert.equal(scenario.opened.length, 1);
- assert.equal(scenario.opened[0].itemID, insert.srcs[0].itemID);
- assert.equal(scenario.opened[0].focusPrimary, true);
- assert.equal(scenario.opened[0].isDetached, true);
- });
-
- it("prevents duplicate creation until the transaction settles and permits retry after failure", async () => {
- const scenario = setup();
- scenario.binding.show({longitude: 0, latitude: 0});
- const menu = scenario.menu();
- menu.click("mapCreateAtPoint");
- menu.click("mapCreateAtPoint");
- scenario.binding.show({longitude: 1, latitude: 1});
- assert.equal(scenario.menu().item("mapCreateAtPoint"), undefined);
- assert.equal(scenario.transactions.length, 1);
- await scenario.complete(false);
- assert.equal(scenario.opened.length, 0);
- assert.equal(scenario.renders(), 0);
- scenario.binding.show({longitude: 1, latitude: 1});
- scenario.menu().click("mapCreateAtPoint");
- assert.equal(scenario.transactions.length, 2);
- await scenario.complete();
- assert.equal(scenario.opened.length, 1);
- });
-
- it("catches immediate transaction errors and restores the creation action", async () => {
- const scenario = setup();
- scenario.setTransactionFailure(true);
- scenario.binding.show({longitude: 0, latitude: 0});
- scenario.menu().click("mapCreateAtPoint");
- await scenario.settle();
- assert.equal(scenario.transactions.length, 0);
- assert.equal(scenario.opened.length, 0);
- scenario.setTransactionFailure(false);
- scenario.binding.show({longitude: 1, latitude: 1});
- scenario.menu().click("mapCreateAtPoint");
- assert.equal(scenario.transactions.length, 1);
- await scenario.complete();
- });
-
- it("does not reopen a row after success when its carrier, view, editability or notebook access changed", async () => {
- for (const mode of ["detached", "carrier", "database", "view", "editor", "notebook", "readonly", "global-readonly", "history", "locked"]) {
- const scenario = setup();
- const result = scenario.create();
- assert.equal(scenario.transactions.length, 1);
- if (mode === "detached") scenario.block.remove();
- else if (mode === "carrier") scenario.block.dataset.nodeId = "other-carrier";
- else if (mode === "database") scenario.block.dataset.avId = "other-database";
- else if (mode === "view") scenario.block.setAttribute("custom-sy-av-view", "other-view");
- else if (mode === "editor") scenario.reparent();
- else if (mode === "notebook") scenario.protyle.notebookId = "other-notebook";
- else if (mode === "readonly") scenario.protyle.disabled = true;
- else if (mode === "global-readonly") scenario.context.siyuan.config.readonly = true;
- else if (mode === "history") scenario.protyle.options.history = {snapshot: "history"};
- else scenario.context.siyuan.notebooks[0].closed = true;
- await scenario.complete();
- assert.equal(await result, true);
- assert.equal(scenario.opened.length, 0, mode);
- assert.equal(scenario.renders(), 0, mode);
- }
- });
-
- it("still opens a successful new row when only its old map lifecycle was replaced", async () => {
- const scenario = setup();
- const result = scenario.create();
- scenario.stale();
- await scenario.complete();
- assert.equal(await result, true);
- assert.equal(scenario.opened.length, 1);
- });
-
- it("rejects invalid locations and unavailable owners when record creation is invoked directly", async () => {
- for (const location of [{longitude: 181, latitude: 0}, {longitude: 0}, {longitude: 0, latitude: 90},
- {longitude: 0, latitude: 0, name: 42}]) {
- const scenario = setup();
- assert.equal(await scenario.create(location as IAVCellLocationValue), false);
- assert.equal(scenario.transactions.length, 0);
- }
- for (const mode of ["stale", "detached", "database", "view", "locked", "readonly", "published", "history"]) {
- const scenario = setup();
- if (mode === "stale") scenario.stale();
- else if (mode === "detached") scenario.block.remove();
- else if (mode === "database") scenario.block.dataset.avId = "other-database";
- else if (mode === "view") scenario.block.setAttribute("custom-sy-av-view", "other-view");
- else if (mode === "locked") scenario.context.siyuan.notebooks[0].closed = true;
- else if (mode === "readonly") scenario.protyle.disabled = true;
- else if (mode === "published") scenario.context.siyuan.isPublish = true;
- else scenario.protyle.options.history = {created: "history"};
- const result = scenario.create();
- assert.equal(scenario.transactions.length, 0, mode);
- assert.equal(await result, false, mode);
- }
- const failed = setup();
- const result = failed.create();
- await failed.complete(false);
- assert.equal(await result, false);
- assert.equal(failed.opened.length, 0);
- });
-
- it("replaces the existing menu and closes it once on disposal, disabling old callbacks", () => {
- const scenario = setup();
- scenario.binding.show({longitude: 0, latitude: 0});
- const first = scenario.menu();
- scenario.binding.show({longitude: 1, latitude: 1});
- const second = scenario.menu();
- assert.equal(first.closes, 1);
- assert.equal(second.closes, 0);
- assert.equal(scenario.context.siyuan.menus.menu.data, scenario.canvas);
- assert.equal(scenario.canvas.hasAttribute("data-menu"), false);
- first.click("copy");
- first.click("mapCreateAtPoint");
- assert.equal(scenario.copied.length, 0);
- assert.equal(scenario.transactions.length, 0);
- scenario.binding.destroy();
- scenario.binding.destroy();
- assert.equal(second.closes, 1);
- assert.equal(scenario.context.siyuan.menus.menu.data, undefined);
- second.click("copy");
- second.click("mapCreateAtPoint");
- scenario.binding.show({longitude: 2, latitude: 2});
- assert.equal(scenario.menus.length, 2);
- assert.equal(scenario.copied.length, 0);
- assert.equal(scenario.transactions.length, 0);
- });
-
- it("dismissal clears shared ownership and cannot revive actions from the retired menu", () => {
- const scenario = setup();
- scenario.binding.show({longitude: 0, latitude: 0});
- const menu = scenario.menu();
- scenario.context.siyuan.menus.menu.remove();
- assert.equal(scenario.context.siyuan.menus.menu.data, undefined);
- menu.click("copy");
- menu.click("mapCreateAtPoint");
- assert.equal(scenario.copied.length, 0);
- assert.equal(scenario.transactions.length, 0);
- scenario.binding.show({longitude: 1, latitude: 1});
- assert.equal(scenario.menu().closes, 0);
- scenario.menu().click("copy");
- assert.deepEqual(scenario.copied, ["1, 1 [WGS84]"]);
- scenario.binding.destroy();
- });
-});
diff --git a/app/src/protyle/render/av/map/pointPicking.ts b/app/src/protyle/render/av/map/pointPicking.ts
deleted file mode 100644
index 04f1421e75..0000000000
--- a/app/src/protyle/render/av/map/pointPicking.ts
+++ /dev/null
@@ -1,130 +0,0 @@
-import * as dayjs from "dayjs";
-import {Menu} from "../../../../plugin/Menu";
-import {toggleMenu} from "../../../../menus/menuToggle";
-import {escapeHtml} from "../../../../util/escape";
-import {writeText} from "../../../util/compatibility";
-import {waitForPendingTransactions} from "../../../util/transactionQueue";
-import {transaction} from "../../../wysiwyg/transaction";
-import {getAVFilteredTipContext, getAVViewID} from "../filteredTip";
-import {createAVLocationReplacement, getAVLocationText, validateAVLocation} from "../locationValue";
-import {openDatabaseRowByData} from "../openDatabaseRow";
-import {avRender} from "../render";
-import {AVMapCoordinate, parseAVMapCoordinate} from "./protocol";
-import {canEditMapSettings} from "./settings";
-import {getMapSettings} from "./state";
-
-const isNotebookLocked = (protyle: IProtyle) => window.siyuan.notebooks?.some(notebook =>
- notebook.id === protyle.notebookId && notebook.encrypted && notebook.closed);
-const editable = (protyle: IProtyle) => canEditMapSettings(protyle) && !window.siyuan.config?.readonly;
-
-// 使用既有插入与单元格事务一次写入坐标,撤销时完整移除新建游离条目。
-export const createMapRecordAtPoint = async (options: {
- protyle: IProtyle;
- blockElement: HTMLElement;
- avID: string;
- viewID: string;
- locationKeyID: string;
- location: IAVCellLocationValue;
- current: () => boolean;
-}) => {
- const {protyle, blockElement, avID, viewID, locationKeyID, current} = options;
- if (!current() || !blockElement.isConnected || blockElement.dataset.avId !== avID ||
- getAVViewID(blockElement) !== viewID || !editable(protyle) || isNotebookLocked(protyle) ||
- !parseAVMapCoordinate(options.location) ||
- !validateAVLocation(options.location)) return false;
- const location = createAVLocationReplacement(options.location);
- const itemID = Lute.NewNodeID();
- const valueID = Lute.NewNodeID();
- const blockID = blockElement.dataset.nodeId;
- const editorElement = blockElement.closest(".protyle-wysiwyg");
- const notebookID = protyle.notebookId;
- const updated = dayjs().format("YYYYMMDDHHmmss");
- let committed = false;
- transaction(protyle, [{
- action: "insertAttrViewBlock", avID, blockID, viewID, previousID: "",
- srcs: [{itemID, id: Lute.NewNodeID(), isDetached: true, content: ""}],
- context: getAVFilteredTipContext("target", protyle),
- }, {
- action: "updateAttrViewCell", avID, blockID, rowID: itemID, keyID: locationKeyID, id: valueID,
- data: {id: valueID, keyID: locationKeyID, blockID: itemID, type: "location", location},
- }, {action: "doUpdateUpdated", id: blockID, data: updated}], [
- {action: "removeAttrViewBlock", avID, blockID, srcIDs: [itemID]},
- {action: "doUpdateUpdated", id: blockID, data: blockElement.getAttribute("updated")},
- ], {callback: () => {
- committed = true;
- // 写入已成功时不依赖旧地图实例仍存在;导航到其他数据库或历史后不再打开条目。
- if (!blockElement.isConnected || blockElement.dataset.avId !== avID || blockElement.dataset.nodeId !== blockID ||
- blockElement.closest(".protyle-wysiwyg") !== editorElement || protyle.notebookId !== notebookID ||
- getAVViewID(blockElement) !== viewID || !editable(protyle) || isNotebookLocked(protyle)) return;
- blockElement.setAttribute("updated", updated);
- blockElement.removeAttribute("data-render");
- avRender(blockElement, protyle);
- void openDatabaseRowByData(protyle, {avID, databaseBlockID: blockID, notebookID,
- itemID, valueID: "", title: window.siyuan.languages.untitled, isDetached: true, focusPrimary: true});
- }});
- await waitForPendingTransactions(protyle);
- return committed;
-};
-
-export const bindMapPointPicking = (options: {
- canvas: HTMLElement;
- blockElement: HTMLElement;
- protyle: IProtyle;
- data: IAV;
- current: () => boolean;
-}) => {
- const {canvas, blockElement, protyle, data, current} = options;
- const view = data.view as IAVTable;
- const locationKeyID = getMapSettings(view).locationKeyID;
- const avID = data.id, viewID = data.viewID, blockID = blockElement.dataset.nodeId;
- const editorElement = blockElement.closest(".protyle-wysiwyg");
- const notebookID = protyle.notebookId;
- let destroyed = false, pending = false;
- let menu: Menu;
- const available = () => !destroyed && current() && blockElement.isConnected &&
- blockElement.dataset.avId === avID && blockElement.dataset.nodeId === blockID &&
- blockElement.closest(".protyle-wysiwyg") === editorElement && protyle.notebookId === notebookID &&
- getAVViewID(blockElement) === viewID &&
- data.view === view && data.viewID === viewID && getMapSettings(view).locationKeyID === locationKeyID &&
- view.columns.some(column => column.id === locationKeyID && column.type === "location") &&
- !isNotebookLocked(protyle);
- return {
- show: (input: AVMapCoordinate) => {
- const point = parseAVMapCoordinate(input);
- if (!point || !available()) return;
- menu?.close();
- // 既有地点名称只在父页面查找,不读取或转发供应商返回的要素属性。
- const location = view.rows.map(row => row.cells.find(cell => cell.value?.keyID === locationKeyID)?.value?.location)
- .find(value => validateAVLocation(value) && value?.longitude === point.longitude &&
- value.latitude === point.latitude && value.name?.trim());
- const selected = {...point, name: location?.name || ""};
- const text = getAVLocationText(selected);
- // 地图的每次选点替换坐标菜单,不将整个画布当作重复点击关闭按钮。
- toggleMenu({target: canvas, toggle: false, build: (_shared, session) => {
- menu = new Menu(undefined, () => { menu = undefined; });
- menu.addItem({type: "readonly", iconHTML: "", label: escapeHtml(window.siyuan.languages.mapPickedPoint)});
- menu.addItem({type: "readonly", iconHTML: "", label: escapeHtml(text)});
- menu.addItem({icon: "iconCopy", label: window.siyuan.languages.copy, click: () => {
- if (session.isCurrent() && available()) writeText(text);
- }});
- if (editable(protyle) && !pending) {
- menu.addItem({icon: "iconAdd", label: window.siyuan.languages.mapCreateAtPoint, click: () => {
- if (!session.isCurrent() || !available() || !editable(protyle) || pending) return;
- pending = true;
- void createMapRecordAtPoint({protyle, blockElement, avID, viewID, locationKeyID,
- location: selected, current: available}).catch(() => {
- // 事务层负责失败提示,保留地图供用户重新选择或重试。
- }).finally(() => { pending = false; });
- }});
- }
- }, show: () => {
- const rect = canvas.getBoundingClientRect();
- menu.open({x: rect.left + rect.width / 2, y: rect.top + rect.height / 2, target: canvas});
- }});
- },
- destroy: () => {
- destroyed = true;
- menu?.close();
- },
- };
-};
diff --git a/app/src/protyle/render/av/map/protocol.test.ts b/app/src/protyle/render/av/map/protocol.test.ts
deleted file mode 100644
index 02a914a098..0000000000
--- a/app/src/protyle/render/av/map/protocol.test.ts
+++ /dev/null
@@ -1,272 +0,0 @@
-import * as assert from "node:assert/strict";
-import {describe, it} from "node:test";
-import {
- AV_MAP_ATTRIBUTION_LINKS, AV_MAP_MERCATOR_MAX_LATITUDE, AVMapLoadError, getAVMapLoadErrorCode,
- isAVMapBootstrapMessage, isAVMapHostErrorCode, isAVMapProjectionSupported,
- parseAVMapCommand, parseAVMapReply, sanitizeAVMapPoints,
-} from "./protocol";
-import {AV_MAP_BOOTSTRAP_TIMEOUT, AV_MAP_HOST_READY_TIMEOUT, AV_MAP_OWNER_TIMEOUT, AV_MAP_READY_TIMEOUT} from "./loadingBudget";
-import {getAVMapLockedPolicy} from "./bootstrap";
-
-describe("isolated map protocol", () => {
- const point = {id: "row-1", longitude: 0, latitude: 0};
- it("enables picking explicitly and shares a bounded coordinate reply whitelist with Electron", () => {
- const {parseMapCreate, parseMapReply} = require("../../../../../electron/mapHostPolicy");
- const init = {version: 1, instanceID: "a".repeat(48), type: "init", provider: "openfreemap", theme: "light"};
- for (const picking of [undefined, false, true]) {
- const expected = {...init, ...(picking && {picking: true})};
- assert.deepEqual(parseAVMapCommand({...init, picking}, init.instanceID), expected);
- assert.deepEqual(parseMapCreate({...init, picking}), expected);
- }
- for (const picking of ["true", 1, null, {}]) {
- assert.equal(parseAVMapCommand({...init, picking}, init.instanceID), undefined);
- assert.equal(parseMapCreate({...init, picking}), undefined);
- }
- const reply = {version: 1, instanceID: init.instanceID, type: "pointClick", revision: 0,
- longitude: 180, latitude: AV_MAP_MERCATOR_MAX_LATITUDE};
- for (const parse of [parseAVMapReply, parseMapReply]) {
- assert.deepEqual(parse({...reply, name: "private", url: "https://private.invalid"}, init.instanceID), reply);
- for (const invalid of [{longitude: 181}, {latitude: 90}, {latitude: Infinity}, {longitude: NaN},
- {longitude: "0"}, {latitude: null}, {revision: -1}, {revision: 1.5}, {coordinateSystem: "wgs84"},
- {coordinateSystem: undefined}, {version: 2}, {instanceID: "foreign"}]) {
- assert.equal(parse({...reply, ...invalid}, init.instanceID), undefined);
- }
- }
- });
- it("keeps attribution destinations in a fixed official allowlist", () => {
- assert.deepEqual(AV_MAP_ATTRIBUTION_LINKS.openfreemap.map((link) => link.href), [
- "https://openfreemap.org", "https://www.openmaptiles.org/", "https://www.openstreetmap.org/copyright", "https://maplibre.org/",
- ]);
- assert.deepEqual(Object.keys(AV_MAP_ATTRIBUTION_LINKS), ["openfreemap"]);
- Object.values(AV_MAP_ATTRIBUTION_LINKS).flat().forEach((link) => {
- assert.equal(new URL(link.href).protocol, "https:");
- assert.equal(/[<>]/.test(link.label), false);
- });
- });
- it("accepts only fixed attribution identifiers across both protocol boundaries", () => {
- const {parseMapReply, parseMapCommand} = require("../../../../../electron/mapHostPolicy");
- for (const {id: link} of AV_MAP_ATTRIBUTION_LINKS.openfreemap) {
- const reply = {version: 1, instanceID: "one", type: "attributionClick", link};
- assert.deepEqual(parseAVMapReply({...reply, href: "https://evil.invalid/", url: "private"}, "one"), reply);
- assert.deepEqual(parseMapReply({...reply, href: "https://evil.invalid/", url: "private"}, "one"), reply);
- assert.equal(parseAVMapReply(reply, "old"), undefined);
- }
- for (const link of ["https://maplibre.org/", "https://evil.invalid/", "maplibre?secret", "", {}, null]) {
- const reply = {version: 1, instanceID: "one", type: "attributionClick", link};
- assert.equal(parseAVMapReply(reply, "one"), undefined);
- assert.equal(parseMapReply(reply, "one"), undefined);
- }
- const visibility = {version: 1, instanceID: "one", type: "visibility", visible: true,
- viewport: {x: 0, y: 50, width: 800, height: 550}};
- assert.deepEqual(parseAVMapCommand(visibility, "one"), visibility);
- assert.equal(parseAVMapCommand({...visibility, viewport: {x: 0, y: 0, width: -1, height: 500}}, "one"), undefined);
- for (const value of [NaN, Infinity, "0", -1, 32769]) {
- assert.equal(parseAVMapCommand({...visibility, viewport: {...visibility.viewport, x: value}}, "one"), undefined);
- }
- assert.deepEqual(parseAVMapCommand({...visibility, viewport: {...visibility.viewport, url: "secret"}}, "one"), visibility);
- assert.equal(parseAVMapCommand({...visibility, visible: "true"}, "one"), undefined);
- assert.deepEqual(parseMapCommand(visibility, "one"), visibility, "webview visibility uses the same bounded runtime contract");
- assert.equal(parseMapCommand({...visibility, viewport: {...visibility.viewport, url: "secret"}}, "one"), undefined);
- });
- it("copies only identifiers and WGS84 coordinates", () => {
- const input = {...point, name: "Private place", title: "Private record", document: "secret", token: "secret",
- originalInput: "sensitive source"};
- assert.deepEqual(sanitizeAVMapPoints([input]), [point]);
- });
- it("rejects obsolete coordinate-system messages instead of reinterpreting their coordinates", () => {
- for (const coordinateSystem of ["wgs84", "gcj02", "bd09", "unknown", "", undefined]) {
- assert.deepEqual(sanitizeAVMapPoints([{...point, coordinateSystem}]), []);
- }
- });
- it("accepts zero and coordinate boundaries, rejects malformed numbers, ranges, ids and duplicates", () => {
- assert.equal(sanitizeAVMapPoints([{...point, longitude: -180, latitude: -AV_MAP_MERCATOR_MAX_LATITUDE}]).length, 1);
- assert.equal(sanitizeAVMapPoints([{...point, longitude: 180, latitude: AV_MAP_MERCATOR_MAX_LATITUDE}]).length, 1);
- for (const invalid of [{longitude: 181}, {latitude: -91}, {longitude: NaN}, {latitude: Infinity},
- {latitude: "0"}, {longitude: null}, {id: ""}, {id: "<script>"}, {id: "x".repeat(129)}]) {
- assert.deepEqual(sanitizeAVMapPoints([{...point, ...invalid}]), []);
- }
- assert.deepEqual(sanitizeAVMapPoints([point, point, null, 1]), [point]);
- });
- it("preserves polar coordinates but refuses Web Mercator points that would be silently clamped", () => {
- for (const latitude of [-90, 90, -85.052, 85.052, -Infinity, Infinity, NaN]) {
- assert.equal(isAVMapProjectionSupported(latitude), false);
- const input = {...point, latitude};
- assert.deepEqual(sanitizeAVMapPoints([input]), []);
- assert.equal(Object.is(input.latitude, latitude), true);
- }
- for (const latitude of [0, -AV_MAP_MERCATOR_MAX_LATITUDE, AV_MAP_MERCATOR_MAX_LATITUDE]) {
- assert.equal(isAVMapProjectionSupported(latitude), true);
- assert.deepEqual(sanitizeAVMapPoints([{...point, latitude}]), [{...point, latitude}]);
- }
- });
- it("accepts only the built-in provider and strips credentials and extra init fields", () => {
- const init = {version: 1, instanceID: "one", type: "init", provider: "openfreemap", theme: "light"};
- assert.deepEqual(parseAVMapCommand({...init, credentials: {apiKey: "secret"}, token: "private"}, "one"), init);
- for (const provider of ["amap", "tencent", "baidu", "", undefined]) {
- assert.equal(parseAVMapCommand({...init, provider}, "one"), undefined);
- }
- });
- it("rejects wrong instances, versions, commands and invalid revisions", () => {
- const input = {version: 1, instanceID: "one", type: "setPoints", revision: 2, points: [point]};
- assert.deepEqual(parseAVMapCommand(input, "one", "openfreemap"), input);
- for (const invalid of [{version: 2}, {instanceID: "old"}, {type: "setLocation"}, {revision: -1},
- {revision: 1.1}, {revision: Infinity}, {revision: Number.MAX_SAFE_INTEGER + 1}, {points: {}}]) {
- assert.equal(parseAVMapCommand({...input, ...invalid}, "one", "openfreemap"), undefined);
- }
- assert.equal(parseAVMapCommand(input, "one"), undefined);
- });
- it("does not expose arbitrary SDK errors, URLs, credentials or extra reply fields", () => {
- const reply = {version: 1, instanceID: "one", type: "error", code: "sdkUnavailable"};
- assert.deepEqual(parseAVMapReply({...reply, message: "https://sdk.example/?key=secret"}, "one"), reply);
- assert.equal(parseAVMapReply({...reply, code: "https://sdk.example/?key=secret"}, "one"), undefined);
- assert.equal(parseAVMapReply({...reply, version: 2}, "one"), undefined);
- assert.equal(parseAVMapReply({...reply, instanceID: "old"}, "one"), undefined);
- assert.equal(parseAVMapReply({...reply, type: "updateRow"}, "one"), undefined);
- });
- it("requires the exact nonce and instance during its one-time handshake", () => {
- const handshake = {version: 1, type: "hello", instanceID: "instance", nonce: "nonce"};
- assert.equal(isAVMapBootstrapMessage(handshake, "hello", "instance", "nonce"), true);
- for (const invalid of [{nonce: "old"}, {instanceID: "other"}, {version: 0}, {type: "connect"}]) {
- assert.equal(isAVMapBootstrapMessage({...handshake, ...invalid}, "hello", "instance", "nonce"), false);
- }
- assert.equal(isAVMapBootstrapMessage(structuredClone(Object.assign([], handshake)), "hello", "instance", "nonce"), false);
- });
- it("admits only fixed loading stages and never treats arbitrary SDK exceptions as controlled errors", () => {
- for (const code of ["sdkScriptLoadFailed", "sdkGlobalMissing", "mapCreationFailed", "mapReadyTimeout"] as const) {
- const error = new AVMapLoadError(code);
- assert.equal(getAVMapLoadErrorCode(error), code);
- assert.equal(error.message, "Map loading failed");
- const reply = {version: 1, instanceID: "one", type: "error", code};
- assert.deepEqual(parseAVMapReply({...reply, message: "https://sdk.invalid?key=secret", stack: "secret"}, "one"), reply);
- }
- assert.equal(getAVMapLoadErrorCode(Object.assign(new Error("secret"), {code: "mapCreationFailed"})), undefined);
- assert.equal(getAVMapLoadErrorCode({code: "mapCreationFailed"}), undefined);
- assert.equal(getAVMapLoadErrorCode(Object.assign(new AVMapLoadError("mapCreationFailed"), {code: "secret"})), undefined);
- });
- it("preserves only fixed host failures across the owner and main process boundaries", () => {
- const {parseMapReply} = require("../../../../../electron/mapHostPolicy");
- for (const code of ["hostLimitReached", "hostSetupFailed", "hostAttachFailed", "hostDocumentLoadFailed",
- "hostDocumentLoadTimeout", "hostDocumentReloaded", "hostDocumentMismatch", "hostRendererGone", "hostDestroyed",
- "hostPortSetupFailed", "hostPortClosed", "hostBootstrapFailed", "hostBootstrapTimeout", "hostSDKTimeout",
- "hostOperationFailed", "hostCreateRejected", "hostCreateInvalidResponse", "hostReadyTimeout", "hostOwnerSetupFailed"]) {
- const reply = {version: 1, instanceID: "one", type: "error", code};
- const input = {...reply, message: "https://private.invalid/?key=secret", stack: "secret"};
- assert.equal(isAVMapHostErrorCode(code), true);
- assert.deepEqual(parseAVMapReply(input, "one"), reply);
- assert.deepEqual(parseMapReply(input, "one"), reply);
- assert.equal(parseAVMapReply(input, "other"), undefined);
- }
- for (const code of ["hostSecret", "https://private.invalid/?key=secret", {}, null]) {
- assert.equal(isAVMapHostErrorCode(code), false);
- assert.equal(parseAVMapReply({version: 1, instanceID: "one", type: "error", code}, "one"), undefined);
- }
- });
-});
-
-describe("shared owner and runtime protocol corpus", () => {
- const {parseMapCommand, parseMapReply} = require("../../../../../electron/mapHostPolicy");
- const envelope = {version: 1, instanceID: "one"};
- const point = {id: "row-1", longitude: 0, latitude: 0};
- const commands = [
- (value: unknown) => parseAVMapCommand(value, "one", "openfreemap"),
- (value: unknown) => parseMapCommand(value, "one"),
- ];
- const replies = [(value: unknown) => parseAVMapReply(value, "one"), (value: unknown) => parseMapReply(value, "one")];
- it("keeps desktop and web preparation and readiness budgets aligned and finite", () => {
- const {MAP_HOST_BOOTSTRAP_TIMEOUT, MAP_HOST_READY_TIMEOUT} = require("../../../../../electron/mapHostManager");
- assert.equal(MAP_HOST_BOOTSTRAP_TIMEOUT, AV_MAP_BOOTSTRAP_TIMEOUT);
- assert.equal(MAP_HOST_READY_TIMEOUT, AV_MAP_HOST_READY_TIMEOUT);
- assert.ok(AV_MAP_READY_TIMEOUT < AV_MAP_HOST_READY_TIMEOUT);
- assert.ok(AV_MAP_BOOTSTRAP_TIMEOUT + AV_MAP_HOST_READY_TIMEOUT < AV_MAP_OWNER_TIMEOUT);
- assert.ok(Number.isFinite(AV_MAP_OWNER_TIMEOUT));
- });
- it("only removes resource permissions when the initial desktop policy is locked", () => {
- const {createMapContentSecurityPolicy, mapHostFiles} = require("../../../../../electron/mapHostPolicy");
- const origin = "https://fixture.invalid";
- const directives = (policy: string) => new Map(policy.split(";").map(value => value.trim().split(/\s+/))
- .filter(([name]) => name).map(([name, ...values]) => [name, values]));
- const initial = directives(createMapContentSecurityPolicy(origin));
- const locked = directives(getAVMapLockedPolicy("openfreemap"));
- assert.deepEqual(initial.get("sandbox"), ["allow-scripts"]);
- assert.deepEqual(initial.get("frame-ancestors"), ["'none'"]);
- assert.deepEqual(locked.get("script-src"), ["'none'"]);
- assert.deepEqual(locked.get("connect-src"), ["https://tiles.openfreemap.org"]);
- for (const directive of ["script-src", "connect-src", "img-src", "style-src", "font-src", "worker-src",
- "frame-src", "object-src", "base-uri", "form-action"]) {
- const before = initial.get(directive), after = locked.get(directive);
- assert.ok(before && after);
- for (const source of after) assert.ok(source === "'none'" || before.includes(source), `${directive}: ${source}`);
- }
- for (const sources of locked.values()) assert.equal(sources.some(source => source.includes("fixture.invalid")), false);
- const localSources = [...initial.values()].flat().filter(source => source.startsWith(origin));
- assert.equal(localSources.length, 5);
- for (const source of localSources) assert.ok(Object.prototype.hasOwnProperty.call(mapHostFiles, new URL(source).pathname));
- assert.deepEqual(locked.get("frame-src"), ["'none'"], "child-src must not permit subframe navigation");
- assert.deepEqual(locked.get("worker-src"), ["blob:"], "only prepared blob workers remain available");
- });
- it("uses the same cloned command corpus while copying only allowed fields", () => {
- const setPoints = {...envelope, type: "setPoints", revision: 1, points: [point]};
- const valid = [setPoints, {...envelope, type: "theme", theme: "light"}, {...envelope, type: "theme", theme: "dark"},
- {...envelope, type: "resize"}, {...envelope, type: "destroy"}];
- for (const command of valid) {
- for (const parse of commands) {
- assert.deepEqual(parse(structuredClone({...command, secret: "private"})), command);
- for (const malformed of [null, 1, "command", Object.assign([], command), {...command, version: 2},
- {...command, instanceID: "other"}, {...command, type: "fit"}, {...command, type: "unknown"}]) {
- assert.equal(parse(structuredClone(malformed)), undefined);
- }
- }
- }
- for (const revision of [-1, 1.5, NaN, Infinity, "1", null, Number.MAX_SAFE_INTEGER + 1]) {
- for (const parse of commands) assert.equal(parse({...setPoints, revision}), undefined);
- }
- for (const points of [null, {}, "points"]) {
- for (const parse of commands) assert.equal(parse({...setPoints, points}), undefined);
- }
- for (const theme of [null, {}, "auto", "LIGHT"]) {
- for (const parse of commands) assert.equal(parse({...envelope, type: "theme", theme}), undefined);
- }
- });
- it("rejects malformed point shapes, duplicates and nonprojectable values identically", () => {
- const valid = [point,
- {id: "west", longitude: -180, latitude: -AV_MAP_MERCATOR_MAX_LATITUDE},
- {id: "east", longitude: 180, latitude: AV_MAP_MERCATOR_MAX_LATITUDE}];
- const malformed = [null, 1, "point", Object.assign([], {...point, id: "array"}),
- ...[{longitude: NaN}, {longitude: Infinity}, {longitude: "0"}, {longitude: 181}, {latitude: null},
- {latitude: -86}, {latitude: 90}, {latitude: -Infinity}, {id: ""}, {id: "x".repeat(129)},
- {id: "<script>"}, {coordinateSystem: undefined}].map(value => ({...point, ...value}))];
- const command = {...envelope, type: "setPoints", revision: 0,
- points: [...valid.map(value => ({...value, name: "private", originalInput: "secret"})), point, ...malformed]};
- for (const parse of commands) {
- assert.deepEqual(parse(structuredClone(command)), {...envelope, type: "setPoints", revision: 0, points: valid});
- const points = Array.from({length: 10001}, (_, i) => ({...point, id: `row-${i}`}));
- assert.deepEqual(parse({...command, points}).points, points.slice(0, 10000));
- }
- });
- it("uses the same reply corpus and keeps privileged bootstrap and visibility directions explicit", () => {
- const valid = [{...envelope, type: "ready"}, {...envelope, type: "markerClick", id: point.id, revision: 0},
- ...AV_MAP_ATTRIBUTION_LINKS.openfreemap.map(({id: link}) => ({...envelope, type: "attributionClick", link})),
- {...envelope, type: "error", code: "mapUnavailable"}];
- for (const reply of valid) {
- for (const parse of replies) {
- assert.deepEqual(parse(structuredClone({...reply, url: "private", message: "secret"})), reply);
- for (const malformed of [null, Object.assign([], reply), {...reply, version: 2}, {...reply, instanceID: "other"},
- {...reply, type: "unknown"}]) assert.equal(parse(structuredClone(malformed)), undefined);
- }
- }
- for (const parse of replies) {
- assert.equal(parse({...envelope, type: "error", code: "unknown"}), undefined);
- assert.equal(parse({...envelope, type: "markerClick", id: [], revision: 0}), undefined);
- assert.equal(parse({...envelope, type: "markerClick", id: point.id, revision: NaN}), undefined);
- }
- const bootstrapped = {...envelope, type: "bootstrapReady"};
- assert.deepEqual(parseMapReply(bootstrapped, "one"), bootstrapped);
- assert.equal(parseAVMapReply(bootstrapped, "one"), undefined);
- const visibility = {...envelope, type: "visibility", visible: true};
- assert.deepEqual(parseAVMapCommand(visibility, "one"), visibility);
- assert.deepEqual(parseMapCommand(visibility, "one"), visibility);
- const init = {...envelope, type: "init", provider: "openfreemap", theme: "light"};
- assert.deepEqual(parseAVMapCommand(init, "one"), init);
- assert.equal(parseMapCommand(init, "one"), undefined);
- });
-});
diff --git a/app/src/protyle/render/av/map/protocol.ts b/app/src/protyle/render/av/map/protocol.ts
deleted file mode 100644
index 01333be63d..0000000000
--- a/app/src/protyle/render/av/map/protocol.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-export const AV_MAP_PROTOCOL_VERSION = 1;
-export const AV_MAP_MAX_POINTS = 10000;
-export const AV_MAP_MERCATOR_MAX_LATITUDE = 85.0511287798066;
-
-export type AVMapProvider = "openfreemap";
-export type AVMapTheme = "light" | "dark";
-export type AVMapAttributionLink = "openfreemap" | "openmaptiles" | "openstreetmap" | "maplibre";
-// 可见矩形使用隔离文档视口的 CSS 像素,原生裁剪的平移已包含在 DOM 坐标中。
-export interface AVMapViewport { x: number; y: number; width: number; height: number; }
-export interface AVMapVisibility { visible: boolean; viewport?: AVMapViewport; }
-export type AVMapLoadErrorCode = "sdkScriptLoadFailed" | "sdkGlobalMissing" |
- "mapCreationFailed" | "mapReadyTimeout";
-export type AVMapHostErrorCode = "hostLimitReached" | "hostSetupFailed" | "hostAttachFailed" |
- "hostDocumentLoadFailed" | "hostDocumentLoadTimeout" | "hostDocumentReloaded" | "hostDocumentMismatch" |
- "hostRendererGone" | "hostDestroyed" | "hostPortSetupFailed" | "hostPortClosed" | "hostBootstrapFailed" |
- "hostBootstrapTimeout" | "hostSDKTimeout" | "hostOperationFailed" | "hostCreateRejected" |
- "hostCreateInvalidResponse" | "hostReadyTimeout" | "hostOwnerSetupFailed";
-export type AVMapErrorCode = "unsupportedEnvironment" | "invalidConfiguration" |
- "hostUnavailable" | "sdkUnavailable" | "mapUnavailable" | AVMapLoadErrorCode | AVMapHostErrorCode;
-
-const mapHostErrorCodes = new Set<AVMapHostErrorCode>([
- "hostLimitReached", "hostSetupFailed", "hostAttachFailed", "hostDocumentLoadFailed", "hostDocumentLoadTimeout",
- "hostDocumentReloaded", "hostDocumentMismatch", "hostRendererGone", "hostDestroyed", "hostPortSetupFailed",
- "hostPortClosed", "hostBootstrapFailed", "hostBootstrapTimeout", "hostSDKTimeout", "hostOperationFailed",
- "hostCreateRejected", "hostCreateInvalidResponse", "hostReadyTimeout", "hostOwnerSetupFailed",
-]);
-export const isAVMapHostErrorCode = (value: unknown): value is AVMapHostErrorCode =>
- typeof value === "string" && mapHostErrorCodes.has(value as AVMapHostErrorCode);
-
-const mapLoadErrorCodes = new Set<AVMapLoadErrorCode>([
- "sdkScriptLoadFailed", "sdkGlobalMissing", "mapCreationFailed", "mapReadyTimeout",
-]);
-export const isAVMapLoadErrorCode = (value: unknown): value is AVMapLoadErrorCode =>
- typeof value === "string" && mapLoadErrorCodes.has(value as AVMapLoadErrorCode);
-
-// 内部加载阶段只保留固定错误码,不保存 SDK 原始异常、地址或凭据。
-export class AVMapLoadError extends Error {
- constructor(readonly code: AVMapLoadErrorCode) {
- super("Map loading failed");
- }
-}
-
-export const getAVMapLoadErrorCode = (error: unknown): AVMapLoadErrorCode | undefined =>
- error instanceof AVMapLoadError && isAVMapLoadErrorCode(error.code) ? error.code : undefined;
-
-// 父页面仅从固定标识解析官方署名链接,不接受隔离框架返回的 URL 或 HTML。
-export const AV_MAP_ATTRIBUTION_LINKS: Readonly<Record<AVMapProvider,
- ReadonlyArray<{id: AVMapAttributionLink; label: string; href: string}>>> = {
- openfreemap: [
- {id: "openfreemap", label: "OpenFreeMap", href: "https://openfreemap.org"},
- {id: "openmaptiles", label: "© OpenMapTiles", href: "https://www.openmaptiles.org/"},
- {id: "openstreetmap", label: "© OpenStreetMap", href: "https://www.openstreetmap.org/copyright"},
- {id: "maplibre", label: "MapLibre", href: "https://maplibre.org/"},
- ],
-};
-
-export const isAVMapAttributionLink = (value: unknown): value is AVMapAttributionLink =>
- AV_MAP_ATTRIBUTION_LINKS.openfreemap.some(link => link.id === value);
-
-export interface AVMapCoordinate {
- longitude: number;
- latitude: number;
-}
-
-export interface AVMapPoint extends AVMapCoordinate {
- id: string;
-}
-
-interface AVMapEnvelope {
- version: 1;
- instanceID: string;
-}
-
-export interface AVMapInit extends AVMapEnvelope {
- type: "init";
- provider: AVMapProvider;
- theme: AVMapTheme;
- picking?: true;
-}
-
-export type AVMapCommand = AVMapInit |
- (AVMapEnvelope & {type: "setPoints"; revision: number; points: AVMapPoint[]}) |
- (AVMapEnvelope & {type: "theme"; theme: AVMapTheme}) |
- (AVMapEnvelope & {type: "visibility"} & AVMapVisibility) |
- (AVMapEnvelope & {type: "resize" | "destroy"});
-
-export type AVMapReply = (AVMapEnvelope & {type: "ready"}) |
- (AVMapEnvelope & {type: "attributionClick"; link: AVMapAttributionLink}) |
- (AVMapEnvelope & {type: "markerClick"; id: string; revision: number}) |
- (AVMapEnvelope & {type: "pointClick"; revision: number} & AVMapCoordinate) |
- (AVMapEnvelope & {type: "error"; code: AVMapErrorCode});
-
-export const isAVMapProvider = (value: unknown): value is AVMapProvider =>
- value === "openfreemap";
-
-export const isAVMapTheme = (value: unknown): value is AVMapTheme => value === "light" || value === "dark";
-
-export const isAVMapIdentifier = (value: unknown): value is string =>
- typeof value === "string" && /^[a-zA-Z0-9_-]{1,128}$/.test(value);
-
-export const isAVMapRevision = (value: unknown): value is number =>
- typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
-
-export const isAVMapProjectionSupported = (latitude: number): boolean =>
- Number.isFinite(latitude) && Math.abs(latitude) <= AV_MAP_MERCATOR_MAX_LATITUDE;
-
-// 主界面和隔离宿主分别调用白名单复制,不传输名称、原始输入或完整记录。
-export const sanitizeAVMapPoints = (input: unknown): AVMapPoint[] => {
- if (!Array.isArray(input)) {
- return [];
- }
- const ids = new Set<string>();
- const result: AVMapPoint[] = [];
- input.slice(0, AV_MAP_MAX_POINTS).forEach((point) => {
- if (!point || typeof point !== "object" || Array.isArray(point) || "coordinateSystem" in point || !isAVMapIdentifier(point.id) || ids.has(point.id) ||
- typeof point.longitude !== "number" || !Number.isFinite(point.longitude) ||
- point.longitude < -180 || point.longitude > 180 ||
- typeof point.latitude !== "number" || !Number.isFinite(point.latitude) ||
- point.latitude < -90 || point.latitude > 90 ||
- !isAVMapProjectionSupported(point.latitude)) {
- return;
- }
- ids.add(point.id);
- result.push({id: point.id, longitude: point.longitude, latitude: point.latitude});
- });
- return result;
-};
-
-const asRecord = (value: unknown): Record<string, unknown> | undefined =>
- value && typeof value === "object" && !Array.isArray(value) ? value as Record<string, unknown> : undefined;
-
-export const parseAVMapCoordinate = (value: unknown): AVMapCoordinate | undefined => {
- const point = asRecord(value);
- if (!point || "coordinateSystem" in point || typeof point.longitude !== "number" ||
- !Number.isFinite(point.longitude) || Math.abs(point.longitude) > 180 ||
- typeof point.latitude !== "number" || !isAVMapProjectionSupported(point.latitude)) return;
- return {longitude: point.longitude, latitude: point.latitude};
-};
-
-const parseAVMapViewport = (value: unknown): AVMapViewport | undefined => {
- const rect = asRecord(value);
- if (!rect || ![rect.x, rect.y, rect.width, rect.height].every(number =>
- typeof number === "number" && Number.isFinite(number) && number >= 0 && number <= 32768) ||
- (rect.width as number) <= 0 || (rect.height as number) <= 0) return;
- return {x: rect.x as number, y: rect.y as number, width: rect.width as number, height: rect.height as number};
-};
-
-export const parseAVMapCommand = (value: unknown, instanceID: string, provider?: AVMapProvider): AVMapCommand | undefined => {
- const input = asRecord(value);
- if (!input || input.version !== AV_MAP_PROTOCOL_VERSION || input.instanceID !== instanceID) {
- return;
- }
- const envelope = {version: AV_MAP_PROTOCOL_VERSION, instanceID} as const;
- switch (input.type) {
- case "init":
- if (!isAVMapProvider(input.provider) || !isAVMapTheme(input.theme) ||
- input.picking !== undefined && typeof input.picking !== "boolean") {
- return;
- }
- return {...envelope, type: "init", provider: input.provider, theme: input.theme,
- ...(input.picking === true && {picking: true})};
- case "setPoints":
- if (!provider || !isAVMapRevision(input.revision) || !Array.isArray(input.points)) {
- return;
- }
- return {...envelope, type: "setPoints", revision: input.revision,
- points: sanitizeAVMapPoints(input.points)};
- case "theme":
- return isAVMapTheme(input.theme) ? {...envelope, type: "theme", theme: input.theme} : undefined;
- case "visibility": {
- if (typeof input.visible !== "boolean") return;
- if (!input.visible) return {...envelope, type: "visibility", visible: false};
- if (input.viewport === undefined) return {...envelope, type: "visibility", visible: true};
- const viewport = parseAVMapViewport(input.viewport);
- return viewport ? {...envelope, type: "visibility", visible: true, viewport} : undefined;
- }
- case "resize":
- case "destroy":
- return {...envelope, type: input.type};
- }
-};
-
-export const parseAVMapReply = (value: unknown, instanceID: string): AVMapReply | undefined => {
- const input = asRecord(value);
- if (!input || input.version !== AV_MAP_PROTOCOL_VERSION || input.instanceID !== instanceID) {
- return;
- }
- const envelope = {version: AV_MAP_PROTOCOL_VERSION, instanceID} as const;
- if (input.type === "ready") {
- return {...envelope, type: "ready"};
- }
- if (input.type === "markerClick" && isAVMapIdentifier(input.id) && isAVMapRevision(input.revision)) {
- return {...envelope, type: "markerClick", id: input.id, revision: input.revision};
- }
- if (input.type === "pointClick" && isAVMapRevision(input.revision)) {
- const point = parseAVMapCoordinate(input);
- return point ? {...envelope, type: "pointClick", revision: input.revision, ...point} : undefined;
- }
- if (input.type === "attributionClick" && isAVMapAttributionLink(input.link)) {
- return {...envelope, type: "attributionClick", link: input.link};
- }
- if (input.type === "error" && (["unsupportedEnvironment", "invalidConfiguration",
- "hostUnavailable", "sdkUnavailable", "mapUnavailable"].includes(input.code as string) ||
- isAVMapLoadErrorCode(input.code) || isAVMapHostErrorCode(input.code))) {
- return {...envelope, type: "error", code: input.code as AVMapErrorCode};
- }
-};
-
-type AVMapBootstrapMessageType = "hello" | "wrapperHello" | "prepare" | "connect" |
- "bootstrapReady" | "bootstrapError" | "siyuan-map-desktop-connect";
-
-export const isAVMapBootstrapMessage = (value: unknown, type: AVMapBootstrapMessageType,
- instanceID: string, nonce: string): boolean => {
- const input = asRecord(value);
- return !!input && input.type === type && input.version === AV_MAP_PROTOCOL_VERSION &&
- input.instanceID === instanceID && input.nonce === nonce;
-};
diff --git a/app/src/protyle/render/av/map/providers.test.ts b/app/src/protyle/render/av/map/providers.test.ts
deleted file mode 100644
index 14f38fb109..0000000000
--- a/app/src/protyle/render/av/map/providers.test.ts
+++ /dev/null
@@ -1,442 +0,0 @@
-import * as assert from "node:assert/strict";
-import {test} from "node:test";
-import {AV_MAP_OPENFREEMAP_STYLE, createAVMapAdapter} from "./providers";
-import {AV_MAP_ATTRIBUTION_LINKS} from "./protocol";
-
-const {AJAXError, Evented} = require("maplibre-gl");
-
-// 瓦片数据形状依照 TileManager._loadTile;事件冒泡和 HTTP 异常使用实际 SDK 实现。
-const tileError = (status: number) => ({type: "error", sourceId: "fixture",
- error: new AJAXError(status, "Fixture HTTP status", "https://fixture.invalid/tile", new Blob()),
- tile: {state: "errored", tileID: {canonical: {z: 2, x: 1, y: 1}}}});
-
-const fixture = () => {
- const instances: any[] = [];
- const calls: Array<[string, ...any[]]> = [];
- const frames = new Map<number, (now: number) => void>();
- const events = new Map<string, (event: any) => void>();
- const documentEvents = new Map<string, () => void>();
- const classes = new Set<string>();
- let now = 0, nextFrame = 0;
- const rect = {left: 0, top: 0, right: 300, bottom: 24, width: 300, height: 24};
- const attributionText = {textContent: "MapLibre OpenFreeMap OpenStreetMap OpenMapTiles", getClientRects: () => [rect],
- getBoundingClientRect: () => ({left: rect.left + 8, right: rect.right - 28, top: rect.top + 2,
- bottom: rect.bottom - 2, width: rect.width - 36, height: rect.height - 4})};
- const attribution: any = {tagName: "DETAILS", open: true, querySelector: () => attributionText,
- classList: {toggle: (name: string, on: boolean) => on ? classes.add(name) : classes.delete(name),
- contains: (name: string) => classes.has(name)},
- addEventListener: (name: string, callback: (event: any) => void) => events.set(name, callback),
- removeEventListener: (name: string) => events.delete(name),
- getClientRects: () => [rect], getBoundingClientRect: () => rect,
- contains: (target: unknown) => [attribution, attributionText, anchor, summary].includes(target)};
- const anchor = {href: "", getAttribute: () => anchor.href, closest: (selector: string): any => selector === "a" ? anchor : null};
- const summary = {closest: (selector: string): any => selector === "summary" ? summary : null};
- const scope = {innerWidth: 800, innerHeight: 600, navigator: {userActivation: {isActive: true}},
- requestAnimationFrame: (callback: (now: number) => void) => { frames.set(++nextFrame, callback); return nextFrame; },
- cancelAnimationFrame: (id: number) => frames.delete(id)};
- const doc = {documentElement: {dataset: {}}, defaultView: scope, hidden: false,
- elementFromPoint: (() => attribution) as (x: number, y: number) => unknown,
- addEventListener: (name: string, callback: () => void) => documentEvents.set(name, callback),
- removeEventListener: (name: string) => documentEvents.delete(name)};
- class SDKObject {
- callbacks = new Map<string, (...args: any[]) => void>();
- constructor(...args: any[]) { calls.push([new.target.name, ...args]); instances.push(this); }
- on(event: string, callback: (...args: any[]) => void) { this.callbacks.set(event, callback); }
- off(event: string) { this.callbacks.delete(event); }
- addEventListener(event: string, callback: (...args: any[]) => void) { this.on(event, callback); }
- removeEventListener(event: string) { this.off(event); }
- remove() { calls.push(["remove"]); }
- setLngLat(...args: any[]) { calls.push(["setLngLat", ...args]); return this; }
- addTo() { return this; }
- getElement() { return this; }
- fitBounds(...args: any[]) { calls.push(["fitBounds", ...args]); }
- resize() { calls.push(["resize"]); }
- extend(...args: any[]) { calls.push(["extend", ...args]); }
- addControl(control: unknown) { calls.push(["addControl", control]); }
- }
- const sdk = {Map: class Map extends SDKObject {}, Marker: class Marker extends SDKObject {},
- LngLatBounds: class LngLatBounds extends SDKObject {}, AttributionControl: class AttributionControl extends SDKObject {}};
- const container = {ownerDocument: doc, querySelector: () => attribution,
- replaceChildren() { calls.push(["clear"]); }};
- return {sdk, calls, instances, container: container as unknown as HTMLElement, attribution, frames, events, documentEvents, doc, scope, rect,
- ready: () => instances[0].callbacks.get("style.load")(),
- load: () => instances[0].callbacks.get("load")(),
- advance: (milliseconds: number) => {
- now += milliseconds;
- const pending = [...frames.values()]; frames.clear(); pending.forEach(callback => callback(now));
- },
- visibility: (hidden: boolean) => { doc.hidden = hidden; documentEvents.get("visibilitychange")?.(); },
- click: (href?: string, values: Record<string, unknown> = {}) => {
- anchor.href = href;
- const event = {target: href === undefined ? summary : anchor, isTrusted: true, button: 0,
- preventDefault() { this.prevented = true; }, stopImmediatePropagation() {}, ...values};
- events.get("click")?.(event);
- return event;
- }};
-};
-
-const visibleViewport = {x: 0, y: 0, width: 800, height: 600};
-
-test("style readiness permits markers before slow tiles finish and preserves full-load attribution timing", () => {
- const f = fixture();
- let ready = 0;
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError() { assert.fail("SDK error"); }, onReady() { ready++; },
- });
- adapter.setVisible(true, visibleViewport);
- f.ready();
- f.ready();
- assert.equal(ready, 1);
- adapter.setPoints([{id: "row-1", longitude: 121, latitude: 31}], 1);
- adapter.fit();
- assert.deepEqual(f.calls.filter(call => call[0] === "setLngLat"), [["setLngLat", [121, 31]]]);
- assert.equal(f.calls.filter(call => call[0] === "fitBounds").length, 1);
- f.advance(30000);
- assert.equal(f.attribution.open, true, "style readiness does not start the full-map attribution clock");
- assert.equal(f.calls.some(call => call[0] === "remove"), false);
- f.load(); f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true);
- f.advance(1);
- assert.equal(f.attribution.open, false);
- const lateReady = f.instances[0].callbacks.get("style.load");
- const lateLoad = f.instances[0].callbacks.get("load");
- adapter.destroy();
- assert.equal(f.instances[0].callbacks.size, 0);
- lateReady(); lateLoad();
- assert.equal(ready, 1);
- assert.equal(f.frames.size, 0);
-});
-
-test("OpenFreeMap preserves longitude/latitude, attribution and cleans stale callbacks", () => {
- const {sdk, calls, instances, container} = fixture();
- const clicked: Array<[string, number]> = [];
- const adapter = createAVMapAdapter("openfreemap", sdk, container, {
- onMarkerClick: (id, revision) => clicked.push([id, revision]), onError: () => assert.fail("SDK error"),
- });
- const point = {id: "row-1", longitude: 121, latitude: 31};
- adapter.setPoints([point, {...point, id: "invalid", latitude: 90}], 1);
- const marker = instances.find(instance => instance.callbacks.has("click"));
- const oldClick = marker.callbacks.get("click");
- oldClick();
- assert.deepEqual(clicked, [["row-1", 1]]);
- assert.equal(calls.find(call => call[0] === "Map")[1].style, AV_MAP_OPENFREEMAP_STYLE);
- assert.equal(calls.find(call => call[0] === "Map")[1].attributionControl, false);
- assert.equal(calls.find(call => call[0] === "AttributionControl")[1].compact, true);
- assert.match(calls.find(call => call[0] === "AttributionControl")[1].customAttribution, /https:\/\/maplibre.org\//);
- assert.deepEqual(calls.filter(call => call[0] === "setLngLat"), [["setLngLat", [121, 31]]]);
- adapter.fit();
- adapter.resize();
- adapter.setTheme("dark");
- adapter.setPoints([{...point, id: "row-2"}], 2);
- oldClick();
- assert.equal(clicked.length, 1);
- adapter.setPoints([point], 1);
- adapter.setPoints([], 3);
- adapter.fit();
- adapter.destroy();
- const count = calls.length;
- adapter.destroy();
- adapter.setPoints([point], 4);
- adapter.fit();
- adapter.resize();
- adapter.setTheme("light");
- oldClick();
- assert.equal(calls.length, count);
- assert.equal(clicked.length, 1);
- assert.equal(calls.filter(call => call[0] === "clear").length, 1);
-});
-
-test("point picking accepts only genuine current map clicks and normalizes world copies without forwarding metadata", () => {
- const f = fixture();
- const clicked: unknown[] = [];
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError() {}, onPointClick: (...args) => clicked.push(args),
- });
- const click = f.instances[0].callbacks.get("click");
- const event = {originalEvent: {isTrusted: true, button: 0}, lngLat: {lng: 121.4, lat: 31.2}, features: [{name: "private"}]};
- click(event);
- f.ready();
- click(event);
- assert.deepEqual(clicked, []);
- adapter.setPoints([], 1);
- click({...event, originalEvent: {isTrusted: false, button: 0}});
- click({...event, originalEvent: {isTrusted: true, button: 1}});
- click({...event, lngLat: {lng: 0, lat: 90}});
- click({...event, lngLat: {lng: Infinity, lat: 0}});
- assert.deepEqual(clicked, []);
- click(event);
- click({...event, lngLat: {lng: 540, lat: 0}, originalEvent: {isTrusted: true}});
- assert.deepEqual(clicked, [[{longitude: 121.4, latitude: 31.2}, 1], [{longitude: -180, latitude: 0}, 1]]);
- adapter.destroy();
- click(event);
- assert.equal(clicked.length, 2);
- assert.equal(f.instances[0].callbacks.has("click"), false);
-});
-
-test("attribution waits for five continuously visible seconds after load and stays expandable", () => {
- const f = fixture();
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}});
- f.advance(10000);
- assert.equal(f.attribution.open, true);
- adapter.setVisible(true, visibleViewport);
- f.advance(10000);
- assert.equal(f.attribution.open, true, "no clock before the map loads");
- f.load(); f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true);
- adapter.setVisible(false); f.advance(10000); adapter.setVisible(true, visibleViewport); f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true, "hidden native views cannot consume the initial display");
- f.visibility(true); f.advance(10000); f.visibility(false); f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true, "background tabs restart the display clock");
- f.rect.bottom = 700; f.advance(1); f.rect.bottom = 24; f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true, "cropped attribution cannot consume display time");
- f.advance(1);
- assert.equal(f.attribution.open, false);
- assert.equal(f.frames.size, 0);
- f.click(undefined, {isTrusted: false});
- assert.equal(f.attribution.open, false);
- f.click();
- assert.equal(f.attribution.open, true);
- f.advance(20000);
- f.attribution.open = false;
- f.instances[0].callbacks.get("drag")();
- assert.equal(f.attribution.open, true, "map interaction preserves the user's expanded choice");
- adapter.destroy();
- assert.equal(f.events.size, 0);
- assert.equal(f.frames.size, 0);
-});
-
-test("trusted attribution interaction cancels auto-collapse and only exact official links leave the frame", () => {
- const f = fixture();
- const clicked: string[] = [];
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError() {}, onAttributionClick: link => clicked.push(link),
- });
- f.load(); adapter.setVisible(true, visibleViewport); f.advance(0); f.advance(2000);
- f.events.get("keydown")({isTrusted: true});
- f.advance(10000);
- assert.equal(f.attribution.open, true);
- for (const link of AV_MAP_ATTRIBUTION_LINKS.openfreemap) {
- assert.equal((f.click(link.href) as any).prevented, true);
- }
- assert.deepEqual(clicked, AV_MAP_ATTRIBUTION_LINKS.openfreemap.map(link => link.id));
- for (const href of ["https://maplibre.org/?secret=x", "https://maplibre.org/#secret", "https://maplibre.org:443/",
- "http://maplibre.org/", "javascript:alert(1)", "https://evil.invalid/", "https://maplibre.org.evil.invalid/"]) {
- f.click(href);
- }
- f.click("https://maplibre.org/", {isTrusted: false});
- f.click("https://maplibre.org/", {button: 1});
- f.scope.navigator.userActivation.isActive = false;
- f.click("https://maplibre.org/");
- f.scope.navigator.userActivation.isActive = true;
- adapter.setVisible(false); f.click("https://maplibre.org/");
- assert.equal(clicked.length, 4);
- adapter.destroy();
- f.click("https://maplibre.org/");
- assert.equal(clicked.length, 4);
-});
-
-test("rounded attribution corners do not prevent its visible text from completing the display clock", () => {
- const f = fixture();
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}});
- f.doc.elementFromPoint = (x: number, y: number) =>
- (x < 8 || x > 292) && (y < 2 || y > 22) ? f.container : f.attribution;
- f.load(); adapter.setVisible(true, visibleViewport); f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true);
- assert.equal(f.attribution.classList.contains("maplibregl-compact-show"), true);
- f.advance(1);
- assert.equal(f.attribution.open, false);
- assert.equal(f.attribution.classList.contains("maplibregl-compact-show"), false);
- adapter.destroy();
-});
-
-test("trusted local disclosure clicks survive host visibility transitions without permitting external navigation", () => {
- const f = fixture();
- const clicked: string[] = [];
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError() {}, onAttributionClick: link => clicked.push(link),
- });
- f.load(); adapter.setVisible(true, visibleViewport); f.advance(0);
- f.scope.navigator.userActivation.isActive = false;
- adapter.setVisible(false);
- assert.equal((f.click() as any).prevented, true);
- assert.equal(f.attribution.open, false);
- assert.equal(f.attribution.classList.contains("maplibregl-compact-show"), false);
- f.click("https://maplibre.org/");
- assert.deepEqual(clicked, []);
- f.click(undefined, {isTrusted: false});
- assert.equal(f.attribution.open, false);
- adapter.setVisible(true, visibleViewport);
- f.click();
- assert.equal(f.attribution.open, true);
- f.advance(10000);
- assert.equal(f.attribution.open, true, "the user's disclosure choice cancels automatic collapse");
- f.click("https://maplibre.org/");
- assert.deepEqual(clicked, []);
- f.scope.navigator.userActivation.isActive = true;
- f.click("https://maplibre.org/");
- assert.deepEqual(clicked, ["maplibre"]);
- adapter.destroy();
-});
-
-test("attribution display time respects parent clipping and translated native viewport coordinates", () => {
- const f = fixture();
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}});
- f.load();
- Object.assign(f.rect, {left: 480, right: 780, top: 560, bottom: 584});
- adapter.setVisible(true, {x: 0, y: 0, width: 800, height: 500});
- f.advance(0); f.advance(10000);
- assert.equal(f.attribution.open, true, "a clipped bottom edge cannot consume display time");
- adapter.setVisible(true, {x: 0, y: 100, width: 800, height: 500});
- f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true);
- f.advance(1);
- assert.equal(f.attribution.open, false, "a hidden top edge still permits five seconds of visible attribution");
- adapter.destroy();
-
- const native = fixture();
- const nativeAdapter = createAVMapAdapter("openfreemap", native.sdk, native.container, {onMarkerClick() {}, onError() {}});
- native.load();
- // DOM 矩形已经包含原生 preload 的 translate(-crop),此处不再传入或减去 crop。
- Object.assign(native.rect, {left: 280, right: 580, top: 160, bottom: 184});
- native.scope.innerWidth = 600; native.scope.innerHeight = 200;
- nativeAdapter.setVisible(true, {x: 0, y: 0, width: 600, height: 200});
- native.advance(0); native.advance(5000);
- assert.equal(native.attribution.open, false);
- nativeAdapter.destroy();
-});
-
-test("removed providers cannot create a map", () => {
- for (const provider of ["amap", "tencent", "baidu"]) {
- const {sdk, calls, container} = fixture();
- assert.throws(() => createAVMapAdapter(provider as any, sdk, container, {onMarkerClick() {}, onError() {}}),
- /invalidConfiguration/);
- assert.equal(calls.length, 0);
- }
-});
-
-test("fully visible viewport changes preserve the continuous attribution display clock", () => {
- const f = fixture();
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}});
- f.load();
- adapter.setVisible(true, visibleViewport);
- f.advance(0);
- f.advance(4000);
- adapter.setVisible(true, {...visibleViewport, width: 790});
- f.advance(1000);
- assert.equal(f.attribution.open, false, "five uninterrupted visible seconds include a viewport resize");
- adapter.destroy();
-});
-
-test("a simulated SDK tile 503 after load preserves the ready map", () => {
- const f = fixture();
- const errors: string[] = [];
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError: code => { errors.push(code); adapter.destroy(); },
- });
- f.load();
- const source = new Evented();
- const map = new Evented();
- source.setEventedParent(map, {sourceId: "fixture"});
- map.on("error", f.instances[0].callbacks.get("error"));
- const event = tileError(503);
- source.fire("error", {error: event.error, tile: event.tile});
- assert.deepEqual(errors, []);
- assert.equal(f.calls.filter(call => call[0] === "remove").length, 0);
- adapter.destroy();
-});
-
-test("only recognized temporary tile HTTP errors after the first load preserve the map", () => {
- for (const status of [408, 429, 500, 502, 503, 504]) {
- const f = fixture();
- const errors: string[] = [];
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError: code => errors.push(code),
- });
- const error = f.instances[0].callbacks.get("error");
- f.ready();
- error(tileError(status));
- assert.deepEqual(errors, ["mapUnavailable"], "style readiness preserves the fatal policy before full load");
- f.load();
- error(tileError(status));
- assert.deepEqual(errors, ["mapUnavailable"]);
- adapter.destroy();
- error(tileError(status));
- assert.deepEqual(errors, ["mapUnavailable"], "late SDK errors cannot resurrect a destroyed map");
- }
-});
-
-test("ready maps still report startup, source, worker, authorization and unknown errors safely", () => {
- const variants = [undefined, {}, {error: new Error("private worker failure")},
- ...[0, 401, 403, 404, 501, 505].map(tileError),
- {...tileError(503), tile: undefined}, {...tileError(503), sourceId: ""},
- {...tileError(503), error: {status: "503", message: "private URL"}},
- {...tileError(503), tile: {state: "loaded", tileID: {canonical: {z: 2, x: 1, y: 1}}}},
- ...[{z: -1, x: 0, y: 0}, {z: 26, x: 1, y: 1}, {z: 2.5, x: 1, y: 1},
- {z: 2, x: 4, y: 1}, {z: 2, x: 1, y: Infinity}, {z: "2", x: 1, y: 1}]
- .map(canonical => ({...tileError(503), tile: {state: "errored", tileID: {canonical}}})),
- ];
- for (const event of variants) {
- const f = fixture();
- const errors: string[] = [];
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {
- onMarkerClick() {}, onError: code => { errors.push(code); adapter.destroy(); },
- });
- f.load();
- f.instances[0].callbacks.get("error")(event);
- assert.deepEqual(errors, ["mapUnavailable"]);
- assert.equal(f.calls.filter(call => call[0] === "remove").length, 1);
- }
-});
-
-test("viewport clipping and occlusion reset accumulated time, including between animation frames", () => {
- const f = fixture();
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}});
- f.load(); adapter.setVisible(true, visibleViewport); f.advance(0); f.advance(4000);
- adapter.setVisible(true, {...visibleViewport, width: 290});
- adapter.setVisible(true, visibleViewport);
- f.advance(0); f.advance(1000);
- assert.equal(f.attribution.open, true, "brief clipping interrupts continuous display");
- f.doc.elementFromPoint = () => f.container;
- f.advance(0);
- f.doc.elementFromPoint = () => f.attribution;
- f.advance(0); f.advance(4999);
- assert.equal(f.attribution.open, true);
- f.advance(1);
- assert.equal(f.attribution.open, false);
- adapter.destroy();
-});
-
-test("destruction cancels pending attribution time and late DOM or SDK callbacks", () => {
- const f = fixture();
- const adapter = createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}});
- f.load(); adapter.setVisible(true, visibleViewport); f.advance(0); f.advance(4000);
- const tick = [...f.frames.values()][0];
- const click = f.events.get("click");
- const drag = f.instances[0].callbacks.get("drag");
- adapter.destroy();
- assert.equal(f.frames.size, 0);
- assert.equal(f.events.size, 0);
- tick(10000);
- click({target: {closest: (selector: string) => selector === "summary" ? {} : null}, isTrusted: true,
- button: 0, preventDefault() {}, stopImmediatePropagation() {}});
- drag();
- assert.equal(f.attribution.open, true);
- assert.equal(f.frames.size, 0);
-});
-
-test("attribution initialization failures clean the already created map and partial listeners", () => {
- for (const stage of ["control", "missingDOM", "eventRegistration", "initialState"]) {
- const f = fixture();
- const failure = () => { throw new Error("fixture initialization failure"); };
- if (stage === "control") f.sdk.Map.prototype.addControl = failure;
- if (stage === "missingDOM") f.container.querySelector = (): null => null;
- if (stage === "eventRegistration") f.sdk.Map.prototype.on = failure;
- if (stage === "initialState") f.attribution.classList.toggle = failure;
- assert.throws(() => createAVMapAdapter("openfreemap", f.sdk, f.container, {onMarkerClick() {}, onError() {}}));
- assert.equal(f.calls.filter(call => call[0] === "remove").length, 1, stage);
- assert.equal(f.calls.filter(call => call[0] === "clear").length, 1, stage);
- assert.equal(f.events.size, 0, stage);
- assert.equal(f.documentEvents.size, 0, stage);
- assert.equal(f.frames.size, 0, stage);
- }
-});
diff --git a/app/src/protyle/render/av/map/providers.ts b/app/src/protyle/render/av/map/providers.ts
deleted file mode 100644
index 253314ba80..0000000000
--- a/app/src/protyle/render/av/map/providers.ts
+++ /dev/null
@@ -1,149 +0,0 @@
-import {
- AVMapAttributionLink, AVMapCoordinate, AVMapErrorCode, AVMapPoint, AVMapProvider, AVMapTheme, AVMapViewport,
- parseAVMapCoordinate, sanitizeAVMapPoints,
-} from "./protocol";
-import {AVMapAttributionController, createAVMapAttribution} from "./attribution";
-
-export const AV_MAP_OPENFREEMAP_STYLE = "https://tiles.openfreemap.org/styles/liberty";
-
-const retryableTileStatuses = new Set([408, 429, 500, 502, 503, 504]);
-const isRecoverableTileError = (event: any): boolean => {
- const tile = event?.tile;
- const canonical = tile?.tileID?.canonical;
- // MapLibre 的瓦片错误带有源标识和失败瓦片;其他启动、样式或 worker 错误仍交给宿主处理。
- return event?.type === "error" && typeof event.sourceId === "string" && event.sourceId.trim().length > 0 &&
- tile?.state === "errored" && canonical && typeof canonical === "object" && !Array.isArray(canonical) &&
- Number.isInteger(canonical.z) && canonical.z >= 0 && canonical.z <= 25 &&
- Number.isInteger(canonical.x) && canonical.x >= 0 && canonical.x < 2 ** canonical.z &&
- Number.isInteger(canonical.y) && canonical.y >= 0 && canonical.y < 2 ** canonical.z &&
- retryableTileStatuses.has(event.error?.status);
-};
-
-export interface AVMapAdapter {
- setPoints: (points: AVMapPoint[], revision: number) => void;
- fit: () => void;
- resize: () => void;
- setTheme: (theme: AVMapTheme) => void;
- setVisible: (visible: boolean, viewport?: AVMapViewport) => void;
- destroy: () => void;
-}
-
-export interface AVMapAdapterCallbacks {
- onMarkerClick: (id: string, revision: number) => void;
- onPointClick?: (point: AVMapCoordinate, revision: number) => void;
- onError: (code: AVMapErrorCode) => void;
- onReady?: () => void;
- onAttributionClick?: (link: AVMapAttributionLink) => void;
-}
-
-// SDK 仅加载于隔离页面,不进入主界面。
-export const createAVMapAdapter = (provider: AVMapProvider, sdk: any, container: HTMLElement,
- callbacks: AVMapAdapterCallbacks): AVMapAdapter => {
- if (provider !== "openfreemap") throw new Error("invalidConfiguration");
- let destroyed = false;
- let revision = -1;
- let points: AVMapPoint[] = [];
- let removeMarkers: Array<() => void> = [];
- const cleanMarkers = () => {
- removeMarkers.forEach(remove => remove());
- removeMarkers = [];
- };
- const error = (event: unknown) => {
- if (!destroyed && !(loaded && isRecoverableTileError(event))) callbacks.onError("mapUnavailable");
- };
- const map = new sdk.Map({container, style: AV_MAP_OPENFREEMAP_STYLE, center: [0, 0], zoom: 1,
- attributionControl: false, trackResize: false});
- let attribution: AVMapAttributionController;
- let ready = false, loaded = false;
- const onPointClick = (event: any) => {
- if (destroyed || !ready || revision < 0 || !event?.originalEvent?.isTrusted ||
- event.originalEvent.button !== undefined && event.originalEvent.button !== 0) return;
- // 世界副本仅归一化经度,不转换坐标系;名称和供应商要素属性不离开隔离页面。
- const longitude = event.lngLat?.lng;
- if (typeof longitude !== "number" || !Number.isFinite(longitude)) return;
- const point = parseAVMapCoordinate({longitude: Math.abs(longitude) <= 180 ? longitude :
- ((longitude + 180) % 360 + 360) % 360 - 180,
- latitude: event.lngLat?.lat});
- if (point) callbacks.onPointClick?.(point, revision);
- };
- const onReady = () => {
- if (!destroyed && !ready) {
- ready = true;
- // 样式初始化后即可接收记录并定位,不等待默认世界视图的全部瓦片。
- callbacks.onReady?.();
- }
- };
- const onLoad = () => {
- if (!destroyed && !loaded) {
- loaded = true;
- attribution.onReady();
- }
- };
- const destroy = () => {
- if (destroyed) return;
- destroyed = true;
- try {
- attribution?.destroy();
- map.off("style.load", onReady);
- map.off("load", onLoad);
- map.off("error", error);
- if (callbacks.onPointClick) map.off("click", onPointClick);
- cleanMarkers();
- points = [];
- } finally {
- try {
- map.remove();
- } finally {
- container.replaceChildren();
- }
- }
- };
- try {
- attribution = createAVMapAttribution(provider, sdk, map, container, callbacks.onAttributionClick);
- map.on("error", error);
- map.on("style.load", onReady);
- map.on("load", onLoad);
- if (callbacks.onPointClick) map.on("click", onPointClick);
- } catch (error) {
- destroy();
- throw error;
- }
-
- return {
- setPoints: (input, nextRevision) => {
- if (destroyed || nextRevision <= revision) return;
- revision = nextRevision;
- cleanMarkers();
- points = sanitizeAVMapPoints(input);
- points.forEach(point => {
- const onClick = (event?: Event) => {
- event?.stopPropagation();
- if (!destroyed && nextRevision === revision && points.some(item => item.id === point.id)) {
- callbacks.onMarkerClick(point.id, nextRevision);
- }
- };
- const marker = new sdk.Marker().setLngLat([point.longitude, point.latitude]).addTo(map);
- const element = marker.getElement();
- element.addEventListener("click", onClick);
- removeMarkers.push(() => {
- element.removeEventListener("click", onClick);
- marker.remove();
- });
- });
- },
- fit: () => {
- if (destroyed || points.length === 0) return;
- const bounds = new sdk.LngLatBounds();
- points.forEach(point => bounds.extend([point.longitude, point.latitude]));
- map.fitBounds(bounds, {padding: 40, maxZoom: 15, duration: 0});
- },
- resize: () => {
- if (!destroyed) map.resize();
- },
- setTheme: theme => {
- if (!destroyed) container.ownerDocument.documentElement.dataset.theme = theme;
- },
- setVisible: attribution.setVisible,
- destroy,
- };
-};
diff --git a/app/src/protyle/render/av/map/providersLoader.test.ts b/app/src/protyle/render/av/map/providersLoader.test.ts
deleted file mode 100644
index b31352f777..0000000000
--- a/app/src/protyle/render/av/map/providersLoader.test.ts
+++ /dev/null
@@ -1,344 +0,0 @@
-import * as assert from "node:assert/strict";
-import {test} from "node:test";
-import {AVMapInit, AVMapLoadError} from "./protocol";
-import {loadAVMapAdapter} from "./providersLoader";
-import {getAVMapLockedPolicy, prepareAVMapBootstrap} from "./bootstrap";
-import {AV_MAP_ASSET_TIMEOUT, AV_MAP_READY_TIMEOUT} from "./loadingBudget";
-import {startAVMapRuntime} from "./hostRuntime";
-
-const fixture = (options: {ready?: boolean; assetFailure?: boolean; scriptFailure?: boolean; missingSDK?: boolean;
- mapError?: boolean; controlError?: boolean; manualAssets?: boolean; policyFailure?: boolean} = {}) => {
- const requested: any[] = [];
- const elements: any[] = [];
- const mapEvents = new Map<string, () => void>();
- let destroyed = 0;
- class FakeMap {
- constructor() {
- requested.push({mapCreated: true});
- if (options.mapError) throw new Error("private error");
- }
- on(type: string, callback: () => void) {
- mapEvents.set(type, callback);
- if (options.ready !== false && type === "style.load") queueMicrotask(callback);
- }
- off(type: string) { mapEvents.delete(type); }
- addControl() { if (options.controlError) throw new Error("private control failure"); }
- fitBounds(bounds: unknown) { requested.push({bounds}); }
- remove() { destroyed++; }
- }
- const scope: any = {
- setTimeout, clearTimeout, cancelAnimationFrame() {},
- maplibregl: options.missingSDK ? undefined : {Map: FakeMap, AttributionControl: class {},
- Marker: class {
- setLngLat(coordinates: number[]) { requested.push({coordinates}); return this; }
- addTo() { return this; }
- getElement() { return {addEventListener() {}, removeEventListener() {}}; }
- remove() {}
- },
- LngLatBounds: class { extend() {} },
- setWorkerUrl: (url: string) => requested.push({worker: url})},
- fetch: async (url: string, options: unknown) => {
- requested.push({url, options});
- return {ok: true, text: async () => "/* fixture worker */"};
- },
- };
- const document: any = {
- defaultView: scope, documentElement: {dataset: {}},
- addEventListener() {}, removeEventListener() {},
- createElement: (tag: string) => ({tag, remove() {}}),
- head: {appendChild: (element: any) => {
- elements.push(element);
- requested.push({tag: element.tag, src: element.src, href: element.href, referrerPolicy: element.referrerPolicy,
- policy: element.content});
- if (element.tag === "meta" && options.policyFailure) throw new Error("private policy failure");
- if (element.tag !== "meta" && !options.manualAssets) queueMicrotask(() =>
- options.assetFailure || options.scriptFailure && element.tag === "script" ? element.onerror?.() : element.onload?.());
- }},
- };
- scope.document = document;
- const container = {ownerDocument: document, replaceChildren() {}, querySelector: () => ({
- classList: {toggle() {}}, addEventListener() {}, removeEventListener() {},
- querySelector: () => ({}),
- })} as unknown as HTMLElement;
- return {scope, requested, elements, container, mapEvents, destroyed: () => destroyed};
-};
-const init: AVMapInit = {version: 1, instanceID: "fixture", type: "init", provider: "openfreemap", theme: "light"};
-const callbacks = {onMarkerClick() {}, onError() {}};
-
-test("loads packaged MapLibre and anonymous worker source before the CSP lock", async () => {
- const {scope, requested, container, destroyed} = fixture();
- const signal = new AbortController().signal;
- await assert.rejects(loadAVMapAdapter(init, container, callbacks, signal), /hostUnavailable/);
- assert.equal(requested.length, 0);
- const dispose = await prepareAVMapBootstrap(scope, "openfreemap", signal);
- assert.equal(requested.some(request => request.worker || request.mapCreated), false);
- assert.equal(requested.at(-1).tag, "meta");
- const lockedAt = requested.length - 1;
- const adapter = await loadAVMapAdapter(init, container, callbacks, signal);
- const scripts = requested.filter(request => request.tag === "script");
- assert.equal(scripts.length, 1);
- assert.equal(scripts[0].src, "/stage/build/map/maplibre-gl.js");
- assert.equal(scripts[0].referrerPolicy, "no-referrer");
- assert.equal(requested.find(request => request.tag === "link").href, "/stage/build/map/maplibre-gl.css");
- const worker = requested.find(request => request.url);
- assert.equal(worker.url, "/stage/build/map/maplibre-gl-csp-worker.js");
- assert.equal(worker.options.credentials, "omit");
- assert.equal(worker.options.cache, "no-store");
- assert.equal(worker.options.mode, "cors");
- assert.match(requested.find(request => request.worker).worker, /^blob:/);
- assert.ok(requested.findIndex(request => request.worker) > lockedAt);
- assert.ok(requested.findIndex(request => request.mapCreated) > lockedAt);
- assert.equal(requested.slice(lockedAt + 1).some(request => request.url || request.tag === "script"), false);
- adapter.destroy();
- adapter.destroy();
- dispose();
- assert.equal(destroyed(), 1);
-});
-
-test("locked policy removes local access and permits only the tile origin", () => {
- const policy = getAVMapLockedPolicy("openfreemap");
- assert.equal(/localhost|127\.0\.0\.1|stage\/|nonce-|sha256-|\bself\b|unsafe-eval/.test(policy), false);
- assert.match(policy, /script-src 'none'/);
- assert.match(policy, /connect-src https:\/\/tiles\.openfreemap\.org;/);
- assert.match(policy, /frame-src 'none'/);
- assert.match(policy, /form-action 'none'/);
- for (const provider of ["amap", "tencent", "baidu"]) {
- assert.throws(() => getAVMapLockedPolicy(provider as any), /invalidConfiguration/);
- }
-});
-
-test("missing assets or SDK never create a map", async () => {
- for (const options of [{assetFailure: true}, {missingSDK: true}]) {
- const {scope, requested, destroyed} = fixture(options);
- await assert.rejects(prepareAVMapBootstrap(scope, "openfreemap", new AbortController().signal), (error: any) => {
- if (options.missingSDK) {
- assert.ok(error instanceof AVMapLoadError);
- assert.equal(error.code, "sdkGlobalMissing");
- } else {
- assert.equal(error.message, "hostUnavailable");
- }
- return true;
- });
- assert.equal(requested.some(request => request.mapCreated || request.worker), false);
- assert.equal(destroyed(), 0);
- }
-});
-
-test("script failures and missing SDK globals expose only the controlled diagnostics", async () => {
- for (const options of [{scriptFailure: true}, {missingSDK: true}]) {
- const {scope, requested} = fixture(options);
- await assert.rejects(prepareAVMapBootstrap(scope, "openfreemap", new AbortController().signal), (error: unknown) => {
- assert.ok(error instanceof AVMapLoadError);
- assert.equal(error.code, options.scriptFailure ? "sdkScriptLoadFailed" : "sdkGlobalMissing");
- assert.equal(error.message, "Map loading failed");
- return true;
- });
- assert.equal(requested.some(request => request.url || request.mapCreated || request.worker || request.tag === "meta"), false);
- }
-});
-
-const flush = () => new Promise(resolve => setImmediate(resolve));
-const controlledTimers = (scope: any) => {
- let serial = 0;
- const pending = new Map<number, {callback: () => void; delay: number}>();
- scope.setTimeout = (callback: () => void, delay: number) => {
- pending.set(++serial, {callback, delay});
- return serial;
- };
- scope.clearTimeout = (id: number) => pending.delete(id);
- return pending;
-};
-
-test("style-ready runtime fits records once while slow tiles outlive the old readiness deadline", async () => {
- const f = fixture({ready: false});
- const timers = controlledTimers(f.scope);
- const signal = new AbortController().signal;
- await prepareAVMapBootstrap(f.scope, "openfreemap", signal);
- const replies: any[] = [];
- const port = {onmessage: null as any, postMessage: (value: unknown) => replies.push(value), start() {}, close() {}};
- const stop = startAVMapRuntime(port as unknown as MessagePort, init.instanceID, init.provider, f.container);
- const send = (command: object) => port.onmessage({data: {...init, ...command}});
- try {
- const pending = send(init);
- assert.equal(replies.length, 0);
- const deadline = [...timers.values()].find(timer => timer.delay === AV_MAP_READY_TIMEOUT);
- assert.ok(deadline);
- f.mapEvents.get("style.load")();
- await pending;
- assert.deepEqual(replies, [{version: 1, instanceID: init.instanceID, type: "ready"}]);
- assert.equal(timers.size, 0, "slow tiles no longer retain the adapter readiness timer");
- const point = {id: "row-1", longitude: 121, latitude: 31};
- await send({type: "setPoints", revision: 1, points: [point]});
- await send({type: "setPoints", revision: 2, points: [{...point, id: "row-2"}]});
- assert.deepEqual(f.requested.filter(request => request.coordinates).map(request => request.coordinates), [[121, 31], [121, 31]]);
- assert.equal(f.requested.filter(request => request.bounds).length, 1, "the first points fit before any full-load event");
- // 即使过期计时回调已经入队,也不能销毁已能接收记录的地图。
- deadline.callback();
- assert.equal(f.destroyed(), 0);
- f.mapEvents.get("load")();
- await flush();
- assert.equal(f.destroyed(), 0);
- assert.equal(replies.length, 1);
- assert.equal(f.requested.filter(request => request.bounds).length, 1);
- } finally {
- stop();
- }
- assert.equal(f.destroyed(), 1);
- assert.equal(f.mapEvents.size, 0);
-});
-
-test("each packaged asset is bounded and CSP cannot lock before the worker body finishes", async () => {
- const f = fixture({manualAssets: true});
- const timers = controlledTimers(f.scope);
- let finishBody: (source: string) => void;
- f.scope.fetch = async () => ({ok: true, text: () => new Promise<string>(resolve => { finishBody = resolve; })});
- const pending = prepareAVMapBootstrap(f.scope, "openfreemap", new AbortController().signal);
- assert.equal(timers.size, 1);
- assert.equal([...timers.values()][0].delay, AV_MAP_ASSET_TIMEOUT);
- assert.deepEqual(f.elements.map(element => element.tag), ["link"]);
- f.elements[0].onload();
- await flush();
- assert.deepEqual(f.elements.map(element => element.tag), ["link", "script"]);
- assert.equal(timers.size, 1);
- f.elements[1].onload();
- await flush();
- assert.equal(timers.size, 1, "the worker response body remains inside the asset deadline");
- assert.equal(f.requested.some(request => request.policy || request.mapCreated || request.worker), false);
- finishBody("/* fixture worker */");
- const dispose = await pending;
- assert.equal(f.elements.at(-1).tag, "meta");
- assert.equal(timers.size, 0);
- dispose();
-});
-
-test("abort during slow CSS or script removes handlers and cannot lock CSP from a late load", async () => {
- for (const stage of ["link", "script"]) {
- const f = fixture({manualAssets: true});
- const timers = controlledTimers(f.scope);
- const abort = new AbortController();
- const pending = prepareAVMapBootstrap(f.scope, "openfreemap", abort.signal);
- if (stage === "script") {
- f.elements[0].onload();
- await flush();
- }
- const element = f.elements.at(-1);
- const lateLoad = element.onload;
- abort.abort();
- await assert.rejects(pending, /hostUnavailable/);
- lateLoad();
- assert.equal(element.onload, null);
- assert.equal(element.onerror, null);
- assert.equal(timers.size, 0);
- assert.equal(f.requested.some(request => request.policy || request.mapCreated || request.worker || request.url), false);
- }
-});
-
-test("worker header/body timeout and abort settle immediately and ignore late results", async () => {
- for (const stage of ["headers", "body"]) for (const cause of ["timeout", "abort"]) {
- const f = fixture();
- const timers = controlledTimers(f.scope);
- const abort = new AbortController();
- let finishWorker: () => void;
- let requestSignal: AbortSignal;
- f.scope.fetch = async (_url: string, options: RequestInit) => {
- requestSignal = options.signal;
- if (stage === "headers") {
- return new Promise(resolve => { finishWorker = () => resolve({ok: true, text: async () => "/* too late */"}); });
- }
- return {ok: true, text: () => new Promise<string>(resolve => { finishWorker = () => resolve("/* too late */"); })};
- };
- const pending = prepareAVMapBootstrap(f.scope, "openfreemap", abort.signal);
- await flush();
- assert.equal(timers.size, 1);
- if (cause === "timeout") [...timers.values()][0].callback();
- else abort.abort();
- await assert.rejects(pending, /hostUnavailable/);
- assert.equal(requestSignal.aborted, true);
- assert.equal(timers.size, 0);
- finishWorker();
- await flush();
- assert.equal(f.requested.some(request => request.policy || request.mapCreated || request.worker), false);
- await assert.rejects(loadAVMapAdapter(init, f.container, callbacks, new AbortController().signal), /hostUnavailable/);
- }
-});
-
-test("control initialization failure disposes the map and revokes its prepared worker", async () => {
- const f = fixture({controlError: true});
- const signal = new AbortController().signal;
- await prepareAVMapBootstrap(f.scope, "openfreemap", signal);
- const revoked: string[] = [];
- const original = URL.revokeObjectURL;
- URL.revokeObjectURL = url => { revoked.push(url); original(url); };
- try {
- await assert.rejects(loadAVMapAdapter(init, f.container, callbacks, signal), (error: unknown) => {
- assert.ok(error instanceof AVMapLoadError);
- assert.equal(error.code, "mapCreationFailed");
- return true;
- });
- assert.equal(f.destroyed(), 1);
- assert.deepEqual(revoked, [f.requested.find(request => request.worker).worker]);
- await assert.rejects(loadAVMapAdapter(init, f.container, callbacks, signal), /hostUnavailable/);
- } finally {
- URL.revokeObjectURL = original;
- }
-});
-
-test("failed worker or CSP preparation cannot leave usable prepared assets", async () => {
- for (const stage of ["workerResponse", "workerBody", "workerThrow", "policy"]) {
- const f = fixture({policyFailure: stage === "policy"});
- const timers = controlledTimers(f.scope);
- if (stage === "workerResponse") f.scope.fetch = async () => ({ok: false});
- if (stage === "workerBody") f.scope.fetch = async () => ({ok: true, text: async () => { throw new Error("private body"); }});
- if (stage === "workerThrow") f.scope.fetch = () => { throw new Error("private request"); };
- await assert.rejects(prepareAVMapBootstrap(f.scope, "openfreemap", new AbortController().signal), /hostUnavailable/);
- assert.equal(timers.size, 0);
- await assert.rejects(loadAVMapAdapter(init, f.container, callbacks, new AbortController().signal), /hostUnavailable/);
- assert.equal(f.requested.some(request => request.mapCreated || request.worker), false);
- }
-});
-
-test("removed providers cannot load assets or initialize an adapter", async () => {
- for (const provider of ["amap", "tencent", "baidu"]) {
- const {scope, requested, container} = fixture();
- const signal = new AbortController().signal;
- await assert.rejects(prepareAVMapBootstrap(scope, provider as any, signal), /hostUnavailable/);
- await assert.rejects(loadAVMapAdapter({...init, provider: provider as any}, container, callbacks, signal), /hostUnavailable/);
- assert.equal(requested.length, 0);
- }
-});
-
-test("abort destroys a map that has not become ready", async () => {
- const {scope, container, destroyed} = fixture({ready: false});
- const abort = new AbortController();
- await prepareAVMapBootstrap(scope, "openfreemap", abort.signal);
- const pending = loadAVMapAdapter(init, container, callbacks, abort.signal);
- await new Promise(resolve => setImmediate(resolve));
- abort.abort();
- await assert.rejects(pending, /sdkUnavailable/);
- assert.equal(destroyed(), 1);
-});
-
-test("construction and ready failures return controlled stages", async () => {
- for (const mapError of [true, false]) {
- const {scope, container, destroyed} = fixture({mapError, ready: false});
- const signal = new AbortController().signal;
- await prepareAVMapBootstrap(scope, "openfreemap", signal);
- let timer: () => void;
- scope.setTimeout = (callback: () => void, delay: number) => {
- assert.equal(delay, AV_MAP_READY_TIMEOUT);
- timer = callback;
- return 1;
- };
- scope.clearTimeout = () => {};
- const pending = loadAVMapAdapter(init, container, callbacks, signal);
- const rejected = assert.rejects(pending, (error: unknown) => {
- assert.ok(error instanceof AVMapLoadError);
- assert.equal(error.code, mapError ? "mapCreationFailed" : "mapReadyTimeout");
- assert.equal(error.message, "Map loading failed");
- return true;
- });
- if (!mapError) timer();
- await rejected;
- assert.equal(destroyed(), mapError ? 0 : 1);
- }
-});
diff --git a/app/src/protyle/render/av/map/providersLoader.ts b/app/src/protyle/render/av/map/providersLoader.ts
deleted file mode 100644
index 0f9ac53160..0000000000
--- a/app/src/protyle/render/av/map/providersLoader.ts
+++ /dev/null
@@ -1,179 +0,0 @@
-import {AVMapInit, AVMapLoadError, AVMapLoadErrorCode, AVMapProvider, getAVMapLoadErrorCode, isAVMapProvider} from "./protocol";
-import {AVMapAdapter, AVMapAdapterCallbacks, createAVMapAdapter} from "./providers";
-import {AV_MAP_ASSET_TIMEOUT, AV_MAP_READY_TIMEOUT} from "./loadingBudget";
-
-interface AVMapPreparedAssets {
- locked: boolean;
- sdk?: any;
- workerSource?: string;
- workerURL?: string;
- destroy: () => void;
-}
-
-const preparedAssets = new WeakMap<Window, AVMapPreparedAssets>();
-
-const loadAsset = (scope: Window, element: HTMLScriptElement | HTMLLinkElement, signal: AbortSignal,
- code?: AVMapLoadErrorCode): Promise<void> =>
- new Promise((resolve, reject) => {
- let settled = false;
- const finish = (success: boolean) => {
- if (settled) return;
- settled = true;
- scope.clearTimeout(timer);
- element.onload = null;
- element.onerror = null;
- signal.removeEventListener("abort", abort);
- if (success) {
- resolve();
- } else {
- element.remove();
- reject(code && !signal.aborted ? new AVMapLoadError(code) : new Error("hostUnavailable"));
- }
- };
- const abort = () => finish(false);
- const timer = scope.setTimeout(abort, AV_MAP_ASSET_TIMEOUT);
- signal.addEventListener("abort", abort, {once: true});
- element.onload = () => finish(true);
- element.onerror = abort;
- try {
- if (signal.aborted) finish(false);
- else scope.document.head.appendChild(element);
- } catch (_error) {
- finish(false);
- }
- });
-
-const loadWorkerSource = (scope: Window, signal: AbortSignal): Promise<string> => new Promise((resolve, reject) => {
- const request = new AbortController();
- let settled = false;
- const finish = (source?: string) => {
- if (settled) return;
- settled = true;
- scope.clearTimeout(timer);
- signal.removeEventListener("abort", abort);
- if (source === undefined) {
- request.abort();
- reject(new Error("hostUnavailable"));
- } else {
- resolve(source);
- }
- };
- const abort = () => finish();
- const timer = scope.setTimeout(abort, AV_MAP_ASSET_TIMEOUT);
- signal.addEventListener("abort", abort, {once: true});
- if (signal.aborted) {
- abort();
- return;
- }
- void Promise.resolve().then(() => {
- if (request.signal.aborted) throw new Error("hostUnavailable");
- return scope.fetch("/stage/build/map/maplibre-gl-csp-worker.js", {
- credentials: "omit", mode: "cors", cache: "no-store", referrerPolicy: "no-referrer", signal: request.signal,
- });
- }).then(async response => {
- if (settled) return;
- if (!response.ok) throw new Error("hostUnavailable");
- finish(await response.text());
- }).catch(abort);
-});
-
-// 此阶段仅准备随应用打包的资源;CSP 锁定前不创建 Map、Worker 或 blob。
-export const prepareAVMapAssets = async (scope: Window, provider: AVMapProvider, signal: AbortSignal) => {
- if (!isAVMapProvider(provider) || preparedAssets.has(scope) || signal.aborted) {
- throw new Error("hostUnavailable");
- }
- const assets: AVMapPreparedAssets = {locked: false, destroy: () => {
- if (assets.workerURL) {
- URL.revokeObjectURL(assets.workerURL);
- assets.workerURL = undefined;
- }
- assets.workerSource = undefined;
- if (preparedAssets.get(scope) === assets) preparedAssets.delete(scope);
- }};
- preparedAssets.set(scope, assets);
- try {
- const stylesheet = scope.document.createElement("link");
- stylesheet.rel = "stylesheet";
- stylesheet.href = "/stage/build/map/maplibre-gl.css";
- await loadAsset(scope, stylesheet, signal);
- const script = scope.document.createElement("script");
- script.src = "/stage/build/map/maplibre-gl.js";
- script.referrerPolicy = "no-referrer";
- script.async = true;
- await loadAsset(scope, script, signal, "sdkScriptLoadFailed");
- assets.sdk = (scope as unknown as Record<string, any>).maplibregl;
- if (signal.aborted) throw new Error("hostUnavailable");
- if (!assets.sdk || [assets.sdk.Map, assets.sdk.AttributionControl, assets.sdk.setWorkerUrl]
- .some(value => typeof value !== "function")) throw new AVMapLoadError("sdkGlobalMissing");
- assets.workerSource = await loadWorkerSource(scope, signal);
- if (signal.aborted) throw new Error("hostUnavailable");
- return {lock: () => { assets.locked = true; }, destroy: assets.destroy};
- } catch (error) {
- assets.destroy();
- const code = getAVMapLoadErrorCode(error);
- if (code) throw new AVMapLoadError(code);
- throw new Error("hostUnavailable");
- }
-};
-
-export const loadAVMapAdapter = async (init: AVMapInit, container: HTMLElement,
- callbacks: AVMapAdapterCallbacks, signal: AbortSignal): Promise<AVMapAdapter> => {
- const scope = container.ownerDocument.defaultView;
- const assets = preparedAssets.get(scope);
- if (!isAVMapProvider(init.provider) || !assets?.locked || signal.aborted) {
- throw new Error("hostUnavailable");
- }
- try {
- // Worker 和 blob 继承已锁定的策略,不具有本地网络访问权限。
- assets.workerURL = URL.createObjectURL(new Blob([assets.workerSource], {type: "text/javascript"}));
- assets.workerSource = undefined;
- const sdk = assets.sdk;
- sdk.setWorkerUrl(assets.workerURL);
- let adapter: AVMapAdapter;
- await new Promise<void>((resolve, reject) => {
- let settled = false;
- const finish = (success: boolean, code?: AVMapLoadErrorCode) => {
- if (settled) return;
- settled = true;
- scope.clearTimeout(timer);
- signal.removeEventListener("abort", abort);
- if (success) {
- resolve();
- } else {
- try {
- adapter?.destroy();
- } finally {
- reject(code ? new AVMapLoadError(code) : new Error("mapUnavailable"));
- }
- }
- };
- const abort = () => finish(false);
- const timer = scope.setTimeout(() => finish(false, "mapReadyTimeout"), AV_MAP_READY_TIMEOUT);
- signal.addEventListener("abort", abort, {once: true});
- try {
- adapter = createAVMapAdapter(init.provider, sdk, container, {...callbacks,
- onReady: () => finish(true), onError: code => {
- callbacks.onError(code);
- finish(false);
- }});
- if (signal.aborted) finish(false);
- } catch (_error) {
- finish(false, "mapCreationFailed");
- }
- });
- const destroy = adapter.destroy;
- adapter.destroy = () => {
- try {
- destroy();
- } finally {
- assets.destroy();
- }
- };
- return adapter;
- } catch (error) {
- assets.destroy();
- const code = getAVMapLoadErrorCode(error);
- if (code) throw new AVMapLoadError(code);
- throw new Error("sdkUnavailable");
- }
-};
diff --git a/app/src/protyle/render/av/map/render.test.ts b/app/src/protyle/render/av/map/render.test.ts
deleted file mode 100644
index ec66d727bd..0000000000
--- a/app/src/protyle/render/av/map/render.test.ts
+++ /dev/null
@@ -1,711 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {test} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import * as state from "./state";
-import * as protocol from "./protocol";
-import * as escape from "../../../../util/escape";
-import type {AVMapHost, AVMapHostOptions} from "./host";
-import {DOMElement, DOMFixture, requireFixture} from "./testDOM";
-
-const setup = (options: {published?: boolean; desktop?: boolean; hostSupported?: boolean | Promise<boolean>;
- online?: boolean; protocol?: string; source?: string; failDuringCreate?: boolean; runtime?: () => Promise<unknown>} = {}) => {
- const document = new DOMFixture();
- const editor = document.createElement("div");
- editor.className = "protyle-wysiwyg";
- document.body.append(editor);
- const roots: DOMElement[] = [];
- const block = document.createElement("div");
- block.dataset.avId = "database";
- block.dataset.nodeId = "carrier";
- block.innerHTML = '<div class="av__container"><div class="av__scroll"></div></div>';
- editor.append(block);
- const records = block.querySelector(".av__scroll");
- let root: DOMElement;
- let lifecycle: {root: DOMElement; destroy: () => void; remount: () => void};
- const languages = new Proxy<Record<string, string>>({mapPageScope: "Map covers ${shown} loaded records of ${total} filtered records",
- mapLoadedCount: "Loaded ${shown}/${total}", mapSkippedCount: "Skipped ${count}",
- mapSkippedLocations: "Skipped locations: ${empty} missing, ${invalid} invalid, ${projection} unsupported projection"},
- {get: (target, key: string) => target[key] || key});
- const events = new Map<string, () => void>();
- const observers: Array<{disconnected: boolean; disconnects: number}> = [];
- class Observer {
- disconnected = false;
- disconnects = 0;
- constructor() { observers.push(this); }
- observe() {}
- disconnect() { this.disconnected = true; this.disconnects++; }
- }
- const hosts: Array<{options: AVMapHostOptions; points: protocol.AVMapPoint[]; revision: number;
- container: DOMElement; destroyed: boolean; destroys: number}> = [];
- const opened: unknown[] = [];
- const openedLinks: unknown[] = [];
- const calls: string[] = [];
- const transactions: Array<{perform: IOperation[]; undo: IOperation[]; callback: () => void}> = [];
- const unplaced: Array<{options: Parameters<typeof import("./unplaced").bindMapUnplaced>[0]; destroyed: boolean}> = [];
- const picking: Array<{points: protocol.AVMapCoordinate[]; destroyed: boolean}> = [];
- let settleTransaction: () => void;
- let transactionPromise = Promise.resolve();
- let refreshes = 0;
- const data = {id: "database", name: "Database", views: [], viewID: "map-view", viewType: "map", view: {
- columns: [{id: "location", name: "<Location>", type: "location", hidden: true},
- {id: "text", name: "Text field", type: "text"}], rowCount: 12,
- map: {locationKeyID: "location"},
- rows: [{id: "row", cells: [{id: "location-value", value: {type: "location", keyID: "location",
- location: {latitude: 0, longitude: 0, name: "Private name", originalInput: "Private input"}}},
- {id: "primary-value", valueType: "block", value: {type: "block", isDetached: true,
- block: {content: "Private title"}}}]}],
- }} as IAV;
- const protyle = {options: {}, app: {}, notebookId: "notebook", wysiwyg: {element: editor}} as unknown as IProtyle;
- const destroyMap = () => {
- lifecycle?.destroy();
- lifecycle = undefined;
- };
- const methods = {} as typeof import("./render");
- const modules: Record<string, unknown> = {
- "./state": {...state, destroyMap, registerMap: (_block: unknown, next: typeof lifecycle) => {
- destroyMap(); lifecycle = next;
- return () => lifecycle === next && next.root.isConnected;
- }},
- "../../../../util/escape": escape,
- "../../../wysiwyg/transaction": {transaction: (_protyle: IProtyle, perform: IOperation[], undo: IOperation[],
- options: {callback: () => void}) => {
- transactions.push({perform, undo, callback: options.callback});
- transactionPromise = new Promise(resolve => { settleTransaction = resolve; });
- }},
- "../../../util/transactionQueue": {waitForPendingTransactions: () => transactionPromise},
- "../render": {avRender: () => { refreshes++; }},
- "../virtualScroll": {getAVData: () => data},
- "../../../../util/fetch": {fetchSyncPost: async (url: string, payload: unknown) => {
- assert.equal(JSON.stringify(payload), "{}");
- calls.push(url);
- return options.runtime ? options.runtime() : {code: 0, data: {provider: "openfreemap"}};
- }},
- "./protocol": protocol,
- "../../../../plugin/Menu": {Menu: class {}},
- "../../../../menus/Menu": {MenuItem: class {}},
- "../../../../util/functions": {isMobile: () => false},
- "./unplaced": {bindMapUnplaced: (options: Parameters<typeof import("./unplaced").bindMapUnplaced>[0]) => {
- const binding = {options, destroyed: false};
- unplaced.push(binding);
- return () => { binding.destroyed = true; };
- }},
- "./pointPicking": {bindMapPointPicking: () => {
- const binding = {points: [] as protocol.AVMapCoordinate[], destroyed: false};
- picking.push(binding);
- return {show: (point: protocol.AVMapCoordinate) => binding.points.push(point),
- destroy: () => { binding.destroyed = true; }};
- }},
- "../openDatabaseRow": {openDatabaseRowByData: (_protyle: unknown, row: unknown) => opened.push(row)},
- "./host": {isAVMapHostEnvironmentSupported: () => options.hostSupported ?? true,
- createAVMapHost: (container: DOMElement, configuration: AVMapHostOptions) => {
- assert.ok(container?.isConnected, "Map host needs its mounted canvas");
- assert.ok(container.classList.contains("av__map-canvas"));
- const host = {options: configuration, points: [] as protocol.AVMapPoint[], revision: -1,
- container, destroyed: false, destroys: 0};
- hosts.push(host);
- if (options.failDuringCreate) configuration.onError("hostUnavailable");
- return {destroy: () => { host.destroyed = true; host.destroys++; },
- setPoints: (points: protocol.AVMapPoint[], revision: number) => { host.points = points; host.revision = revision; },
- resize() {}, setTheme() {}};
- }},
- };
- modules["./desktopTransport"] = {
- isDesktopAVMapHostSupported: async () => options.desktop === true,
- createDesktopAVMapHost: (container: unknown, configuration: AVMapHostOptions) => {
- calls.push("desktop-host");
- return (modules["./host"] as {createAVMapHost: (container: unknown, options: AVMapHostOptions) => AVMapHost})
- .createAVMapHost(container, configuration);
- },
- };
- const openRecord = {} as typeof import("./openRecord");
- runInNewContext(transpileModule(readFileSync("src/protyle/render/av/map/openRecord.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
- }).outputText, {exports: openRecord, require: requireFixture(modules), window: {siyuan: {languages}}});
- modules["./openRecord"] = openRecord;
- const settings = {} as typeof import("./settings");
- const context = {siyuan: {languages, isPublish: options.published === true}};
- runInNewContext(transpileModule(readFileSync("src/protyle/render/av/map/settings.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
- }).outputText, {exports: settings, require: requireFixture(modules), window: context});
- modules["./settings"] = settings;
- runInNewContext(transpileModule(options.source ?? readFileSync("src/protyle/render/av/map/render.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
- }).outputText, {exports: methods, require: requireFixture(modules),
- window: {...context, location: {protocol: options.protocol || "https:"},
- open: (...args: unknown[]) => openedLinks.push(args),
- addEventListener: (type: string, callback: () => void) => events.set(type, callback),
- removeEventListener: (type: string) => events.delete(type)},
- navigator: {userAgent: "Mozilla/5.0", onLine: options.online !== false},
- document: {createElement: () => { root = document.createElement("div"); roots.push(root); return root; },
- documentElement: document.documentElement},
- MutationObserver: Observer, ResizeObserver: class {constructor() { assert.fail("Map hosts own their resize observers"); }},
- Lute: {NewNodeID: () => "new-location"}});
- return {data, protyle, calls, hosts, roots, records, block, opened, openedLinks, events, observers, destroyMap, transactions, context, unplaced, picking,
- remount: () => lifecycle.remount(),
- moveToOtherEditor: () => {
- const destination = document.createElement("div");
- destination.className = "protyle-wysiwyg";
- document.body.append(destination);
- destination.append(block);
- },
- refreshes: () => refreshes,
- completeTransaction: async (success = true) => {
- if (success) transactions[transactions.length - 1].callback();
- settleTransaction();
- await transactionPromise;
- await new Promise(resolve => setImmediate(resolve));
- },
- render: () => methods.renderMap(block as unknown as HTMLElement, protyle, data),
- setupHTML: () => root.querySelector(".av__map-status").innerHTML,
- control: (selector: string) => root.querySelector(selector),
- status: () => root.querySelector(".av__map-status").textContent};
-};
-
-test("map summary keeps loaded scope in one compact line and omits zero skipped locations", async () => {
- const scenario = setup();
- await scenario.render();
- assert.match(scenario.roots[0].innerHTML, /<span>Loaded 1\/12<\/span><span class="av__map-skipped"><\/span>/);
- assert.match(scenario.roots[0].innerHTML, /b3-tooltips b3-tooltips__nw" aria-label="Map covers 1 loaded records of 12 filtered records" tabindex="0"/);
- assert.equal(scenario.control(".av__map-skipped").textContent, "");
- assert.doesNotMatch(scenario.roots[0].innerHTML, /<div class="av__map-skipped|Skipped 0/);
-});
-
-test("map toolbar places the unplaced inbox after the summary and disposes its requests with the map", async () => {
- const scenario = setup();
- await scenario.render();
- const html = scenario.roots[0].innerHTML;
- assert.match(html, /av__map-toolbar/);
- const toggle = scenario.control("[data-map-unplaced-toggle]");
- assert.equal(toggle.getAttribute("data-position"), "4north");
- assert.equal(toggle.getAttribute("aria-expanded"), "false");
- assert.match(toggle.innerHTML, /#iconInbox/);
- assert.ok(html.indexOf("av__map-summary") < html.indexOf("data-map-unplaced-toggle"));
- assert.equal(scenario.unplaced.length, 1);
- assert.equal(scenario.unplaced[0].options.data, scenario.data);
- await scenario.render();
- assert.equal(scenario.unplaced[0].destroyed, true);
- assert.equal(scenario.unplaced[1].destroyed, false);
- scenario.destroyMap();
- assert.equal(scenario.unplaced[1].destroyed, true);
-});
-
-test("unplaced records remain accessible when the map is empty or its online host cannot load", async () => {
- for (const mode of ["empty", "unsupported", "offline"]) {
- const scenario = setup({hostSupported: mode !== "unsupported", online: mode !== "offline"});
- if (mode === "empty") (scenario.data.view as IAVTable).rows = [];
- await scenario.render();
- assert.equal(scenario.unplaced.length, 1, mode);
- assert.match(scenario.roots[0].innerHTML, /data-map-unplaced-toggle/);
- }
-});
-
-test("unplaced inbox matches calendar edit permissions and requires a valid selected location field", async () => {
- for (const mode of ["disabled", "published", "created", "snapshot", "missing", "changed-type"]) {
- const scenario = setup({published: mode === "published"});
- scenario.protyle.disabled = mode === "disabled";
- if (["created", "snapshot"].includes(mode)) scenario.protyle.options.history = {[mode]: "version"};
- if (mode === "missing") (scenario.data.view as IAVTable).map.locationKeyID = "removed";
- if (mode === "changed-type") (scenario.data.view as IAVTable).map.locationKeyID = "text";
- await scenario.render();
- assert.equal(scenario.unplaced.length, 0, mode);
- assert.doesNotMatch(scenario.roots[0].innerHTML, /data-map-unplaced-toggle/);
- }
-});
-
-test("map summary counts all skipped locations and keeps their reasons in its tooltip", async () => {
- const scenario = setup();
- const view = scenario.data.view as IAVTable;
- const row = view.rows[0];
- const withLocation = (id: string, location?: IAVCellLocationValue) => ({...row, id, cells: [{
- ...row.cells[0], value: {...row.cells[0].value, location},
- }]});
- view.rows.push(withLocation("empty"), withLocation("invalid", {latitude: 100, longitude: 0}),
- withLocation("projection", {latitude: 90, longitude: 0}));
- await scenario.render();
- assert.match(scenario.roots[0].innerHTML, /<span>Loaded 4\/12<\/span>/);
- assert.equal(scenario.control(".av__map-skipped").textContent, "Skipped 3");
- assert.equal(scenario.control(".av__map-summary").getAttribute("aria-label"),
- "Map covers 4 loaded records of 12 filtered records\nSkipped locations: 1 missing, 1 invalid, 1 unsupported projection");
- assert.equal(scenario.hosts[0].points.length, 1);
- view.rows = [row];
- await scenario.render();
- assert.match(scenario.roots[1].innerHTML, /<span>Loaded 1\/12<\/span>/);
- assert.equal(scenario.control(".av__map-skipped").textContent, "");
- assert.doesNotMatch(scenario.roots[1].innerHTML, /Skipped locations/);
-});
-
-test("map summary retains skipped counts when every loaded row lacks a compatible location", async () => {
- const scenario = setup();
- const view = scenario.data.view as IAVTable;
- view.rows[0].cells[0].value.location.latitude = 90;
- await scenario.render();
- scenario.hosts[0].options.onReady();
- assert.equal(scenario.status(), "mapNoMarkers");
- assert.equal(scenario.control(".av__map-skipped").textContent, "Skipped 1");
- assert.equal(scenario.control(".av__map-summary").getAttribute("aria-label"),
- "Map covers 1 loaded records of 12 filtered records\nSkipped locations: 0 missing, 0 invalid, 1 unsupported projection");
- assert.deepEqual(scenario.calls, ["/api/map/getRuntime"]);
- assert.deepEqual(scenario.hosts[0].points, []);
-});
-
-test("map attribution stays inside the control and parent opens only fixed current destinations", async () => {
- const scenario = setup();
- await scenario.render();
- const {options} = scenario.hosts[0];
- assert.doesNotMatch(scenario.roots[0].innerHTML, /data-map-attribution/);
- options.onAttributionClick("maplibre");
- options.onAttributionClick("https://evil.invalid/" as any);
- assert.deepEqual(scenario.openedLinks, [["https://maplibre.org/", "_blank", "noopener,noreferrer"]]);
- scenario.destroyMap();
- options.onAttributionClick("openstreetmap");
- assert.equal(scenario.openedLinks.length, 1);
-});
-
-test("published maps render a status without inline settings, runtime admission, or SDK calls", async () => {
- const scenario = setup({published: true});
- await scenario.render();
- assert.deepEqual(scenario.calls, []);
- assert.equal(scenario.hosts.length, 0);
- assert.equal(scenario.status(), "mapPublicFallback");
- assert.doesNotMatch(scenario.roots[0].innerHTML, /av__map-settings|data-map-setting|data-map-configure|av__map-actions|data-map-fit|data-map-retry/);
-});
-
-test("missing field, unavailable host, offline and empty readonly maps never request runtime admission", async () => {
- for (const option of [{hostSupported: false}, {online: false}, {}]) {
- const scenario = setup(option);
- if (!Object.keys(option).length) (scenario.data.view as IAVTable).columns = [];
- await scenario.render();
- assert.deepEqual(scenario.calls, []);
- assert.equal(scenario.hosts.length, 0);
- }
- const incompatible = setup();
- incompatible.protyle.disabled = true;
- (incompatible.data.view as IAVTable).rows[0].cells[0].value.location.latitude = 90;
- await incompatible.render();
- assert.deepEqual(incompatible.calls, []);
- assert.equal(incompatible.status(), "mapNoMarkers");
-});
-
-test("empty editable maps permit first-point picking and stale or disposed callbacks cannot open popovers", async () => {
- const scenario = setup();
- (scenario.data.view as IAVTable).rows = [];
- await scenario.render();
- const host = scenario.hosts[0];
- const point = {longitude: 0, latitude: 0};
- assert.deepEqual(host.points, []);
- host.options.onPointClick(point, host.revision - 1);
- host.options.onPointClick(point, host.revision);
- assert.deepEqual(scenario.picking[0].points, [point]);
- await scenario.render();
- host.options.onPointClick(point, host.revision);
- assert.equal(scenario.picking[0].destroyed, true);
- assert.equal(scenario.picking[0].points.length, 1);
- scenario.events.get("offline")();
- const next = scenario.hosts[1];
- next.options.onPointClick(point, next.revision);
- assert.equal(scenario.picking[1].destroyed, true);
- assert.equal(scenario.picking[1].points.length, 0);
-});
-
-test("deleted and changed-type map fields show a repairable location setup", async () => {
- for (const locationKeyID of ["deleted", "text"]) {
- const scenario = setup();
- (scenario.data.view as IAVTable).map.locationKeyID = locationKeyID;
- await scenario.render();
- const html = scenario.setupHTML();
- assert.match(html, /class="av__map-empty"/);
- assert.match(html, /#iconMap/);
- assert.match(html, locationKeyID ? /mapMissingLocationField/ : /mapSelectLocationField/);
- assert.match(html, /<label class="av__map-setting"><span>mapLocationField<\/span>/);
- const select = scenario.control("[data-map-location-field]");
- assert.equal(select.tagName, "SELECT");
- assert.equal(select.getAttribute("aria-label"), "mapLocationField");
- assert.equal(select.querySelector('[value="location"]').textContent, "<Location>");
- assert.match(html, /class="b3-button b3-button--outline" data-map-create-field/);
- assert.doesNotMatch(html, /value="text"|<Location>|provider|CRS|serviceID/);
- assert.deepEqual(scenario.calls, []);
- }
- const empty = setup();
- (empty.data.view as IAVTable).map.locationKeyID = "";
- (empty.data.view as IAVTable).columns = [];
- await empty.render();
- assert.match(empty.setupHTML(), /data-map-create-field/);
- assert.match(empty.setupHTML(), /mapSelectLocationField/);
-});
-
-test("map height is derived per view without changing the stored settings", async () => {
- for (const height of [undefined, 320, 480, 640, 800] as const) {
- const scenario = setup();
- const view = scenario.data.view as IAVTable;
- if (height !== undefined) view.map.height = height;
- const stored = JSON.stringify(view.map);
- await scenario.render();
- assert.equal(scenario.roots[0].dataset.mapHeight, (height || 480).toString());
- assert.equal(JSON.stringify(view.map), stored);
- assert.equal(scenario.hosts.length, 1);
- scenario.destroyMap();
- }
-});
-
-test("parsed templates do not manufacture missing controls and reject a canvas class mutation", async () => {
- const scenario = setup();
- await scenario.render();
- assert.equal(scenario.control("[data-map-create-field]"), null);
- assert.equal(scenario.hosts[0].container, scenario.control(".av__map-canvas"));
- assert.equal(scenario.hosts[0].container.classList.contains("fn__none"), false);
- const source = readFileSync("src/protyle/render/av/map/render.ts", "utf8");
- const mutated = source.replace('class="av__map-canvas fn__none"', 'class="av__wrong-canvas fn__none"');
- assert.notEqual(mutated, source);
- const broken = setup({source: mutated});
- await assert.rejects(broken.render(), /classList/);
- assert.equal(broken.hosts.length, 0);
-});
-
-test("render requires an existing records container and contains mounted map input events", async () => {
- const absent = setup();
- absent.records.remove();
- await absent.render();
- assert.equal(absent.roots.length, 0);
- const scenario = setup();
- await scenario.render();
- let escaped = 0;
- for (const type of ["click", "keydown", "pointerdown"]) {
- scenario.block.addEventListener(type, () => escaped++);
- scenario.control(".av__map-canvas").dispatch(type);
- }
- assert.equal(escaped, 0);
-});
-
-test("undeclared VM imports fail instead of silently returning an empty module", () => {
- assert.throws(() => requireFixture({})("./unlisted"), /Unexpected require: \.\/unlisted/);
-});
-
-test("unconfigured maps render existing location fields without submitting settings transactions", async () => {
- for (const mode of ["editable", "readonly", "published", "history"]) {
- const scenario = setup({published: mode === "published"});
- const view = scenario.data.view as IAVTable;
- view.map.locationKeyID = "";
- scenario.protyle.disabled = mode === "readonly";
- if (mode === "history") scenario.protyle.options.history = {created: "version"};
- const before = JSON.stringify(view);
- await scenario.render();
- assert.equal(JSON.stringify(view), before);
- assert.equal(scenario.transactions.length, 0);
- assert.equal(scenario.hosts.length, mode === "editable" || mode === "readonly" ? 1 : 0);
- assert.doesNotMatch(scenario.setupHTML(), /data-map-create-field/);
- }
-});
-
-test("selecting an existing location field submits one undoable transaction and refreshes after success", async () => {
- const scenario = setup();
- const view = scenario.data.view as IAVTable;
- view.map.locationKeyID = "deleted";
- view.map.height = 640;
- const before = JSON.stringify(view);
- await scenario.render();
- const select = scenario.control("[data-map-location-field]");
- select.value = "text";
- select.dispatch("change");
- select.value = "";
- select.dispatch("change");
- assert.equal(scenario.transactions.length, 0);
- select.value = "location";
- select.dispatch("change");
- select.dispatch("change");
- scenario.control("[data-map-create-field]").dispatch("click");
- assert.equal(scenario.transactions.length, 1);
- assert.equal(select.disabled, true);
- assert.equal(scenario.control("[data-map-create-field]").disabled, true);
- const {perform, undo} = scenario.transactions[0];
- assert.equal(JSON.stringify(perform), JSON.stringify([{avID: "database", blockID: "carrier", viewID: "map-view",
- action: "setAttrViewMap", data: {locationKeyID: "location", height: 640}}]));
- assert.equal(JSON.stringify(undo[0].data), JSON.stringify({locationKeyID: "deleted", height: 640}));
- assert.equal(JSON.stringify(view), before);
- assert.equal(scenario.refreshes(), 0);
- await scenario.completeTransaction();
- assert.equal(scenario.refreshes(), 1);
- select.dispatch("change");
- assert.equal(scenario.transactions.length, 1);
-});
-
-test("adding a location field atomically creates, selects and hides it with an undo restoring the previous field", async () => {
- const scenario = setup();
- (scenario.data.view as IAVTable).map.locationKeyID = "";
- (scenario.data.view as IAVTable).columns = [];
- await scenario.render();
- const create = scenario.control("[data-map-create-field]");
- create.dispatch("click");
- create.dispatch("click");
- assert.equal(scenario.transactions.length, 1);
- const {perform, undo} = scenario.transactions[0];
- assert.equal(JSON.stringify(perform), JSON.stringify([
- {avID: "database", blockID: "carrier", viewID: "map-view", action: "addAttrViewCol",
- id: "new-location", type: "location", name: "location"},
- {avID: "database", blockID: "carrier", viewID: "map-view", action: "setAttrViewMap", data: {locationKeyID: "new-location"}},
- {avID: "database", blockID: "carrier", viewID: "map-view", action: "setAttrViewColHidden",
- id: "new-location", viewIDs: ["map-view"], data: true},
- ]));
- assert.equal(JSON.stringify(undo), JSON.stringify([
- {avID: "database", blockID: "carrier", viewID: "map-view", action: "setAttrViewMap", data: {locationKeyID: ""}},
- {avID: "database", blockID: "carrier", viewID: "map-view", action: "removeAttrViewCol", id: "new-location"},
- ]));
- await scenario.completeTransaction();
- assert.equal(scenario.refreshes(), 1);
-});
-
-test("map setup hides write controls for readonly, published and history modes", async () => {
- for (const mode of ["disabled", "published", "created", "snapshot"]) {
- const scenario = setup({published: mode === "published"});
- scenario.protyle.disabled = mode === "disabled";
- if (["created", "snapshot"].includes(mode)) scenario.protyle.options.history = {[mode]: "version"};
- (scenario.data.view as IAVTable).map.locationKeyID = "deleted";
- await scenario.render();
- assert.doesNotMatch(scenario.setupHTML(), /data-map-location-field|data-map-create-field/);
- if (mode === "disabled") assert.match(scenario.setupHTML(), /av__map-empty/);
- assert.deepEqual(scenario.transactions, []);
- }
-});
-
-test("stale setup controls and permissions changed after render cannot submit a transaction", async () => {
- for (const mode of ["disabled", "published", "created", "snapshot", "destroyed", "removed", "rerendered"]) {
- const scenario = setup();
- (scenario.data.view as IAVTable).map.locationKeyID = "deleted";
- await scenario.render();
- const select = scenario.control("[data-map-location-field]");
- const create = scenario.control("[data-map-create-field]");
- if (mode === "disabled") scenario.protyle.disabled = true;
- if (mode === "published") scenario.context.siyuan.isPublish = true;
- if (["created", "snapshot"].includes(mode)) scenario.protyle.options.history = {[mode]: "version"};
- if (mode === "destroyed") scenario.destroyMap();
- if (mode === "removed") scenario.roots[0].remove();
- if (mode === "rerendered") await scenario.render();
- select.value = "location";
- select.dispatch("change");
- create.dispatch("click");
- assert.equal(scenario.transactions.length, 0, mode);
- }
-});
-
-test("failed setup transactions reenable controls, while late completion cannot refresh a destroyed map", async () => {
- const scenario = setup();
- (scenario.data.view as IAVTable).map.locationKeyID = "";
- (scenario.data.view as IAVTable).columns = [];
- await scenario.render();
- const create = scenario.control("[data-map-create-field]");
- create.dispatch("click");
- assert.equal(create.disabled, true);
- await scenario.completeTransaction(false);
- assert.equal(create.disabled, false);
- assert.equal(scenario.refreshes(), 0);
- create.dispatch("click");
- assert.equal(scenario.transactions.length, 2);
- scenario.destroyMap();
- await scenario.completeTransaction();
- assert.equal(scenario.refreshes(), 0);
-});
-
-test("late setup transaction completions cannot refresh a removed or superseded view", async () => {
- for (const mode of ["removed", "rerendered"]) {
- const scenario = setup();
- (scenario.data.view as IAVTable).map.locationKeyID = "deleted";
- await scenario.render();
- scenario.control("[data-map-create-field]").dispatch("click");
- if (mode === "removed") scenario.roots[0].remove();
- else await scenario.render();
- await scenario.completeTransaction();
- assert.equal(scenario.refreshes(), 0);
- }
-});
-
-test("map sends only IDs and coordinates and opens the existing row detail for a current marker", async () => {
- const scenario = setup();
- await scenario.render();
- assert.deepEqual(scenario.calls, ["/api/map/getRuntime"]);
- const host = scenario.hosts[0];
- assert.equal(JSON.stringify(host.points), JSON.stringify([{id: "row", longitude: 0, latitude: 0}]));
- assert.doesNotMatch(JSON.stringify(host.options), /Private|primary-value|notebook/);
- host.options.onReady();
- assert.doesNotMatch(scenario.roots[0].innerHTML, /av__map-settings|data-map-setting|data-map-configure|av__map-actions|data-map-fit|data-map-retry/);
- host.options.onMarkerClick("other", host.revision);
- host.options.onMarkerClick("row", host.revision - 1);
- assert.equal(scenario.opened.length, 0);
- host.options.onMarkerClick("row", host.revision);
- assert.equal((scenario.opened[0] as {itemID: string}).itemID, "row");
- scenario.events.get("offline")();
- assert.equal(host.destroyed, true);
- assert.equal(scenario.status(), "mapOffline");
- host.options.onMarkerClick("row", host.revision);
- assert.equal(scenario.opened.length, 1);
- scenario.destroyMap();
- assert.equal(scenario.observers.every(observer => observer.disconnected), true);
- assert.equal(scenario.events.size, 0);
-});
-
-test("an independently secured desktop host is selected instead of a renderer iframe", async () => {
- const scenario = setup({desktop: true, hostSupported: false});
- await scenario.render();
- assert.deepEqual(scenario.calls, ["/api/map/getRuntime", "desktop-host"]);
- assert.equal(scenario.hosts.length, 1);
-});
-
-test("late native capability replies cannot initialize a removed map", async () => {
- let report: (supported: boolean) => void;
- const scenario = setup({hostSupported: new Promise<boolean>(resolve => { report = resolve; })});
- const pending = scenario.render();
- await new Promise(resolve => setImmediate(resolve));
- scenario.destroyMap();
- report(true);
- await pending;
- assert.deepEqual(scenario.calls, []);
- assert.equal(scenario.hosts.length, 0);
-});
-
-test("stale runtime responses cannot mount a map after the view is removed", async () => {
- let respond: (value: unknown) => void;
- const scenario = setup({runtime: () => new Promise(resolve => { respond = resolve; })});
- const rendering = scenario.render();
- await new Promise(resolve => setImmediate(resolve));
- scenario.roots[0].remove();
- respond({code: 0, data: {provider: "openfreemap"}});
- await rendering;
- assert.equal(scenario.hosts.length, 0);
-});
-
-test("history and oversized loaded pages report status without fetching runtime admission", async () => {
- const history = setup();
- history.protyle.options.history = {created: "version"};
- await history.render();
- assert.deepEqual(history.calls, []);
- const scenario = setup();
- const view = scenario.data.view as IAVTable;
- view.rows = Array.from({length: protocol.AV_MAP_MAX_POINTS + 1}, (_, index) => ({...view.rows[0], id: `row-${index}`}));
- await scenario.render();
- assert.deepEqual(scenario.calls, []);
- assert.equal(scenario.status(), "mapTooManyMarkers");
- assert.equal(scenario.hosts.length, 0);
-});
-
-test("rerendering a map destroys the old host and invalidates its callbacks", async () => {
- const scenario = setup();
- await scenario.render();
- const previous = scenario.hosts[0];
- previous.options.onReady();
- await scenario.render();
- assert.equal(previous.destroyed, true);
- previous.options.onError("hostUnavailable");
- assert.equal(scenario.hosts[1].destroyed, false);
- assert.equal(scenario.status(), "mapLoading");
- previous.options.onMarkerClick("row", previous.revision);
- assert.equal(scenario.opened.length, 0);
- const next = scenario.hosts[1];
- next.options.onReady();
- next.options.onMarkerClick("row", next.revision);
- assert.equal(scenario.opened.length, 1);
- scenario.destroyMap();
-});
-
-test("host failure releases its observers once while preserving the unplaced inbox", async () => {
- for (const mode of ["offline", "error"]) {
- const scenario = setup();
- await scenario.render();
- const host = scenario.hosts[0];
- if (mode === "offline") scenario.events.get("offline")();
- else host.options.onError("hostUnavailable");
- assert.equal(host.destroys, 1, mode);
- assert.equal(scenario.observers.length, 1);
- assert.equal(scenario.observers[0].disconnects, 1);
- assert.equal(scenario.events.size, 0);
- assert.equal(scenario.unplaced[0].destroyed, false);
- assert.equal(scenario.control(".av__map-canvas").classList.contains("fn__none"), true);
- const status = scenario.status();
- host.options.onReady();
- host.options.onError("hostUnavailable");
- assert.equal(scenario.status(), status);
- scenario.destroyMap();
- scenario.destroyMap();
- assert.equal(host.destroys, 1);
- assert.equal(scenario.observers[0].disconnects, 1);
- assert.equal(scenario.unplaced[0].destroyed, true);
- }
-});
-
-test("a host that fails synchronously during creation never acquires view observers", async () => {
- const scenario = setup({failDuringCreate: true});
- await scenario.render();
- assert.equal(scenario.status(), "mapLoadError");
- assert.equal(scenario.hosts[0].destroys, 1);
- assert.equal(scenario.hosts[0].points.length, 0);
- assert.equal(scenario.observers.length, 0);
- assert.equal(scenario.events.size, 0);
- assert.equal(scenario.unplaced[0].destroyed, false);
- scenario.destroyMap();
- assert.equal(scenario.hosts[0].destroys, 1);
-});
-
-test("moving a live map remounts its host and ignores replies from the old host", async () => {
- const scenario = setup();
- await scenario.render();
- const original = scenario.hosts[0];
- scenario.remount();
- await new Promise(resolve => setImmediate(resolve));
- assert.equal(original.destroys, 1);
- assert.equal(scenario.hosts.length, 2);
- original.options.onMarkerClick("row", original.revision);
- original.options.onError("hostUnavailable");
- assert.equal(scenario.opened.length, 0);
- assert.equal(scenario.hosts[1].destroyed, false);
- assert.equal(scenario.unplaced[0].destroyed, true);
-});
-
-test("a moved guest can recover when its disconnect error arrives before the DOM observer", async () => {
- const scenario = setup();
- await scenario.render();
- scenario.hosts[0].options.onError("hostUnavailable");
- assert.equal(scenario.hosts[0].destroys, 1);
- scenario.remount();
- await new Promise(resolve => setImmediate(resolve));
- assert.equal(scenario.hosts.length, 2);
- assert.equal(scenario.hosts[1].destroyed, false);
-});
-
-test("cross-editor moves invalidate active and hostless maps before destination transactions rehydrate them", async () => {
- for (const mode of ["live", "setup", "offline", "pending"]) {
- let finish: (response: unknown) => void;
- const scenario = setup({online: mode !== "offline", runtime: mode === "pending" ?
- () => new Promise(resolve => { finish = resolve; }) : undefined});
- if (mode === "setup") (scenario.data.view as IAVTable).columns = [];
- scenario.block.setAttribute("data-render", "true");
- const rendering = scenario.render();
- await new Promise(resolve => setImmediate(resolve));
- scenario.moveToOtherEditor();
- scenario.remount();
- if (finish) finish({code: 0, data: {provider: "openfreemap"}});
- await rendering;
- assert.equal(scenario.block.getAttribute("data-render"), null);
- assert.equal(scenario.block.querySelector(".av__map"), null);
- assert.equal(scenario.hosts.length, mode === "live" ? 1 : 0);
- assert.ok(scenario.hosts.every(host => host.destroyed));
- assert.ok(scenario.unplaced.every(binding => binding.destroyed));
- assert.ok(scenario.picking.every(binding => binding.destroyed));
- }
-});
-
-test("non-HTTP, both history modes and published views retain their own safe fallbacks", async () => {
- for (const mode of ["protocol", "created", "snapshot", "published"]) {
- const scenario = setup({protocol: mode === "protocol" ? "file:" : "https:", published: mode === "published"});
- if (mode === "created" || mode === "snapshot") scenario.protyle.options.history = {[mode]: "version"};
- await scenario.render();
- assert.equal(scenario.status(), mode === "published" ? "mapPublicFallback" : "mapUnsupportedClient");
- assert.deepEqual(scenario.calls, []);
- assert.equal(scenario.hosts.length, 0);
- }
-});
-
-test("authentication bypass reports its specific safe fallback without mounting the host", async () => {
- const scenario = setup({runtime: async () => ({code: -1, msg: "mapAuthenticationBypass", data: null})});
- await scenario.render();
- assert.equal(scenario.status(), "mapAuthenticationBypass");
- assert.equal(scenario.hosts.length, 0);
-});
diff --git a/app/src/protyle/render/av/map/render.ts b/app/src/protyle/render/av/map/render.ts
deleted file mode 100644
index 427d860223..0000000000
--- a/app/src/protyle/render/av/map/render.ts
+++ /dev/null
@@ -1,273 +0,0 @@
-import {escapeAttr, escapeHtml} from "../../../../util/escape";
-import {fetchSyncPost} from "../../../../util/fetch";
-import {transaction} from "../../../wysiwyg/transaction";
-import {waitForPendingTransactions} from "../../../util/transactionQueue";
-import {avRender} from "../render";
-import {getAVData} from "../virtualScroll";
-import {openMapRecord} from "./openRecord";
-import {canEditMapSettings} from "./settings";
-import {canLoadMapHost, destroyMap, getMapPoints, getMapSettings, registerMap} from "./state";
-import {createAVMapHost, isAVMapHostEnvironmentSupported} from "./host";
-import {createDesktopAVMapHost, isDesktopAVMapHostSupported} from "./desktopTransport";
-import type {AVMapHost} from "./host";
-import {AV_MAP_ATTRIBUTION_LINKS, AV_MAP_MAX_POINTS} from "./protocol";
-import {bindMapUnplaced} from "./unplaced";
-import {bindMapPointPicking} from "./pointPicking";
-
-const getTheme = () => document.documentElement.getAttribute("data-theme-mode") === "dark" ? "dark" : "light";
-
-const renderMapSetup = (root: HTMLElement, blockElement: HTMLElement, protyle: IProtyle,
- data: IAV, current: () => boolean) => {
- const view = data.view as IAVTable;
- const previous = {...view.map, locationKeyID: view.map?.locationKeyID || ""};
- const editable = canEditMapSettings(protyle);
- const message = previous.locationKeyID ? window.siyuan.languages.mapMissingLocationField :
- window.siyuan.languages.mapSelectLocationField;
- root.querySelector(".av__map-status").innerHTML = `<div class="av__map-empty">
- <svg aria-hidden="true"><use xlink:href="#iconMap"></use></svg><p>${escapeHtml(message)}</p>
- ${editable ? `<div class="av__map-setup"><label class="av__map-setting"><span>${escapeHtml(window.siyuan.languages.mapLocationField)}</span>
- <select class="b3-select" data-map-location-field aria-label="${escapeAttr(window.siyuan.languages.mapLocationField)}">
- <option value="">${escapeHtml(window.siyuan.languages.mapSelectLocationField)}</option>
- ${view.columns.filter(column => column.type === "location").map(column =>
- `<option value="${escapeAttr(column.id)}">${escapeHtml(column.name)}</option>`).join("")}
- </select></label></div>
- <div class="av__map-create-fields"><button class="b3-button b3-button--outline" data-map-create-field>
- ${escapeHtml(window.siyuan.languages.newCol)} ${escapeHtml(window.siyuan.languages.location)}</button></div>` : ""}
-</div>`;
- if (!editable) return;
- const select = root.querySelector<HTMLSelectElement>("[data-map-location-field]");
- const create = root.querySelector<HTMLButtonElement>("[data-map-create-field]");
- const context = {avID: data.id, blockID: blockElement.dataset.nodeId, viewID: data.viewID};
- let pending = false;
- const submit = async (locationKeyID?: string) => {
- if (pending || !current() || !canEditMapSettings(protyle)) return;
- if (locationKeyID !== undefined && (!locationKeyID ||
- !view.columns.some(column => column.id === locationKeyID && column.type === "location"))) return;
- pending = true;
- select.disabled = true;
- create.disabled = true;
- let committed = false;
- try {
- const id = locationKeyID || Lute.NewNodeID();
- const update: IOperation = {...context, action: "setAttrViewMap", data: {...previous, locationKeyID: id}};
- const undo: IOperation = {...context, action: "setAttrViewMap", data: previous};
- transaction(protyle, locationKeyID ? [update] : [
- {...context, action: "addAttrViewCol", id, type: "location", name: window.siyuan.languages.location},
- update,
- {...context, action: "setAttrViewColHidden", id, viewIDs: [data.viewID], data: true},
- ], locationKeyID ? [undo] : [undo, {...context, action: "removeAttrViewCol", id}], {
- callback: () => {
- committed = true;
- if (current()) {
- blockElement.removeAttribute("data-render");
- avRender(blockElement, protyle);
- }
- },
- });
- await waitForPendingTransactions(protyle);
- } finally {
- if (!committed && current()) {
- pending = false;
- select.value = "";
- select.disabled = !canEditMapSettings(protyle);
- create.disabled = select.disabled;
- }
- }
- };
- select.addEventListener("change", () => { void submit(select.value); });
- create.addEventListener("click", () => { void submit(); });
-};
-
-export const refreshMapReadonly = (protyle: IProtyle) => {
- protyle.wysiwyg.element.querySelectorAll<HTMLElement>('.av[data-av-type="map"]').forEach(block => {
- const data = getAVData(block);
- if (data?.viewType === "map") {
- void renderMap(block, protyle, data);
- }
- });
-};
-
-export const renderMap = async (blockElement: HTMLElement, protyle: IProtyle, data: IAV) => {
- destroyMap(blockElement);
- blockElement.querySelector(":scope > .av__container > .av__map")?.remove();
- const records = blockElement.querySelector<HTMLElement>(":scope > .av__container > .av__scroll");
- if (!records) {
- return;
- }
- const view = data.view as IAVTable;
- const settings = getMapSettings(view);
- const root = document.createElement("div");
- root.className = "av__map";
- root.dataset.mapHeight = settings.height.toString();
- root.setAttribute("contenteditable", "false");
- root.setAttribute("aria-label", window.siyuan.languages.mapView);
- const pageText = window.siyuan.languages.mapPageScope.replace("${shown}", view.rows.length.toString())
- .replace("${total}", view.rowCount.toString());
- const loadedText = window.siyuan.languages.mapLoadedCount.replace("${shown}", view.rows.length.toString())
- .replace("${total}", view.rowCount.toString());
- const hasLocationField = view.columns.some(column => column.id === settings.locationKeyID && column.type === "location");
- root.innerHTML = `<div class="av__map-toolbar">
-<div class="av__map-summary ft__smaller ft__on-surface b3-tooltips b3-tooltips__nw" aria-label="${escapeAttr(pageText)}" tabindex="0">
- <span>${escapeHtml(loadedText)}</span><span class="av__map-skipped"></span>
-</div>
-${hasLocationField && canEditMapSettings(protyle) ? `<button type="button" class="block__icon block__icon--show ariaLabel fn__none" data-map-unplaced-toggle data-position="4north" aria-label="${escapeAttr(window.siyuan.languages.mapUnplaced)}" aria-expanded="false"><svg><use xlink:href="#iconInbox"></use></svg></button>` : ""}
-</div>
-<div class="av__map-status ft__on-surface" role="status"></div>
-<div class="av__map-canvas fn__none"></div>
-`;
- records.before(root);
- ["click", "keydown", "pointerdown"].forEach(type => root.addEventListener(type, event => event.stopPropagation()));
- const status = root.querySelector<HTMLElement>(".av__map-status");
- const canvas = root.querySelector<HTMLElement>(".av__map-canvas");
- let host: AVMapHost;
- let hostMounted = false;
- let themeObserver: MutationObserver;
- let destroyUnplaced: () => void;
- let picking: ReturnType<typeof bindMapPointPicking>;
- let revision = 0;
- const offline = () => fallback(window.siyuan.languages.mapOffline);
- const releaseHost = () => {
- revision++;
- const previousHost = host;
- host = undefined;
- themeObserver?.disconnect();
- themeObserver = undefined;
- window.removeEventListener("offline", offline);
- picking?.destroy();
- picking = undefined;
- previousHost?.destroy();
- };
- const current = registerMap(blockElement, {root, remount: () => {
- const ownerElement = blockElement.closest(".protyle-wysiwyg");
- if (ownerElement !== protyle.wysiwyg.element) {
- // 跨编辑器移动后由目标事务重新读取上下文,旧请求和菜单不得沿用源笔记本。
- destroyMap(blockElement);
- root.remove();
- blockElement.removeAttribute("data-render");
- } else if (hostMounted) {
- void renderMap(blockElement, protyle, data);
- }
- }, destroy: () => {
- releaseHost();
- destroyUnplaced?.();
- destroyUnplaced = undefined;
- picking?.destroy();
- picking = undefined;
- }});
- const fallback = (message: string) => {
- if (!current()) {
- return;
- }
- releaseHost();
- status.textContent = message;
- canvas.classList.add("fn__none");
- };
- if (window.siyuan.isPublish) {
- fallback(window.siyuan.languages.mapPublicFallback);
- return;
- }
- if (protyle.options.history?.created || protyle.options.history?.snapshot) {
- fallback(window.siyuan.languages.mapUnsupportedClient);
- return;
- }
- try {
- if (!hasLocationField) {
- renderMapSetup(root, blockElement, protyle, data, current);
- return;
- }
- if (canEditMapSettings(protyle)) destroyUnplaced = bindMapUnplaced({root, blockElement, protyle, data, current});
- const {points, skipped} = getMapPoints(view);
- const skippedCount = skipped.empty + skipped.invalid + skipped.projection;
- if (skippedCount) {
- const skippedElement = root.querySelector(".av__map-skipped");
- skippedElement.textContent = window.siyuan.languages.mapSkippedCount.replace("${count}", skippedCount.toString());
- const skippedText = Object.entries(skipped).reduce((text, [key, value]) =>
- text.replace("${" + key + "}", value.toString()), window.siyuan.languages.mapSkippedLocations);
- root.querySelector(".av__map-summary").setAttribute("aria-label", `${pageText}\n${skippedText}`);
- }
- if (!canLoadMapHost(window.location.protocol)) {
- fallback(window.siyuan.languages.mapUnsupportedClient);
- return;
- }
- const desktopHost = await isDesktopAVMapHostSupported();
- const hostSupported = desktopHost || await isAVMapHostEnvironmentSupported();
- if (!current()) {
- return;
- }
- if (!hostSupported) {
- fallback(window.siyuan.languages.mapUnsupportedClient);
- return;
- }
- if (!points.length && !canEditMapSettings(protyle)) {
- fallback(window.siyuan.languages.mapNoMarkers);
- return;
- }
- if (points.length > AV_MAP_MAX_POINTS) {
- fallback(window.siyuan.languages.mapTooManyMarkers.replace("${limit}", AV_MAP_MAX_POINTS.toString()));
- return;
- }
- if (!navigator.onLine) {
- fallback(window.siyuan.languages.mapOffline);
- return;
- }
- status.textContent = window.siyuan.languages.mapLoading;
- const response = await fetchSyncPost("/api/map/getRuntime", {});
- if (!current()) {
- return;
- }
- if (response.code !== 0 || response.data?.provider !== "openfreemap") {
- fallback(response.msg === "mapAuthenticationBypass" ? window.siyuan.languages.mapAuthenticationBypass :
- window.siyuan.languages.mapLoadError);
- return;
- }
- const rowByID = new Map(view.rows.map(row => [row.id, row]));
- const pointIDs = new Set(points.map(point => point.id));
- const activeRevision = ++revision;
- picking = bindMapPointPicking({canvas, blockElement, protyle, data, current});
- canvas.classList.remove("fn__none");
- hostMounted = true;
- const nextHost = (desktopHost ? createDesktopAVMapHost : createAVMapHost)(canvas, {
- provider: "openfreemap",
- theme: getTheme(),
- title: window.siyuan.languages.mapView,
- onReady: () => {
- if (!current() || revision !== activeRevision) {
- return;
- }
- status.textContent = points.length ? "" : window.siyuan.languages.mapNoMarkers;
- },
- onAttributionClick: id => {
- if (!current() || revision !== activeRevision) return;
- // 仅可信父页面解析固定官方链接,供应商 URL 不跨越隔离边界。
- const link = AV_MAP_ATTRIBUTION_LINKS.openfreemap.find(item => item.id === id);
- if (link) window.open(link.href, "_blank", "noopener,noreferrer");
- },
- onError: () => {
- if (current() && revision === activeRevision) {
- fallback(navigator.onLine ? window.siyuan.languages.mapLoadError : window.siyuan.languages.mapOffline);
- }
- },
- onMarkerClick: (id, markerRevision) => {
- if (current() && markerRevision === activeRevision && revision === activeRevision && pointIDs.has(id)) {
- void openMapRecord(protyle, blockElement, rowByID.get(id));
- }
- },
- onPointClick: (point, pointRevision) => {
- if (current() && pointRevision === activeRevision && revision === activeRevision) {
- picking?.show(point);
- }
- },
- });
- if (!current() || revision !== activeRevision) {
- nextHost.destroy();
- return;
- }
- host = nextHost;
- host.setPoints(points, activeRevision);
- themeObserver = new MutationObserver(() => host?.setTheme(getTheme()));
- themeObserver.observe(document.documentElement, {attributes: true, attributeFilter: ["data-theme-mode"]});
- window.addEventListener("offline", offline);
- } catch (_error) {
- fallback(window.siyuan.languages.mapLoadError);
- }
-};
diff --git a/app/src/protyle/render/av/map/settings.test.ts b/app/src/protyle/render/av/map/settings.test.ts
deleted file mode 100644
index 068b453f10..0000000000
--- a/app/src/protyle/render/av/map/settings.test.ts
+++ /dev/null
@@ -1,285 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {test} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import * as escape from "../../../../util/escape";
-import * as menuGroup from "../../../../menus/menuGroup";
-import * as state from "./state";
-import {DOMElement, DOMFixture, requireFixture} from "./testDOM";
-
-const compile = (path: string) => transpileModule(readFileSync(path, "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
-}).outputText;
-const menuSource = compile("src/menus/Menu.ts");
-const settingsSource = compile("src/protyle/render/av/map/settings.ts");
-
-const data = () => ({id: "database", viewID: "map-view", view: {
- map: {locationKeyID: "missing-field"},
- columns: [{id: "location", type: "location", name: "<Location>"}, {id: "text", type: "text", name: "Text"}],
-}}) as IAV;
-
-const setup = (mobile = false) => {
- const document = new DOMFixture();
- const operations: Array<{perform: IOperation[]; undo: IOperation[]}> = [];
- const shown: DOMElement[] = [];
- const menus: Array<{items: IMenu[]; independent: boolean; position?: IPosition; element: DOMElement}> = [];
- let closed = 0;
- const context = {siyuan: {isPublish: false,
- languages: {mapLocationField: "Location", mapSelectLocationField: "Select field", mapMissingLocationField: "Missing field",
- height: "Height", small: "Small", medium: "Medium", large: "Large", extraLarge: "Extra large"},
- menus: {menu: {showSubMenu: (element: DOMElement) => shown.push(element), remove: () => { closed++; }}}}};
- const sharedMenu = {} as typeof import("../../../../menus/Menu");
- runInNewContext(menuSource, {exports: sharedMenu, document, window: context, require: requireFixture({
- "../protyle/util/compatibility": {updateHotkeyTip: (value: string) => value.replace(/⌘/g, "Ctrl+").replace(/↩/g, "Enter")},
- "../util/setPosition": {}, "../util/zIndex": {}, "./menuPosition": {}, "./menuGroup": menuGroup,
- "./sheetOpen": {}, "../protyle/util/hasClosest": {}, "../util/functions": {isMobile: () => mobile},
- "../constants": {}, "../layout/getTopBarHeight": {}, "../protyle/undo": {}, "../util/escape": escape,
- "./menuKeyboard": {}, "../plugin/EventBusCore": {}, "../mobile/util/keyboardToolbar": {},
- "../block/popoverLifecycle": {}, "../config/entryVisibility/runtime": {},
- })});
- const methods = {} as typeof import("./settings");
- runInNewContext(settingsSource, {exports: methods, document, window: context, require: requireFixture({
- "./state": state, "../../../../util/escape": escape,
- "../../../../util/functions": {isMobile: () => mobile},
- "../../../../menus/Menu": sharedMenu,
- "../../../wysiwyg/transaction": {transaction: (_protyle: IProtyle, perform: IOperation[], undo: IOperation[]) =>
- operations.push({perform, undo})},
- "../../../../plugin/Menu": {Menu: class {
- readonly entry: typeof menus[number];
- constructor(_id?: string, _close?: () => void, independent = false) {
- const element = document.createElement("div");
- document.body.append(element);
- this.entry = {items: [], independent, element};
- menus.push(this.entry);
- }
- addItem(item: IMenu) {
- this.entry.items.push(item);
- this.entry.element.append(new sharedMenu.MenuItem(item).element as unknown as DOMElement);
- }
- open(position: IPosition) { this.entry.position = position; }
- }},
- })});
- const mount = (database = data(), protyle = {options: {}} as IProtyle) => {
- const menuElement = document.createElement("div");
- menuElement.innerHTML = methods.getMapSettingsHTML(database.view as IAVTable) +
- '<button class="b3-menu__item" data-other>Other setting</button>';
- document.body.append(menuElement);
- const blockElement = document.createElement("div");
- blockElement.dataset.nodeId = "carrier";
- let updated = 0;
- methods.bindMapSettings({data: database, protyle, menuElement: menuElement as unknown as Element,
- blockElement: blockElement as unknown as Element, onChange: () => { updated++; }});
- const field = menuElement.querySelector('[data-map-setting="locationKeyID"]');
- const height = menuElement.querySelector('[data-map-setting="height"]');
- return {database, protyle, field, height, menuElement, updated: () => updated,
- heightChoices: () => height.querySelector(".b3-menu__submenu").querySelectorAll("button"),
- choices: () => field.querySelector(".b3-menu__submenu").querySelectorAll("button")};
- };
- return {methods, document, operations, shown, menus, context, mount, closed: () => closed};
-};
-
-test("map settings mount a shared submenu, preserve missing field IDs and escape field labels", () => {
- const scenario = setup();
- const database = data();
- const view = database.view as IAVTable;
- const before = JSON.stringify(view);
- const {field, choices} = scenario.mount(database);
- assert.equal(field.querySelector(".av__map-setting-value").textContent, "Missing field");
- assert.equal(choices().length, 2);
- assert.equal(choices()[0].querySelector(".b3-menu__label").textContent, "<Location>");
- assert.equal(choices()[0].querySelector("location"), null);
- assert.equal(choices()[1].querySelectorAll(".b3-menu__checked").length, 1);
- assert.equal(field.querySelectorAll("select").length, 0);
- assert.equal(JSON.stringify(view), before);
- assert.equal(scenario.operations.length, 0);
- assert.equal(scenario.menus.length, 0);
-});
-
-test("empty field labels and absent choices still produce a usable settings item", () => {
- for (const mode of ["empty-label", "no-fields"]) {
- const scenario = setup();
- const database = data();
- const view = database.view as IAVTable;
- view.map.locationKeyID = "";
- if (mode === "no-fields") view.columns = [];
- else view.columns[0].name = "";
- const {field, choices} = scenario.mount(database);
- assert.equal(field.querySelector(".av__map-setting-value").getAttribute("title"), mode === "no-fields" ? "Select field" : "");
- assert.equal(choices().length, 1);
- field.dispatch("click");
- assert.equal(scenario.shown.length, 1);
- }
-});
-
-test("field names containing shortcut symbols remain literal labels", () => {
- const scenario = setup();
- const database = data();
- const view = database.view as IAVTable;
- view.map.locationKeyID = "location";
- view.columns[0].name = "⌘Office ↩ <Location>";
- const {field, choices} = scenario.mount(database);
- assert.equal(field.querySelector(".av__map-setting-value").textContent, view.columns[0].name);
- assert.equal(field.querySelector(".av__map-setting-value").getAttribute("title"), view.columns[0].name);
- assert.equal(choices()[0].querySelector(".b3-menu__label").textContent, view.columns[0].name);
-});
-
-test("desktop hover, sibling hover, ArrowRight, ArrowLeft and Escape use the actual submenu", () => {
- const scenario = setup();
- const {field, choices, menuElement} = scenario.mount();
- const submenu = field.querySelector(".b3-menu__submenu");
- field.dispatch("mouseenter", {bubbles: false});
- assert.equal(field.classList.contains("b3-menu__item--show"), true);
- assert.equal(scenario.shown[0], submenu);
- choices()[0].dispatch("mouseover");
- assert.equal(field.classList.contains("b3-menu__item--show"), true);
- menuElement.querySelector("[data-other]").dispatch("mouseover");
- assert.equal(field.classList.contains("b3-menu__item--show"), false);
- for (const key of ["ArrowLeft", "Escape"]) {
- const right = field.dispatch("keydown", {key: "ArrowRight"});
- assert.equal(right.defaultPrevented, true);
- assert.equal(scenario.document.activeElement, choices()[0]);
- assert.equal(field.classList.contains("b3-menu__item--show"), true);
- const close = choices()[0].dispatch("keydown", {key});
- assert.equal(close.defaultPrevented, true);
- assert.equal(scenario.document.activeElement, field);
- assert.equal(field.classList.contains("b3-menu__item--show"), false);
- }
- field.dispatch("click");
- assert.equal(field.classList.contains("b3-menu__item--show"), true);
- assert.equal(scenario.menus.length, 0);
- assert.equal(scenario.operations.length, 0);
-});
-
-test("map field selection uses the shared item click and an undoable transaction", () => {
- const scenario = setup();
- const {choices, updated} = scenario.mount();
- choices()[1].dispatch("click");
- assert.equal(scenario.operations.length, 0);
- choices()[0].dispatch("click");
- assert.equal(updated(), 1);
- assert.equal(scenario.closed(), 2);
- assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0])), {
- perform: [{action: "setAttrViewMap", avID: "database", viewID: "map-view", blockID: "carrier", data: {locationKeyID: "location"}}],
- undo: [{action: "setAttrViewMap", avID: "database", viewID: "map-view", blockID: "carrier", data: {locationKeyID: "missing-field"}}],
- });
-});
-
-test("automatic defaults remain read only until selected and preserve raw-state undo", () => {
- for (const selectSecond of [false, true]) {
- const scenario = setup();
- const database = data();
- const view = database.view as IAVTable;
- view.map.locationKeyID = "";
- view.columns.push({id: "second", type: "location", name: "Second"});
- const before = JSON.stringify(view);
- const {field, choices} = scenario.mount(database);
- assert.equal(field.querySelector(".av__map-setting-value").textContent, "<Location>");
- assert.ok(choices()[0].querySelector(".b3-menu__checked"));
- assert.equal(scenario.operations.length, 0);
- assert.equal(JSON.stringify(view), before);
- choices()[selectSecond ? 1 : 0].dispatch("click");
- assert.equal(view.map.locationKeyID, selectSecond ? "second" : "location");
- assert.equal((scenario.operations[0].undo[0].data as IAVMapSettings).locationKeyID, "");
- view.map = {locationKeyID: ""};
- assert.equal(state.getMapSettings(view).locationKeyID, "location");
- }
-});
-
-test("mobile taps open an independent menu with checked choices and anchored ownership", () => {
- const scenario = setup(true);
- const {field, updated} = scenario.mount();
- field.dispatch("mouseenter", {bubbles: false});
- assert.equal(scenario.shown.length, 0);
- field.dispatch("click");
- assert.equal(scenario.menus.length, 1);
- const menu = scenario.menus[0];
- assert.equal(menu.independent, true);
- assert.equal(menu.position.target, field);
- assert.equal(menu.position.y, field.getBoundingClientRect().bottom);
- assert.equal(menu.items.filter(item => item.checked).length, 1);
- menu.element.querySelector("button").dispatch("click");
- assert.equal(updated(), 1);
- assert.equal(scenario.operations.length, 1);
-});
-
-test("readonly, both history modes and published maps cannot open field submenus", () => {
- for (const mode of ["disabled", "created", "snapshot", "published"]) {
- const scenario = setup();
- scenario.context.siyuan.isPublish = mode === "published";
- const {field, height} = scenario.mount(data(), {disabled: mode === "disabled",
- options: {history: ["created", "snapshot"].includes(mode) ? {[mode]: "version"} : undefined}} as IProtyle);
- assert.equal(field.disabled, true);
- assert.equal(height.disabled, true);
- assert.equal(height.querySelector(".b3-menu__submenu"), null);
- height.dispatch("click");
- assert.equal(field.querySelector(".b3-menu__submenu"), null);
- field.dispatch("click");
- assert.equal(scenario.operations.length, 0);
- assert.equal(scenario.shown.length, 0);
- }
-});
-
-test("map height has four checked presets, defaults without mutation, and preserves raw field selection", () => {
- for (const locationKeyID of ["", "missing-field"]) {
- const scenario = setup();
- const database = data();
- const view = database.view as IAVTable;
- view.map.locationKeyID = locationKeyID;
- const before = JSON.stringify(view);
- const {height, heightChoices, updated} = scenario.mount(database);
- assert.equal(height.querySelector(".av__map-setting-value").textContent, "Medium");
- assert.deepEqual(heightChoices().map(choice => choice.querySelector(".b3-menu__label").textContent),
- ["Small", "Medium", "Large", "Extra large"]);
- assert.ok(heightChoices()[1].querySelector(".b3-menu__checked"));
- assert.equal(JSON.stringify(view), before);
- heightChoices()[3].dispatch("click");
- assert.equal(updated(), 1);
- assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].perform[0].data)), {locationKeyID, height: 800});
- assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].undo[0].data)), {locationKeyID});
- assert.equal(view.map.locationKeyID, locationKeyID);
- }
-});
-
-test("changing location preserves height and selecting the current saved height is a no-op", () => {
- const scenario = setup();
- const database = data();
- const view = database.view as IAVTable;
- view.map.height = 640;
- const {choices, heightChoices} = scenario.mount(database);
- heightChoices()[2].dispatch("click");
- assert.equal(scenario.operations.length, 0);
- choices()[0].dispatch("click");
- assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].perform[0].data)), {locationKeyID: "location", height: 640});
- assert.deepEqual(JSON.parse(JSON.stringify(scenario.operations[0].undo[0].data)), {locationKeyID: "missing-field", height: 640});
-});
-
-test("mobile height choices use the shared independent menu and protect later readonly transitions", () => {
- const scenario = setup(true);
- const {height, protyle} = scenario.mount();
- height.dispatch("click");
- assert.equal(scenario.menus[0].independent, true);
- assert.equal(scenario.menus[0].position.target, height);
- assert.equal(scenario.menus[0].items.length, 4);
- assert.equal(scenario.menus[0].items[1].checked, true);
- protyle.disabled = true;
- scenario.menus[0].element.querySelector("button").dispatch("click");
- assert.equal(scenario.operations.length, 0);
-});
-
-test("dismissed controls and later readonly transitions cannot change fields", () => {
- for (const mobile of [false, true]) {
- for (const mode of ["dismissed", "readonly"]) {
- const scenario = setup(mobile);
- const {field, protyle, choices} = scenario.mount();
- field.dispatch("click");
- const choice = mobile ? scenario.menus[0].element.querySelector("button") : choices()[0];
- if (mode === "dismissed") field.remove();
- else protyle.disabled = true;
- field.dispatch("click");
- choice.dispatch("click");
- assert.equal(scenario.operations.length, 0);
- assert.equal(scenario.menus.length, mobile ? 1 : 0);
- }
- }
-});
diff --git a/app/src/protyle/render/av/map/settings.ts b/app/src/protyle/render/av/map/settings.ts
deleted file mode 100644
index 5e26ef7fb7..0000000000
--- a/app/src/protyle/render/av/map/settings.ts
+++ /dev/null
@@ -1,122 +0,0 @@
-import {transaction} from "../../../wysiwyg/transaction";
-import {escapeAttr, escapeHtml} from "../../../../util/escape";
-import {Menu} from "../../../../plugin/Menu";
-import {MenuItem} from "../../../../menus/Menu";
-import {isMobile} from "../../../../util/functions";
-import {AV_MAP_HEIGHTS, getMapSettings} from "./state";
-
-export const canEditMapSettings = (protyle: IProtyle) => !protyle.disabled && !window.siyuan.isPublish &&
- !protyle.options.history?.created && !protyle.options.history?.snapshot;
-
-const getChoices = (view: IAVTable) => {
- const choices = view.columns.filter(column => column.type === "location").map(column => ({value: column.id, label: column.name}));
- if (choices.length === 0) {
- choices.push({value: "", label: window.siyuan.languages.mapSelectLocationField});
- }
- const saved = getMapSettings(view).locationKeyID;
- if (saved && !choices.some(choice => choice.value === saved)) {
- choices.push({value: saved, label: window.siyuan.languages.mapMissingLocationField});
- }
- return choices;
-};
-
-type MapSetting = "locationKeyID" | "height";
-
-const getSettingChoices = (view: IAVTable, key: MapSetting): Array<{value: string | IAVMapSettings["height"]; label: string}> =>
- key === "locationKeyID" ? getChoices(view) : AV_MAP_HEIGHTS.map((value, index) => ({value,
- label: window.siyuan.languages[(["small", "medium", "large", "extraLarge"] as const)[index]]}));
-
-const getSettingLabel = (key: MapSetting) => key === "height" ? window.siyuan.languages.height : window.siyuan.languages.mapLocationField;
-
-export const getMapSettingsHTML = (view: IAVTable) => (["locationKeyID", "height"] as const).map(key => {
- const value = getMapSettings(view)[key];
- const label = getSettingChoices(view, key).find(choice => choice.value === value).label;
- return `<button class="b3-menu__item" data-map-setting="${key}">
- <span class="fn__flex-center">${getSettingLabel(key)}</span><span class="fn__flex-1"></span>
- <span class="b3-menu__accelerator fn__ellipsis av__map-setting-value" title="${escapeAttr(label)}">${escapeHtml(label)}</span>
- <svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
-</button>`;
-}).join("");
-
-export const bindMapSettings = (options: {
- protyle: IProtyle;
- blockElement: Element;
- data: IAV;
- menuElement: Element;
- onChange?: () => void;
-}) => {
- const controls = options.menuElement.querySelectorAll<HTMLButtonElement>("[data-map-setting]");
- const view = options.data.view as IAVTable;
- if (!canEditMapSettings(options.protyle)) {
- controls.forEach(control => { control.disabled = true; });
- return;
- }
- const update = (key: MapSetting, value: string | IAVMapSettings["height"]) => {
- if (!canEditMapSettings(options.protyle)) return;
- const previous: IAVMapSettings = {locationKeyID: "", ...view.map};
- if (previous[key] === value) return;
- const next: IAVMapSettings = {...previous, [key]: value};
- const operation = {action: "setAttrViewMap" as const, avID: options.data.id,
- blockID: options.blockElement.getAttribute("data-node-id"), viewID: options.data.viewID};
- transaction(options.protyle, [{...operation, data: next}], [{...operation, data: previous}]);
- view.map = next;
- options.onChange?.();
- };
- controls.forEach(control => {
- const key = control.dataset.mapSetting as MapSetting;
- const choices = getSettingChoices(view, key);
- const items: IMenu[] = choices.map(choice => ({iconHTML: "", label: escapeHtml(choice.label),
- checked: getMapSettings(view)[key] === choice.value, click: () => {
- if (item.element.isConnected) update(key, choice.value);
- }}));
- const label = choices.find(choice => choice.value === getMapSettings(view)[key]).label;
- const item = new MenuItem({iconHTML: "", label: getSettingLabel(key),
- accelerator: " ", submenu: items});
- item.element.dataset.mapSetting = key;
- const valueElement = item.element.querySelector(".b3-menu__accelerator");
- valueElement.textContent = label;
- valueElement.classList.add("fn__ellipsis", "av__map-setting-value");
- valueElement.setAttribute("title", label);
- control.replaceWith(item.element);
- const submenu = item.element.querySelector<HTMLElement>(".b3-menu__submenu");
- const show = () => {
- if (!item.element.isConnected || !canEditMapSettings(options.protyle)) return;
- item.element.classList.add("b3-menu__item--show");
- window.siyuan.menus.menu.showSubMenu(submenu);
- };
- if (!isMobile()) {
- item.element.addEventListener("mouseenter", show);
- options.menuElement.addEventListener("mouseover", event => {
- const hovered = (event.target as Element).closest(".b3-menu__item");
- if (hovered && !item.element.contains(hovered)) item.element.classList.remove("b3-menu__item--show");
- });
- item.element.addEventListener("keydown", event => {
- if (!item.element.isConnected || !canEditMapSettings(options.protyle)) return;
- if (event.key === "ArrowRight") {
- event.preventDefault();
- event.stopPropagation();
- show();
- submenu.querySelector<HTMLButtonElement>(".b3-menu__item").focus();
- } else if (event.key === "ArrowLeft" || event.key === "Escape") {
- event.preventDefault();
- event.stopPropagation();
- item.element.classList.remove("b3-menu__item--show");
- item.element.focus();
- }
- });
- }
- item.element.addEventListener("click", event => {
- event.preventDefault();
- event.stopPropagation();
- if (!item.element.isConnected || !canEditMapSettings(options.protyle)) return;
- if (isMobile()) {
- const menu = new Menu(undefined, undefined, true);
- items.forEach(choice => menu.addItem(choice));
- const rect = item.element.getBoundingClientRect();
- menu.open({x: rect.left, y: rect.bottom, h: rect.height, target: item.element});
- } else {
- show();
- }
- });
- });
-};
diff --git a/app/src/protyle/render/av/map/state.test.ts b/app/src/protyle/render/av/map/state.test.ts
deleted file mode 100644
index ae3f78f494..0000000000
--- a/app/src/protyle/render/av/map/state.test.ts
+++ /dev/null
@@ -1,195 +0,0 @@
-import * as assert from "node:assert/strict";
-import {test} from "node:test";
-import {canLoadMapHost, destroyMap, getMapPoints, getMapSettings, registerMap} from "./state";
-import {AV_MAP_MAX_POINTS} from "./protocol";
-import {DOMFixture} from "./testDOM";
-
-const table = (locations: IAVCellLocationValue[]) => ({
- rowCount: locations.length,
- map: {locationKeyID: "location"},
- columns: [{id: "primary", type: "block"}, {id: "location", type: "location", hidden: true}],
- rows: locations.map((location, index) => ({id: `row-${index}`, cells: [
- {value: {type: "block", block: {content: "Private title"}}},
- {value: {type: "location", keyID: "location", location}},
- ]})),
-}) as IAVTable;
-
-test("map uses hidden selected fields and copies only valid WGS84 IDs and coordinates", () => {
- const view = table([
- {latitude: 0, longitude: 0, name: "Private", originalInput: "Private source"},
- {name: "No coordinates"},
- {latitude: 91, longitude: 0},
- {latitude: 0, longitude: null},
- ]);
- const before = JSON.stringify(view);
- const result = getMapPoints(view);
- assert.deepEqual(result.points, [{id: "row-0", longitude: 0, latitude: 0}]);
- assert.deepEqual(result.skipped, {empty: 1, invalid: 2, projection: 0});
- assert.equal(JSON.stringify(view), before);
-});
-
-test("map preserves valid polar coordinates but counts unsupported projection separately", () => {
- const view = table([
- {latitude: 90, longitude: 0},
- {latitude: -90, longitude: 0},
- {latitude: 85.0511287798066, longitude: 180},
- ]);
- const original = JSON.stringify(view);
- const result = getMapPoints(view);
- assert.equal(result.skipped.projection, 2);
- assert.equal(result.skipped.invalid, 0);
- assert.equal(result.points.length, 1);
- assert.equal(JSON.stringify(view), original);
-});
-
-test("missing or changed location fields retain their saved identifiers and do not fall back", () => {
- const view = table([{latitude: 0, longitude: 0}]);
- view.map.locationKeyID = "removed";
- assert.deepEqual(getMapPoints(view), {points: [], skipped: {empty: 0, invalid: 0, projection: 0}});
- assert.equal(getMapSettings(view).locationKeyID, "removed");
- view.map.locationKeyID = "primary";
- assert.deepEqual(getMapPoints(view), {points: [], skipped: {empty: 0, invalid: 0, projection: 0}});
- assert.deepEqual(getMapSettings(view), {locationKeyID: "primary", height: 480});
- assert.deepEqual(getMapSettings({} as IAVTable), {locationKeyID: "", height: 480});
-});
-
-test("map height derives a safe default without changing stored settings", () => {
- for (const height of [undefined, null, 0, 321, "640", 320, 480, 640, 800]) {
- const view = table([]);
- Object.assign(view.map, {height});
- const before = JSON.stringify(view);
- assert.equal(getMapSettings(view).height, [320, 480, 640, 800].includes(height as number) ? height : 480);
- assert.equal(JSON.stringify(view), before);
- }
-});
-
-test("unconfigured maps derive the first location in view order without persisting it", () => {
- const view = table([{latitude: 0, longitude: 0}]);
- view.map.locationKeyID = "";
- const before = JSON.stringify(view);
- assert.equal(getMapSettings(view).locationKeyID, "location");
- assert.deepEqual(getMapPoints(view).points, [{id: "row-0", longitude: 0, latitude: 0}]);
- assert.equal(JSON.stringify(view), before);
- view.columns.unshift({id: "other", type: "location", hidden: true});
- assert.equal(getMapSettings(view).locationKeyID, "other");
- view.map.locationKeyID = "location";
- assert.equal(getMapSettings(view).locationKeyID, "location");
- delete view.map;
- assert.equal(getMapSettings(view).locationKeyID, "other");
- view.columns = [];
- assert.equal(getMapSettings(view).locationKeyID, "");
- view.columns.push({id: "added", type: "location"});
- assert.equal(getMapSettings(view).locationKeyID, "added");
-});
-
-test("map does not silently truncate the loaded page before the explicit rendering limit", () => {
- const view = table(Array.from({length: AV_MAP_MAX_POINTS + 1}, () => ({
- latitude: 0, longitude: 0,
- })));
- assert.equal(getMapPoints(view).points.length, AV_MAP_MAX_POINTS + 1);
-});
-
-test("map host requires an HTTP document protocol", () => {
- assert.equal(canLoadMapHost("https:"), true);
- assert.equal(canLoadMapHost("http:"), true);
- for (const protocol of ["file:", "data:", "siyuan:", ""]) {
- assert.equal(canLoadMapHost(protocol), false);
- }
-});
-
-test("map lifecycle is independent per editor and releases removed or replaced hosts", () => {
- const previousObserver = Object.getOwnPropertyDescriptor(globalThis, "MutationObserver");
- const previousDocument = Object.getOwnPropertyDescriptor(globalThis, "document");
- let removal: (records: MutationRecord[]) => void;
- let disconnected = 0;
- Object.assign(globalThis, {document: {body: {}}, MutationObserver: class {
- constructor(callback: typeof removal) { removal = callback; }
- observe() {}
- disconnect() { disconnected++; }
- }});
- const rootA = {isConnected: true} as HTMLElement;
- const rootB = {isConnected: true} as HTMLElement;
- const blockA = {isConnected: true, contains: (root: HTMLElement) => root === rootA} as HTMLElement;
- const blockB = {isConnected: true, contains: (root: HTMLElement) => root === rootB} as HTMLElement;
- let disposedA = 0;
- let disposedB = 0;
- try {
- const first = registerMap(blockA, {root: rootA, destroy: () => disposedA++});
- const second = registerMap(blockB, {root: rootB, destroy: () => disposedB++});
- assert.equal(first(), true);
- assert.equal(second(), true);
- const replacement = registerMap(blockA, {root: rootA, destroy: () => disposedA++});
- assert.equal(disposedA, 1);
- assert.equal(first(), false);
- assert.equal(replacement(), true);
- Object.assign(rootA, {isConnected: false});
- removal([]);
- assert.equal(disposedA, 2);
- assert.equal(second(), true);
- assert.equal(disposedB, 0);
- destroyMap(blockB);
- assert.equal(disposedB, 1);
- assert.equal(disconnected, 1);
- } finally {
- destroyMap(blockA);
- destroyMap(blockB);
- if (previousObserver) Object.defineProperty(globalThis, "MutationObserver", previousObserver);
- else Reflect.deleteProperty(globalThis, "MutationObserver");
- if (previousDocument) Object.defineProperty(globalThis, "document", previousDocument);
- else Reflect.deleteProperty(globalThis, "document");
- }
-});
-
-test("map moves remount once per mutation batch without revisiting newly registered hosts", () => {
- const previousObserver = Object.getOwnPropertyDescriptor(globalThis, "MutationObserver");
- const previousDocument = Object.getOwnPropertyDescriptor(globalThis, "document");
- const document = new DOMFixture();
- let observe: (records: MutationRecord[]) => void;
- Object.assign(globalThis, {document, MutationObserver: class {
- constructor(callback: typeof observe) { observe = callback; }
- observe() {}
- disconnect() {}
- }});
- const parent = document.createElement("div");
- const block = document.createElement("div");
- const root = document.createElement("div");
- const mirror = document.createElement("div");
- const mirrorRoot = document.createElement("div");
- document.body.append(parent);
- parent.append(block);
- block.append(root);
- document.body.append(mirror);
- mirror.append(mirrorRoot);
- let remounts = 0;
- let destroyed = 0;
- let mirrorRemounts = 0;
- const element = block as unknown as HTMLElement;
- const register = () => registerMap(element, {root: root as unknown as HTMLElement,
- destroy: () => { destroyed++; }, remount: () => { remounts++; register(); }});
- const removed = (node: unknown) => ({removedNodes: [node]}) as unknown as MutationRecord;
- try {
- const initial = register();
- registerMap(mirror as unknown as HTMLElement, {root: mirrorRoot as unknown as HTMLElement,
- destroy() {}, remount: () => { mirrorRemounts++; }});
- observe([removed(parent), removed(block)]);
- assert.equal(remounts, 1);
- assert.equal(destroyed, 1);
- assert.equal(initial(), false);
- assert.equal(mirrorRemounts, 0);
- observe([removed(document.createElement("div"))]);
- assert.equal(remounts, 1);
- observe([removed(block)]);
- assert.equal(remounts, 2);
- block.remove();
- observe([removed(block)]);
- assert.equal(remounts, 2);
- assert.equal(destroyed, 3);
- } finally {
- destroyMap(element);
- destroyMap(mirror as unknown as HTMLElement);
- if (previousObserver) Object.defineProperty(globalThis, "MutationObserver", previousObserver);
- else Reflect.deleteProperty(globalThis, "MutationObserver");
- if (previousDocument) Object.defineProperty(globalThis, "document", previousDocument);
- else Reflect.deleteProperty(globalThis, "document");
- }
-});
diff --git a/app/src/protyle/render/av/map/state.ts b/app/src/protyle/render/av/map/state.ts
deleted file mode 100644
index 36ada026dd..0000000000
--- a/app/src/protyle/render/av/map/state.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-import {hasAVLocationCoordinates, validateAVLocation} from "../locationValue";
-import type {AVMapPoint} from "./protocol";
-import {isAVMapIdentifier, isAVMapProjectionSupported} from "./protocol";
-
-export const AV_MAP_HEIGHTS = [320, 480, 640, 800] as const;
-
-// 未配置时按视图顺序派生默认值;读取不写入配置,失效的显式绑定仍由用户修复。
-export const getMapSettings = (view: IAVTable): IAVMapSettings => ({
- locationKeyID: view.map?.locationKeyID || view.columns?.find(column => column.type === "location")?.id || "",
- height: AV_MAP_HEIGHTS.includes(view.map?.height) ? view.map.height : 480,
-});
-
-// 只使用选定字段的已加载行,WGS84 坐标不会被裁切或改写。
-export const getMapPoints = (view: IAVTable) => {
- const points: AVMapPoint[] = [];
- const skipped = {empty: 0, invalid: 0, projection: 0};
- const fieldID = getMapSettings(view).locationKeyID;
- const fieldIndex = view.columns.findIndex(column => column.id === fieldID && column.type === "location");
- if (fieldIndex < 0) {
- return {points, skipped};
- }
- const used = new Set<string>();
- view.rows.forEach(row => {
- const cell = row.cells.find(item => item.value?.keyID === fieldID) || row.cells[fieldIndex];
- const location = cell?.value?.type === "location" ? cell.value.location : undefined;
- if (!location || location.latitude == null && location.longitude == null) {
- skipped.empty++;
- } else if (!validateAVLocation(location) || !hasAVLocationCoordinates(location) || !isAVMapIdentifier(row.id) || used.has(row.id)) {
- skipped.invalid++;
- } else if (!isAVMapProjectionSupported(location.latitude)) {
- skipped.projection++;
- } else {
- used.add(row.id);
- points.push({id: row.id, longitude: location.longitude, latitude: location.latitude});
- }
- });
- return {points, skipped};
-};
-
-export const canLoadMapHost = (protocol: string) => ["http:", "https:"].includes(protocol);
-
-interface IMapLifecycle {
- root: HTMLElement;
- destroy: () => void;
- remount?: () => void;
-}
-
-const lifecycles = new WeakMap<HTMLElement, IMapLifecycle>();
-const mountedBlocks = new Set<HTMLElement>();
-let removalObserver: MutationObserver;
-
-export const destroyMap = (blockElement: HTMLElement) => {
- const state = lifecycles.get(blockElement);
- lifecycles.delete(blockElement);
- mountedBlocks.delete(blockElement);
- state?.destroy();
- if (mountedBlocks.size === 0) {
- removalObserver?.disconnect();
- removalObserver = undefined;
- }
-};
-
-export const registerMap = (blockElement: HTMLElement, state: IMapLifecycle) => {
- destroyMap(blockElement);
- lifecycles.set(blockElement, state);
- mountedBlocks.add(blockElement);
- if (!removalObserver) {
- removalObserver = new MutationObserver(records => {
- // 移动节点也会重置 iframe/webview;先快照,避免重建时修改集合导致重复遍历。
- Array.from(mountedBlocks, block => ({block, current: lifecycles.get(block)})).forEach(({block, current}) => {
- if (lifecycles.get(block) !== current) return;
- if (!block.isConnected || !current?.root.isConnected || !block.contains(current.root)) {
- destroyMap(block);
- } else if (records.some(record => Array.from(record.removedNodes).some(node =>
- node.contains(current.root)))) {
- current.remount?.();
- }
- });
- });
- removalObserver.observe(document.body, {childList: true, subtree: true});
- }
- return () => lifecycles.get(blockElement) === state && state.root.isConnected && blockElement.contains(state.root);
-};
diff --git a/app/src/protyle/render/av/map/unplaced.test.ts b/app/src/protyle/render/av/map/unplaced.test.ts
deleted file mode 100644
index 1772d53c8d..0000000000
--- a/app/src/protyle/render/av/map/unplaced.test.ts
+++ /dev/null
@@ -1,411 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {test} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import type {AVTableRow} from "../../../../types/api";
-import * as escape from "../../../../util/escape";
-import * as locationValue from "../locationValue";
-import {getMapSettings} from "./state";
-import {requireFixture} from "./testDOM";
-
-class ElementStub {
- isConnected = true;
- textContent = "";
- value = "";
- focused = false;
- ownerDocument: any;
- parentElement: ElementStub;
- readonly classes = new Set<string>();
- readonly attributes = new Map<string, string>();
- readonly events = new Map<string, (event?: any) => void>();
- readonly classList = {
- add: (...names: string[]) => names.forEach(name => this.classes.add(name)),
- remove: (...names: string[]) => names.forEach(name => this.classes.delete(name)),
- toggle: (name: string, enabled: boolean) => enabled ? this.classes.add(name) : this.classes.delete(name),
- };
- setAttribute(name: string, value: string) { this.attributes.set(name, value); }
- addEventListener(type: string, callback: (event?: any) => void) { this.events.set(type, callback); }
- removeEventListener(type: string) { this.events.delete(type); }
- remove() { this.isConnected = false; }
- focus() { this.focused = true; }
- contains(element: unknown) { return element === this; }
- getBoundingClientRect() { return {left: 476, top: 76, right: 500, bottom: 100, width: 24, height: 24}; }
-}
-
-const row = (id: string, location?: IAVCellLocationValue): AVTableRow => ({id, cells: [
- {id: `primary-${id}`, value: {id: `primary-${id}`, type: "block", isDetached: true,
- block: {content: `<Title ${id}>`}}},
- {id: `location-${id}`, value: {id: `location-${id}`, type: "location", keyID: "location", location}},
-]}) as AVTableRow;
-
-const flush = () => new Promise(resolve => setImmediate(resolve));
-
-const setup = (mobile = false) => {
- const requests: Array<{payload: any; signal: AbortSignal; resolve: (response: unknown) => void;
- reject: (reason?: unknown) => void}> = [];
- const timers = new Map<number, () => void>();
- let nextTimer = 0;
- const toggle = new ElementStub();
- toggle.classes.add("fn__none");
- const count = new ElementStub();
- const search = {textContent: " main query "};
- const input = new ElementStub();
- const canvas = new ElementStub();
- const root = {querySelector: (selector: string) => selector === ".av__map-canvas" ? canvas : toggle};
- const block = {dataset: {nodeId: "carrier", avId: "database"}, querySelector: () => search};
- const protyle = {options: {}} as IProtyle;
- const data = {id: "database", viewID: "map-view", view: {
- map: {locationKeyID: "location"}, columns: [{id: "location", type: "location"}],
- rows: [], rowCount: 1000,
- }} as IAV;
- let current = true;
- let positions = 0;
- const opens: Array<{row: IAVRow; keyID: string}> = [];
- const menus: MenuStub[] = [];
- class MenuStub {
- items: Array<{option: IMenu; element: ElementStub}> = [];
- element = Object.assign(new ElementStub(), {querySelector: () => count});
- position: IPosition;
- closed = false;
- constructor(_id?: string, private closeCB?: () => void) { menus.push(this); }
- addItem(option: IMenu) {
- const element = new ElementStub();
- Object.assign(element, {querySelector: () => input});
- option.bind?.(element as unknown as HTMLElement);
- this.items.push({option, element});
- return element;
- }
- open(position: IPosition) { this.position = position; }
- close() {
- if (this.closed) return;
- this.closed = true;
- this.items.forEach(item => item.element.remove());
- this.closeCB?.();
- }
- active() { return this.items.filter(item => item.element.isConnected); }
- click(label: string) {
- const item = this.active().find(item => item.option.label === label);
- assert.ok(item, `Missing menu item: ${label}`);
- return item.option.click?.(item.element as unknown as HTMLElement, {} as MouseEvent);
- }
- }
- const context = {siyuan: {isPublish: false, languages: new Proxy<Record<string, string>>({}, {
- get: (_target, key: string) => key,
- }), menus: {menu: {resetPosition: () => { positions++; }}}},
- setTimeout: (callback: () => void) => { timers.set(++nextTimer, callback); return nextTimer; }};
- const methods = {} as typeof import("./unplaced");
- runInNewContext(transpileModule(readFileSync("src/protyle/render/av/map/unplaced.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
- }).outputText, {exports: methods, window: context, AbortController,
- clearTimeout: (id: number) => timers.delete(id), require: requireFixture({
- "../../../../constants": {Constants: {TIMEOUT_INPUT: 256, ATTRIBUTE_MENU_KEYMAP: "data-keymap"}},
- "../../../../plugin/Menu": {Menu: MenuStub},
- "../../../../util/escape": escape,
- "../../../../util/functions": {isMobile: () => mobile},
- "../../../../util/fetch": {fetchSyncPost: (url: string, payload: unknown, _cb: unknown, _message: unknown,
- signal: AbortSignal) => {
- assert.equal(url, "/api/av/getAttributeViewMapUnplaced");
- return new Promise((resolve, reject) => requests.push({payload, signal, resolve, reject}));
- }},
- "../locationValue": locationValue,
- "./state": {getMapSettings},
- "./settings": {canEditMapSettings: () => !protyle.disabled && !context.siyuan.isPublish &&
- !protyle.options.history?.created && !protyle.options.history?.snapshot},
- "./openRecord": {openMapRecord: (_protyle: IProtyle, _block: HTMLElement, row: IAVRow, keyID: string) =>
- opens.push({row, keyID})},
- })});
- const destroy = methods.bindMapUnplaced({root: root as unknown as HTMLElement, blockElement: block as unknown as HTMLElement,
- protyle, data, current: () => current});
- return {methods, requests, menus, toggle, count, input, canvas, data, protyle, context, opens, destroy, block, search,
- positions: () => positions,
- stale: () => { current = false; },
- click: () => toggle.events.get("click")({preventDefault() {}}),
- inputSearch: (value: string, composing = false) => {
- input.value = value;
- input.events.get("input")({isComposing: composing, stopPropagation() {}});
- },
- enter: (label: string) => {
- const menu = menus[menus.length - 1];
- const item = menu.active().find(item => item.option.label === label);
- assert.ok(item, `Missing keyboard menu item: ${label}`);
- Object.assign(item.element, {querySelector: () => null,
- dispatchEvent: () => item.option.click?.(item.element as unknown as HTMLElement, {} as MouseEvent)});
- Object.assign(context.siyuan.menus.menu, {element: {
- classList: {contains: () => false}, querySelector: () => item.element,
- contains: (target: ElementStub) => target === item.element && target.isConnected,
- }, remove: () => menu.close()});
- const nativeMenu = {} as typeof import("../../../../menus/Menu");
- runInNewContext(transpileModule(readFileSync("src/menus/Menu.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
- }).outputText, {exports: nativeMenu, window: context, CustomEvent: class {}, require: requireFixture({
- "../constants": {Constants: {KEYCODELIST: {13: "↩"}}},
- "../protyle/util/compatibility": {getEventName: () => "click"},
- "../util/setPosition": {}, "../util/zIndex": {}, "./menuPosition": {}, "./menuGroup": {},
- "./sheetOpen": {}, "../protyle/util/hasClosest": {}, "../util/functions": {},
- "../layout/getTopBarHeight": {}, "../protyle/undo": {}, "../util/escape": {},
- "./menuKeyboard": {}, "../plugin/EventBusCore": {}, "../mobile/util/keyboardToolbar": {},
- "../block/popoverLifecycle": {}, "../config/entryVisibility/runtime": {},
- })});
- assert.equal(nativeMenu.bindMenuKeydown({keyCode: 13, target: item.element} as unknown as KeyboardEvent), true);
- },
- runTimers: () => { const pending = [...timers.values()]; timers.clear(); pending.forEach(callback => callback()); },
- respond: async (index: number, rows: AVTableRow[] = [], total = rows.length) => {
- requests[index].resolve({code: 0, data: {rows, total}});
- await flush();
- }};
-};
-
-test("map unplaced response accepts absent coordinates and names but excludes invalid or already placed values", () => {
- const scenario = setup();
- for (const location of [undefined, {}, {name: "Place"}, {latitude: null, longitude: null}]) {
- const result = scenario.methods.toMapUnplacedRow(row("entry", location), "location");
- assert.equal(result.id, "entry");
- assert.equal(result.cells[1].value.keyID, "location");
- assert.equal(result.cells[0].value.block.content, "<Title entry>");
- }
- for (const location of [{latitude: 0}, {latitude: 0, longitude: 0}, {latitude: 90, longitude: 0},
- {latitude: 91, longitude: 0}, {name: 42}, {unknown: true}, {latitude: "", longitude: ""}]) {
- assert.equal(scenario.methods.toMapUnplacedRow(row("entry", location as IAVCellLocationValue), "location"), undefined);
- }
- assert.equal(scenario.methods.toMapUnplacedRow(row("entry"), "other-field"), undefined);
- assert.equal(scenario.methods.toMapUnplacedRow({id: "entry", cells: []}, "location"), undefined);
- scenario.destroy();
-});
-
-test("map unplaced uses current view query and a count request before independent explicit pagination", async () => {
- const scenario = setup();
- assert.equal(scenario.requests.length, 1);
- assert.equal(JSON.stringify(scenario.requests[0].payload), JSON.stringify({id: "database", blockID: "carrier",
- viewID: "map-view", query: "main query", search: "", page: 1, pageSize: 1}));
- await scenario.respond(0, [row("not-loaded")], 51);
- assert.equal(scenario.toggle.classes.has("fn__none"), false);
- scenario.click();
- assert.equal(scenario.requests.length, 2);
- assert.equal(scenario.requests[1].payload.pageSize, 50);
- await scenario.respond(1, [row("not-loaded")], 51);
- assert.equal(scenario.requests.length, 2, "remaining pages require an explicit click");
- assert.equal(scenario.count.textContent, "51");
- const menu = scenario.menus[0];
- assert.equal(menu.position.isLeft, true);
- assert.equal(scenario.input.focused, true);
- const more = menu.active().find(item => item.option.label === "loadMore");
- scenario.enter("loadMore");
- assert.equal(more.element.isConnected, false, "keyboard activation must detach the item before the menu checks whether to close");
- assert.equal(menu.closed, false);
- more.option.click(more.element as unknown as HTMLElement, {} as MouseEvent);
- assert.equal(scenario.requests.length, 3, "a pending page cannot be requested twice");
- assert.equal(scenario.requests[2].payload.page, 2);
- await scenario.respond(2, [row("next-page")], 51);
- assert.equal(menu.active().some(item => item.option.label === "loadMore"), false);
- menu.click("&lt;Title next-page>");
- assert.equal(scenario.opens[0].row.id, "next-page");
- assert.equal(scenario.opens[0].keyID, undefined);
- assert.equal((scenario.data.view as IAVTable).rows.length, 0, "unplaced paging must not mutate map rows");
- scenario.destroy();
-});
-
-test("map unplaced count hides only known empty results and exposes a retry path after count failure", async () => {
- const empty = setup();
- await empty.respond(0);
- assert.equal(empty.toggle.classes.has("fn__none"), true);
- empty.destroy();
- const failed = setup();
- failed.requests[0].reject(new Error("offline"));
- await flush();
- assert.equal(failed.toggle.classes.has("fn__none"), false);
- failed.click();
- failed.requests[1].reject(new Error("offline"));
- await flush();
- assert.equal(failed.menus[0].active().some(item => item.option.label === "empty"), false);
- assert.equal(failed.count.classes.has("fn__none"), true);
- failed.menus[0].click("retry");
- assert.equal(failed.requests[2].payload.page, 1);
- await failed.respond(2, [row("recovered")]);
- assert.equal(failed.menus[0].active().some(item => item.option.label === "retry"), false);
- failed.destroy();
-});
-
-test("map unplaced search aborts obsolete requests and resets its own page without changing the view query", async () => {
- const scenario = setup();
- scenario.click();
- scenario.inputSearch(" new term ");
- assert.equal(scenario.requests[1].signal.aborted, true);
- scenario.runTimers();
- const request = scenario.requests[2];
- assert.equal(request.payload.search, "new term");
- assert.equal(request.payload.query, "main query");
- assert.equal(request.payload.page, 1);
- await scenario.respond(2, [row("searched")]);
- await scenario.respond(1, [row("obsolete")]);
- assert.equal(scenario.menus[0].active().some(item => item.option.label === "&lt;Title obsolete>"), false);
- assert.equal(scenario.menus[0].active().some(item => item.option.label === "&lt;Title searched>"), true);
- scenario.inputSearch("composing", true);
- scenario.runTimers();
- assert.equal(scenario.requests.length, 3);
- scenario.input.events.get("compositionend")();
- scenario.runTimers();
- assert.equal(scenario.requests[3].payload.search, "composing");
- scenario.destroy();
-});
-
-test("shared unplaced search aborts immediately and rejects ABA responses and detached row actions", async () => {
- const scenario = setup();
- scenario.click();
- await scenario.respond(1, [row("original")]);
- const original = scenario.menus[0].active().find(item => item.option.label === "&lt;Title original>");
- scenario.inputSearch("same");
- original.option.click(original.element as unknown as HTMLElement, {} as MouseEvent);
- assert.equal(scenario.opens.length, 0, "typing detaches old records before the debounce completes");
- scenario.runTimers();
- const first = scenario.requests.length - 1;
- scenario.inputSearch("other");
- assert.equal(scenario.requests[first].signal.aborted, true);
- scenario.runTimers();
- const second = scenario.requests.length - 1;
- scenario.inputSearch("same");
- assert.equal(scenario.requests[second].signal.aborted, true);
- scenario.runTimers();
- const last = scenario.requests.length - 1;
- assert.equal(scenario.requests[last].payload.search, "same");
- assert.equal(scenario.requests[last].payload.query, "main query");
- await scenario.respond(last, [row("latest")]);
- await scenario.respond(first, [row("stale-same")]);
- await scenario.respond(second, [row("stale-other")]);
- const labels = scenario.menus[0].active().map(item => item.option.label);
- assert.equal(labels.includes("&lt;Title latest>"), true);
- assert.equal(labels.includes("&lt;Title stale-same>"), false);
- assert.equal(labels.includes("&lt;Title stale-other>"), false);
- scenario.menus[0].click("&lt;Title latest>");
- assert.equal(scenario.opens[0].row.id, "latest");
- scenario.destroy();
-});
-
-test("closing or destroying unplaced menus aborts pending work and rejects late responses", async () => {
- for (const close of ["toggle", "menu", "destroy"]) {
- const scenario = setup();
- scenario.click();
- if (close === "toggle") scenario.click();
- if (close === "menu") scenario.menus[0].close();
- if (close === "destroy") scenario.destroy();
- assert.equal(scenario.requests[1].signal.aborted, true, close);
- assert.equal(scenario.toggle.attributes.get("aria-expanded"), "false");
- const before = scenario.positions();
- await scenario.respond(1, [row("late")]);
- assert.equal(scenario.positions(), before);
- scenario.destroy();
- assert.equal(scenario.requests[0].signal.aborted, true);
- }
-});
-
-test("a failed additional page preserves records and retries that page without keyboard dismissal", async () => {
- const scenario = setup();
- scenario.click();
- await scenario.respond(1, [row("first")], 75);
- scenario.menus[0].click("loadMore");
- scenario.requests[2].reject(new Error("connection lost"));
- await flush();
- const menu = scenario.menus[0];
- assert.equal(menu.active().some(item => item.option.label === "&lt;Title first>"), true);
- assert.equal(menu.active().some(item => item.option.label === "loadMore"), false);
- const retry = menu.active().find(item => item.option.label === "retry");
- scenario.enter("retry");
- assert.equal(retry.element.isConnected, false);
- assert.equal(menu.closed, false);
- assert.equal(scenario.requests[3].payload.page, 2);
- await scenario.respond(3, [row("second")], 75);
- assert.equal(menu.active().some(item => item.option.label === "&lt;Title first>"), true);
- assert.equal(menu.active().some(item => item.option.label === "&lt;Title second>"), true);
- scenario.destroy();
-});
-
-test("reopening an inbox starts fresh and a replaced menu response cannot overwrite its rows", async () => {
- const scenario = setup();
- scenario.click();
- scenario.menus[0].close();
- scenario.click();
- assert.equal(scenario.requests[2].payload.page, 1);
- assert.equal(scenario.toggle.attributes.get("aria-expanded"), "true");
- await scenario.respond(2, [row("current")]);
- await scenario.respond(1, [row("previous")]);
- assert.equal(scenario.menus[1].active().some(item => item.option.label === "&lt;Title current>"), true);
- assert.equal(scenario.menus[1].active().some(item => item.option.label === "&lt;Title previous>"), false);
- scenario.destroy();
-});
-
-test("stale permissions, field changes and removed maps cannot open rows or revive an inbox", async () => {
- for (const mode of ["disabled", "published", "created", "snapshot", "field", "view", "database", "query", "notebook", "removed"]) {
- const scenario = setup();
- scenario.click();
- await scenario.respond(1, [row("entry")]);
- if (mode === "disabled") scenario.protyle.disabled = true;
- if (mode === "published") scenario.context.siyuan.isPublish = true;
- if (["created", "snapshot"].includes(mode)) scenario.protyle.options.history = {[mode]: "version"};
- if (mode === "field") (scenario.data.view as IAVTable).map.locationKeyID = "different";
- if (mode === "view") scenario.data.viewID = "changed";
- if (mode === "database") scenario.block.dataset.avId = "changed";
- if (mode === "query") scenario.search.textContent = "changed query";
- if (mode === "notebook") {
- scenario.protyle.notebookId = "private";
- Object.assign(scenario.context.siyuan, {notebooks: [{id: "private", encrypted: true, closed: true}]});
- }
- if (mode === "removed") scenario.stale();
- scenario.menus[0].click("&lt;Title entry>");
- assert.equal(scenario.opens.length, 0, mode);
- scenario.menus[0].close();
- scenario.click();
- assert.equal(scenario.menus.length, 1, mode);
- scenario.destroy();
- }
-});
-
-test("pending unplaced responses cannot populate a changed view or locked encrypted notebook", async () => {
- for (const mode of ["view", "notebook", "removed"]) {
- const scenario = setup();
- scenario.click();
- if (mode === "view") scenario.data.viewID = "changed";
- if (mode === "notebook") {
- scenario.protyle.notebookId = "private";
- Object.assign(scenario.context.siyuan, {notebooks: [{id: "private", encrypted: true, closed: true}]});
- }
- if (mode === "removed") scenario.stale();
- const positions = scenario.positions();
- await scenario.respond(1, [row("late")]);
- await scenario.respond(0, [row("late")]);
- assert.equal(scenario.positions(), positions, mode);
- assert.equal(scenario.menus[0].active().some(item => item.option.label === "&lt;Title late>"), false, mode);
- assert.equal(scenario.toggle.classes.has("fn__none"), true, mode);
- scenario.destroy();
- }
-});
-
-test("mobile unplaced menu uses shared menu placement without forcing a software keyboard", async () => {
- const scenario = setup(true);
- scenario.click();
- await scenario.respond(1, [row("mobile")]);
- assert.equal(scenario.menus[0].position.target, scenario.toggle);
- assert.equal(scenario.input.focused, false);
- scenario.menus[0].click("&lt;Title mobile>");
- assert.equal(scenario.opens[0].row.id, "mobile");
- scenario.destroy();
-});
-
-test("DOM inbox layout belongs to the open menu and preserves the flat search and row keyboard structure", async () => {
- for (const mobile of [false, true]) {
- const scenario = setup(mobile);
- scenario.click();
- await scenario.respond(1, [row("entry")]);
- const menu = scenario.menus[0];
- assert.ok(menu.element.classes.has("av__map-unplaced-menu"));
- const header = menu.active()[0];
- assert.equal(header.option.type, "empty");
- assert.ok(header.option.label.includes("av__map-unplaced-head"));
- assert.ok(header.option.label.includes("av__map-unplaced-search"));
- assert.ok(header.option.label.includes(mobile ? "counter--compact" : "counter--bg"));
- assert.equal(menu.active()[1].option.label, "&lt;Title entry>");
- scenario.enter("&lt;Title entry>");
- assert.equal(scenario.opens[0].row.id, "entry");
- assert.equal(menu.element.classes.has("av__map-unplaced-menu"), false);
- scenario.destroy();
- }
-});
diff --git a/app/src/protyle/render/av/map/unplaced.ts b/app/src/protyle/render/av/map/unplaced.ts
deleted file mode 100644
index 5283d2108b..0000000000
--- a/app/src/protyle/render/av/map/unplaced.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import type {AVTableRow} from "../../../../types/api";
-import {Constants} from "../../../../constants";
-import {Menu} from "../../../../plugin/Menu";
-import {escapeAttr, escapeHtml} from "../../../../util/escape";
-import {fetchSyncPost} from "../../../../util/fetch";
-import {isMobile} from "../../../../util/functions";
-import {validateAVLocation} from "../locationValue";
-import {openMapRecord} from "./openRecord";
-import {canEditMapSettings} from "./settings";
-import {getMapSettings} from "./state";
-
-const PAGE_SIZE = 50;
-
-export const toMapUnplacedRow = (source: AVTableRow, locationKeyID: string): IAVRow | undefined => {
- const primary = source.cells?.find(cell => cell?.value?.type === "block");
- const location = source.cells?.find(cell => cell?.value?.type === "location" && cell.value.keyID === locationKeyID);
- const value = location?.value?.location;
- if (!primary?.value?.block || !location?.value || !validateAVLocation(value) ||
- value?.latitude != null || value?.longitude != null) {
- return;
- }
- return {id: source.id, cells: [
- {id: primary.id, valueType: "block", value: {id: primary.value.id, type: "block", isDetached: primary.value.isDetached,
- block: {content: primary.value.block.content, id: primary.value.block.id, icon: primary.value.block.icon}}},
- {id: location.id, valueType: "location", value: {id: location.value.id, keyID: locationKeyID,
- type: "location", location: value}},
- ]};
-};
-
-export const bindMapUnplaced = (options: {
- root: HTMLElement;
- blockElement: HTMLElement;
- protyle: IProtyle;
- data: IAV;
- current: () => boolean;
-}) => {
- const {root, blockElement, protyle, data, current} = options;
- const toggle = root.querySelector<HTMLButtonElement>("[data-map-unplaced-toggle]");
- if (!toggle) return () => {};
- const locationKeyID = getMapSettings(data.view as IAVTable).locationKeyID;
- const query = blockElement.querySelector<HTMLElement>('[data-type="av-search"]')?.textContent.trim() || "";
- const context = {id: data.id, blockID: blockElement.dataset.nodeId || "", viewID: data.viewID, query};
- const view = data.view;
- let destroyed = false;
- const available = () => !destroyed && current() && canEditMapSettings(protyle) && data.view === view &&
- data.viewID === context.viewID && blockElement.dataset.avId === context.id &&
- (blockElement.querySelector<HTMLElement>('[data-type="av-search"]')?.textContent.trim() || "") === query &&
- !window.siyuan.notebooks?.some(notebook => notebook.id === protyle.notebookId && notebook.encrypted && notebook.closed) &&
- getMapSettings(data.view as IAVTable).locationKeyID === locationKeyID;
- const countRequest = new AbortController();
- let menu: Menu;
- let request: AbortController;
- let searchTimer: number;
- let search = "";
- let page = 0;
- let total = 0;
- let rows: IAVRow[] = [];
- let loading = false;
- let elements: HTMLElement[] = [];
- let count: HTMLElement;
-
- const updateCount = (value: number) => {
- toggle.classList.toggle("fn__none", value === 0);
- };
- const refreshCount = async () => {
- try {
- const response = await fetchSyncPost("/api/av/getAttributeViewMapUnplaced", {
- ...context, search: "", page: 1, pageSize: 1,
- }, undefined, false, countRequest.signal);
- if (!countRequest.signal.aborted && available() && response.code === 0 && response.data) {
- updateCount(response.data.total);
- } else if (!countRequest.signal.aborted && available()) {
- toggle.classList.remove("fn__none");
- }
- } catch {
- // 计数暂不可用时保留入口,允许用户打开列表重试。
- if (!countRequest.signal.aborted && available()) toggle.classList.remove("fn__none");
- }
- };
- const clearRows = () => {
- elements.forEach(element => element.remove());
- elements = [];
- };
- const addItem = (item: IMenu) => {
- const element = menu.addItem(item);
- if (element) {
- element.querySelector(".b3-menu__label")?.classList.add("fn__ellipsis");
- elements.push(element);
- }
- };
- const resetPosition = () => window.siyuan.menus.menu.resetPosition();
- const renderRows = (more = true) => {
- clearRows();
- count.textContent = total.toString();
- count.classList.remove("fn__none");
- rows.forEach(row => {
- const primary = row.cells[0].value;
- addItem({icon: "iconFile", label: escapeHtml(primary.block.content || window.siyuan.languages.untitled),
- click: element => {
- if (menu && element.isConnected && available()) void openMapRecord(protyle, blockElement, row);
- }});
- });
- if (!rows.length) addItem({type: "readonly", iconHTML: "", label: escapeHtml(window.siyuan.languages.empty)});
- if (more && page * PAGE_SIZE < total) {
- addItem({icon: "iconArrowDown", label: escapeHtml(window.siyuan.languages.loadMore), click: element => {
- element.remove();
- void load();
- return true;
- }});
- }
- resetPosition();
- };
- const load = async (reset = false) => {
- if (!menu || !available() || loading && !reset) return;
- request?.abort();
- const controller = new AbortController();
- request = controller;
- const searchValue = search.trim();
- const nextPage = reset ? 1 : page + 1;
- loading = true;
- if (reset) {
- rows = [];
- page = 0;
- count.classList.add("fn__none");
- clearRows();
- }
- addItem({type: "readonly", iconHTML: "", label: escapeHtml(window.siyuan.languages.loading)});
- resetPosition();
- try {
- const response = await fetchSyncPost("/api/av/getAttributeViewMapUnplaced", {
- ...context, search: searchValue, page: nextPage, pageSize: PAGE_SIZE,
- }, undefined, false, controller.signal);
- if (controller.signal.aborted || !menu || !available() || searchValue !== search.trim()) return;
- if (response.code !== 0 || !response.data) throw new Error(response.msg || "");
- const nextRows = (response.data.rows || []).filter((row): row is AVTableRow => !!row)
- .map(row => toMapUnplacedRow(row, locationKeyID)).filter((row): row is IAVRow => !!row);
- rows = reset ? nextRows : [...rows, ...nextRows];
- page = nextPage;
- total = response.data.total;
- if (!searchValue) {
- countRequest.abort();
- updateCount(total);
- }
- renderRows();
- } catch {
- if (!controller.signal.aborted && menu && available() && searchValue === search.trim()) {
- if (reset) {
- clearRows();
- count.classList.add("fn__none");
- } else {
- renderRows(false);
- }
- addItem({icon: "iconRefresh", label: escapeHtml(window.siyuan.languages.retry), click: element => {
- element.remove();
- void load(reset);
- return true;
- }});
- resetPosition();
- }
- } finally {
- if (request === controller) loading = false;
- }
- };
- toggle.addEventListener("click", event => {
- event.preventDefault();
- if (!available()) return;
- if (menu) {
- menu.close();
- return;
- }
- menu = new Menu(undefined, () => {
- clearTimeout(searchTimer);
- request?.abort();
- menu.element.classList.remove("av__map-unplaced-menu");
- menu = undefined;
- toggle.setAttribute("aria-expanded", "false");
- });
- menu.element.classList.add("av__map-unplaced-menu");
- rows = [];
- page = 0;
- total = 0;
- search = "";
- elements = [];
- let input: HTMLInputElement;
- menu.addItem({type: "empty", label: `<div class="av__map-unplaced-head"><span class="b3-menu__label">${escapeHtml(window.siyuan.languages.mapUnplaced)}</span><span class="counter ${isMobile() ? "counter--compact" : "counter--bg"} fn__none" data-map-unplaced-count></span></div>
-<div class="av__map-unplaced-search"><input type="search" ${Constants.ATTRIBUTE_MENU_KEYMAP}="true" class="b3-text-field" aria-label="${escapeAttr(window.siyuan.languages.search)}" placeholder="${escapeAttr(window.siyuan.languages.searchPlaceholder)}"></div>`,
- bind: element => { input = element.querySelector("input"); }});
- count = menu.element.querySelector<HTMLElement>("[data-map-unplaced-count]");
- const searchRows = () => {
- request?.abort();
- clearTimeout(searchTimer);
- search = input.value;
- clearRows();
- count.classList.add("fn__none");
- addItem({type: "readonly", iconHTML: "", label: escapeHtml(window.siyuan.languages.loading)});
- searchTimer = window.setTimeout(() => { void load(true); }, Constants.TIMEOUT_INPUT);
- };
- input.addEventListener("input", (inputEvent: InputEvent) => {
- inputEvent.stopPropagation();
- if (!inputEvent.isComposing) searchRows();
- });
- input.addEventListener("compositionend", searchRows);
- const rect = toggle.getBoundingClientRect();
- toggle.setAttribute("aria-expanded", "true");
- menu.open({x: rect.right, y: rect.bottom, h: rect.height, isLeft: true, target: toggle});
- void load(true);
- if (!isMobile()) input.focus();
- });
- void refreshCount();
- return () => {
- destroyed = true;
- countRequest.abort();
- request?.abort();
- clearTimeout(searchTimer);
- menu?.close();
- };
-};
diff --git a/app/src/protyle/render/av/map/wrapperEntry.test.ts b/app/src/protyle/render/av/map/wrapperEntry.test.ts
deleted file mode 100644
index 761e4e1337..0000000000
--- a/app/src/protyle/render/av/map/wrapperEntry.test.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-import * as assert from "node:assert/strict";
-import {describe, it} from "node:test";
-import {connectAVMapWrapper} from "./wrapperEntry";
-
-describe("trusted map navigation wrapper", () => {
- it("forwards only fixed bootstrap error codes and rejects array-shaped handshakes", () => {
- for (const input of ["sdkScriptLoadFailed", "sdkGlobalMissing", "https://private.invalid/?token=secret", {}]) {
- const instanceID = "a".repeat(48), nonce = "b".repeat(48), origin = "https://fixture.invalid";
- const messages: any[] = [], listeners = new Map<string, (event?: any) => void>();
- let appended = 0, removed = 0;
- const child = {style: {}, setAttribute() {}, contentWindow: {postMessage() {}}, remove() { removed++; }};
- const scope = {
- location: {hash: `#${instanceID}:${nonce}`, search: "?provider=openfreemap", protocol: "https:", origin},
- parent: {postMessage: (value: unknown) => messages.push(value)},
- document: {createElement: () => child, body: {appendChild() { appended++; }}},
- setTimeout: () => 1, clearTimeout() {},
- addEventListener: (type: string, callback: (event?: any) => void) => listeners.set(type, callback),
- removeEventListener: (type: string) => listeners.delete(type),
- };
- connectAVMapWrapper(scope as unknown as Window);
- const receive = listeners.get("message");
- const prepare = {version: 1, type: "prepare", instanceID, nonce};
- receive({source: scope.parent, origin, ports: [], data: Object.assign([], prepare)});
- assert.equal(appended, 0);
- receive({source: scope.parent, origin, ports: [], data: prepare});
- receive({source: child.contentWindow, origin: "null", ports: [], data: {...prepare, type: "hello"}});
- receive({source: child.contentWindow, origin: "null", ports: [],
- data: {...prepare, type: "bootstrapError", code: input, message: "secret"}});
- const code = typeof input === "string" && input.startsWith("sdk") ? input : "hostBootstrapFailed";
- assert.deepEqual(messages[messages.length - 1], {version: 1, type: "bootstrapError", instanceID, nonce, code});
- assert.equal(removed, 1);
- assert.equal(listeners.has("message"), false);
- }
- });
- it("authenticates both sides, preserves the opaque sandbox, and transfers only one port after bootstrap", () => {
- const instanceID = "a".repeat(48);
- const nonce = "b".repeat(48);
- const origin = "https://fixture.invalid";
- const attributes: Record<string, string> = {};
- const parentMessages: any[] = [];
- const childMessages: any[] = [];
- const listeners = new Map<string, (event?: any) => void>();
- let appended = 0;
- let removed = 0;
- const child = {src: "", style: {}, credentialless: false,
- setAttribute: (key: string, value: string) => { attributes[key] = value; },
- contentWindow: {postMessage: (...args: any[]) => childMessages.push(args)}, remove() { removed++; }};
- const scope = {
- location: {hash: `#${instanceID}:${nonce}`, search: "?provider=openfreemap", protocol: "https:", origin},
- parent: {postMessage: (...args: any[]) => parentMessages.push(args)},
- document: {createElement: () => child, body: {appendChild() { appended++; }}},
- setTimeout() { return 1; }, clearTimeout() {},
- addEventListener: (type: string, callback: (event?: any) => void) => listeners.set(type, callback),
- removeEventListener: (type: string) => listeners.delete(type),
- };
- connectAVMapWrapper(scope as unknown as Window);
- const onMessage = listeners.get("message");
- assert.equal(parentMessages[0][0].type, "wrapperHello");
- const fromParent = {source: scope.parent, origin, ports: [] as unknown[],
- data: {version: 1, instanceID, nonce, type: "prepare", nativeBoundary: true}};
- onMessage({...fromParent, origin: "null"});
- onMessage({...fromParent, source: {}});
- onMessage({...fromParent, data: {...fromParent.data, nonce: "old"}});
- assert.equal(appended, 0);
- onMessage(fromParent);
- onMessage(fromParent);
- assert.equal(appended, 1);
- assert.equal(attributes.sandbox, "allow-scripts");
- assert.equal(child.credentialless, true);
- assert.equal(child.src, `/stage/map/index.html?provider=openfreemap#${instanceID}:${nonce}`);
- const port = {};
- const connect = {...fromParent, ports: [port], data: {...fromParent.data, type: "connect"}};
- onMessage(connect);
- assert.equal(childMessages.length, 0);
- const fromChild = {source: child.contentWindow, origin: "null", ports: [] as unknown[],
- data: {version: 1, instanceID, nonce, type: "hello"}};
- onMessage({...fromChild, origin});
- onMessage({...fromChild, source: {}});
- assert.equal(childMessages.length, 0);
- onMessage(fromChild);
- assert.deepEqual(childMessages[0][0], {version: 1, instanceID, nonce, type: "prepare", nativeBoundary: true});
- onMessage({...fromChild, data: {...fromChild.data, type: "bootstrapReady"}});
- assert.equal(parentMessages[parentMessages.length - 1][0].type, "bootstrapReady");
- onMessage(connect);
- onMessage(connect);
- assert.equal(childMessages.length, 2);
- assert.equal(childMessages[1][2][0], port);
- assert.equal(listeners.has("message"), false);
- listeners.get("pagehide")();
- assert.equal(removed, 1);
- onMessage(fromParent);
- assert.equal(appended, 1);
- });
-});
diff --git a/app/src/protyle/render/av/map/wrapperEntry.ts b/app/src/protyle/render/av/map/wrapperEntry.ts
deleted file mode 100644
index 69bd355ffd..0000000000
--- a/app/src/protyle/render/av/map/wrapperEntry.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-import {isAVMapBootstrapMessage, isAVMapLoadErrorCode, isAVMapProvider} from "./protocol";
-import {AV_MAP_BOOTSTRAP_TIMEOUT} from "./loadingBudget";
-
-// 可信 wrapper 不加载 SDK、不处理记录或凭证,只把一次业务端口交给固定 opaque 子框架。
-export const connectAVMapWrapper = (scope: Window) => {
- const [instanceID, nonce] = scope.location.hash.slice(1).split(":");
- const provider = new URLSearchParams(scope.location.search).get("provider");
- if (scope.parent === scope || !/^https?:$/.test(scope.location.protocol) ||
- !/^[a-f0-9]{48}$/.test(instanceID || "") || !/^[a-f0-9]{48}$/.test(nonce || "") || !isAVMapProvider(provider)) {
- return;
- }
- const envelope = {version: 1, instanceID, nonce};
- let child: HTMLIFrameElement;
- let nativeBoundary = false;
- let booted = false;
- let ready = false;
- let connected = false;
- let closed = false;
- const cleanup = () => {
- closed = true;
- scope.clearTimeout(timer);
- scope.removeEventListener("message", onMessage);
- child?.remove();
- };
- const onMessage = (event: MessageEvent) => {
- if (closed) {
- return;
- }
- if (event.source === scope.parent && event.origin === scope.location.origin) {
- if (!child && event.ports.length === 0 && isAVMapBootstrapMessage(event.data, "prepare", instanceID, nonce)) {
- nativeBoundary = event.data.nativeBoundary === true;
- child = scope.document.createElement("iframe");
- child.setAttribute("sandbox", "allow-scripts");
- child.setAttribute("allow", "geolocation 'none'; camera 'none'; microphone 'none'; clipboard-read 'none'; clipboard-write 'none'");
- if ("credentialless" in child) {
- (child as HTMLIFrameElement & {credentialless: boolean}).credentialless = true;
- }
- child.referrerPolicy = "strict-origin-when-cross-origin";
- child.style.cssText = "width:100%;height:100%;border:0;display:block";
- child.src = `/stage/map/index.html?provider=${provider}#${instanceID}:${nonce}`;
- scope.document.body.appendChild(child);
- } else if (ready && !connected && event.ports.length === 1 &&
- isAVMapBootstrapMessage(event.data, "connect", instanceID, nonce)) {
- connected = true;
- child.contentWindow.postMessage({...envelope, type: "connect"}, "*", [event.ports[0]]);
- scope.removeEventListener("message", onMessage);
- scope.clearTimeout(timer);
- }
- return;
- }
- if (!child || event.source !== child.contentWindow || event.origin !== "null" || event.ports.length !== 0) {
- return;
- }
- if (!booted && isAVMapBootstrapMessage(event.data, "hello", instanceID, nonce)) {
- booted = true;
- child.contentWindow.postMessage({...envelope, type: "prepare", nativeBoundary}, "*");
- } else if (booted && !ready && isAVMapBootstrapMessage(event.data, "bootstrapReady", instanceID, nonce)) {
- ready = true;
- scope.parent.postMessage({...envelope, type: "bootstrapReady"}, scope.location.origin);
- } else if (booted && isAVMapBootstrapMessage(event.data, "bootstrapError", instanceID, nonce)) {
- const code = isAVMapLoadErrorCode(event.data.code) ? event.data.code : "hostBootstrapFailed";
- scope.parent.postMessage({...envelope, type: "bootstrapError", code}, scope.location.origin);
- cleanup();
- }
- };
- const timer = scope.setTimeout(cleanup, AV_MAP_BOOTSTRAP_TIMEOUT);
- scope.addEventListener("message", onMessage);
- scope.addEventListener("pagehide", cleanup, {once: true});
- scope.parent.postMessage({...envelope, type: "wrapperHello"}, scope.location.origin);
-};
-
-if (typeof window !== "undefined") {
- connectAVMapWrapper(window);
-}
diff --git a/app/src/protyle/render/av/newItemTemplate.ts b/app/src/protyle/render/av/newItemTemplate.ts
index 773209e586..c503c1bf1a 100644
--- a/app/src/protyle/render/av/newItemTemplate.ts
+++ b/app/src/protyle/render/av/newItemTemplate.ts
@@ -665,7 +665,7 @@ export const createAttributeViewItem = (options: {
}
options.blockElement.removeAttribute("data-render");
avRender(options.blockElement, options.protyle);
- if (["calendar", "map"].includes(options.blockElement.dataset.avType) && response.code === 0 &&
+ if (options.blockElement.dataset.avType === "calendar" && response.code === 0 &&
response.data && "itemID" in response.data) {
void openDatabaseRowByData(options.protyle, {
avID: options.blockElement.dataset.avId, databaseBlockID: options.blockElement.dataset.nodeId,
diff --git a/app/src/protyle/render/av/refreshView.test.ts b/app/src/protyle/render/av/refreshView.test.ts
index 1536adedbc..2ad842829c 100644
--- a/app/src/protyle/render/av/refreshView.test.ts
+++ b/app/src/protyle/render/av/refreshView.test.ts
@@ -3,18 +3,18 @@ import {readFileSync} from "node:fs";
import {test} from "node:test";
import {runInNewContext} from "node:vm";
import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import {DOMFixture} from "./map/testDOM";
+import {DOMFixture} from "./testDOM";
const compiled = transpileModule(readFileSync("src/protyle/render/av/render.ts", "utf8"), {
compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2021},
}).outputText;
-test("switching one database carrier refreshes only its copies and preserves other map hosts", () => {
+test("switching one database carrier refreshes only its copies and preserves other carriers", () => {
const document = new DOMFixture();
const root = document.createElement("div");
document.body.append(root);
root.innerHTML = ["carrier", "mirror", "carrier"].map(id =>
- `<div class="av" data-av-id="database" data-node-id="${id}" data-render="true"><div class="av__header" data-view-pages="pages"></div><div class="av__body" data-page-size="100"></div><div class="av__map"></div></div>`).join("");
+ `<div class="av" data-av-id="database" data-node-id="${id}" data-render="true"><div class="av__header" data-view-pages="pages"></div><div class="av__body" data-page-size="100"></div></div>`).join("");
const blocks = root.children;
const rendered: unknown[] = [];
const exports: any = {};
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 68499755ba..da10e98824 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -1,7 +1,5 @@
import {isAVSelectType} from "./capabilities";
import {renderCalendar} from "./calendar/render";
-import {renderMap} from "./map/render";
-import {destroyMap} from "./map/state";
import {isFoldedRenderContent} from "../foldedContent";
import {getCalendarRequestRange} from "./calendar/state";
import {isTableLikeView} from "./viewType";
@@ -208,7 +206,7 @@ export const genTabHeaderHTML = (data: IAV, showSearch: boolean, editable: boole
const getTableHTMLs = (data: IAVTable, e: HTMLElement, virtualData: IAVVirtualData,
reserveVirtualHeight = false) => {
- const viewType = e.dataset.avType === "list" || e.dataset.avType === "map" ? "list" : "table";
+ const viewType = e.dataset.avType === "list" ? "list" : "table";
let calcHTML = "";
let contentHTML = '<div class="av__row av__row--header"><div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div></div>';
let freezeIndex = -1;
@@ -736,7 +734,6 @@ export const avRender = async (element: Element, protyle: IProtyle, cb?: (data:
setAVVisibleViewIDs(e, getAVVisibleViewIDs(e, data.views));
}
prepareAVLocate(e, data, resetData);
- destroyMap(e);
if (data.viewType === "calendar") {
await renderCalendar(e, protyle, data, cb);
continue;
@@ -776,9 +773,6 @@ export const avRender = async (element: Element, protyle: IProtyle, cb?: (data:
blockElement: e,
resetData
});
- if (data.viewType === "map") {
- await renderMap(e, protyle, data);
- }
// 历史兼容
e.style.margin = "";
}
diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.ts
index 96fd3e8c64..042badb732 100644
--- a/app/src/protyle/render/av/row.ts
+++ b/app/src/protyle/render/av/row.ts
@@ -206,7 +206,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, options.ro
}
const tableRow = options.row as IAVRow;
const tableData = options.data as IAVTable;
- const isList = options.type === "list" || options.type === "map";
+ const isList = options.type === "list";
const pinIndex = isList ? -1 : options.pinIndex;
html = `<div class="av__row${tableRow.conditionalColors ? " av__row--conditional" : ""}" data-index="${options.rowIndex}" data-id="${tableRow.id}" style="${getConditionalItemStyle(tableRow)}">`;
@@ -425,7 +425,7 @@ export const insertAttrViewBlockAnimation = (options: {
return previousElement;
};
options.blockElement.querySelector('[data-type="av-search"]').textContent = "";
- const isList = ["list", "map"].includes(options.blockElement.getAttribute("data-av-type"));
+ const isList = options.blockElement.getAttribute("data-av-type") === "list";
const groupQuery = options.groupID ? `.av__body[data-group-id="${options.groupID}"] ` : "";
let previousElement = options.blockElement.querySelector(groupQuery + `.av__row[data-id="${options.previousId}"]`) || options.blockElement.querySelector(groupQuery + ".av__row--header");
// 有排序需要加入最后一行
diff --git a/app/src/protyle/render/av/map/testDOM.ts b/app/src/protyle/render/av/testDOM.ts
similarity index 100%
rename from app/src/protyle/render/av/map/testDOM.ts
rename to app/src/protyle/render/av/testDOM.ts
diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts
index a1bfce4c9b..bbb0cbacfc 100644
--- a/app/src/protyle/render/av/view.ts
+++ b/app/src/protyle/render/av/view.ts
@@ -320,7 +320,7 @@ export const getViewHTML = (data: IAV) => {
<span class="b3-menu__accelerator">${view.sorts.length}</span>
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
</button>
-<button class="b3-menu__item${["calendar", "map"].includes(data.viewType) ? " fn__none" : ""}" data-type="goGroups">
+<button class="b3-menu__item${data.viewType === "calendar" ? " fn__none" : ""}" data-type="goGroups">
<svg class="b3-menu__icon"><use xlink:href="#iconGroups"></use></svg>
<span class="b3-menu__label">${window.siyuan.languages.group}</span>
<span class="b3-menu__accelerator">${escapeHtml((data.view.group && data.view.group.field) ? fields.find((item: IAVColumn) => item.id === data.view.group.field)?.name || "" : "")}</span>
@@ -570,15 +570,6 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
transaction(protyle, [{...context, action: "addAttrViewView"}], [{...context, action: "removeAttrViewView"}]);
}
});
- addMenu.addItem({
- icon: "iconMap",
- label: window.siyuan.languages.mapView,
- click() {
- addVisibleView();
- const context = {avID, id, blockID: blockElement.getAttribute("data-node-id"), layout: "map"};
- transaction(protyle, [{...context, action: "addAttrViewView"}], [{...context, action: "removeAttrViewView"}]);
- }
- });
viewElement.classList.add("av__views--show");
const addRect = viewElement.querySelector('.block__icon[data-type="av-add"]')?.getBoundingClientRect();
addMenu.open({
@@ -590,8 +581,6 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
export const getViewIcon = (type: string) => {
switch (type) {
- case "map":
- return "iconMap";
case "calendar":
return "iconCalendar";
case "table":
@@ -607,8 +596,6 @@ export const getViewIcon = (type: string) => {
export const getViewName = (type: string) => {
switch (type) {
- case "map":
- return window.siyuan.languages.mapView;
case "calendar":
return window.siyuan.languages.calendarView;
case "table":
diff --git a/app/src/protyle/render/av/viewType.ts b/app/src/protyle/render/av/viewType.ts
index 67c17d20ac..0471dcf7eb 100644
--- a/app/src/protyle/render/av/viewType.ts
+++ b/app/src/protyle/render/av/viewType.ts
@@ -1,2 +1,2 @@
-// 表格、列表和地图记录列表共享行列数据及单元格交互,布局选项仍由各视图独立处理。
-export const isTableLikeView = (type: string | undefined | null) => type === "table" || type === "list" || type === "map";
+// 表格和列表共享行列数据及单元格交互,布局选项仍由各视图独立处理。
+export const isTableLikeView = (type: string | undefined | null) => type === "table" || type === "list";
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index c015b30ea0..57268e8ade 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -168,7 +168,7 @@ const insertAVPastePlaceholder = (bodyElement: HTMLElement, view: IAVTable, row:
row,
rowIndex,
pinIndex: getAVPastePinIndex(bodyElement),
- type: ["list", "map"].includes(bodyElement.closest<HTMLElement>(".av")?.dataset.avType) ? "list" : "table",
+ type: bodyElement.closest<HTMLElement>(".av")?.dataset.avType === "list" ? "list" : "table",
}));
const rowElement = bottomElement.previousElementSibling as HTMLElement;
rowElement.classList.add(PLACEHOLDER_ROW_CLASS);
@@ -213,7 +213,7 @@ const syncAVPasteRowCells = (options: {
row: options.row,
rowIndex: options.rowIndex,
pinIndex: getAVPastePinIndex(options.bodyElement),
- type: ["list", "map"].includes(options.bodyElement.closest<HTMLElement>(".av")?.dataset.avType) ? "list" : "table",
+ type: options.bodyElement.closest<HTMLElement>(".av")?.dataset.avType === "list" ? "list" : "table",
});
options.columnIDs.forEach(columnID => {
const nextCell = template.content.querySelector(`.av__cell[data-col-id="${columnID}"]`) as HTMLElement;
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 9dc6b8442d..fbd7682f1c 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -23,7 +23,6 @@ import {showMessage} from "../../dialog/message";
import {avRender} from "../render/av/render";
import {clearReadonlyAVState} from "../render/av/readonlyState";
import {refreshCalendarReadonly} from "../render/av/calendar/render";
-import {refreshMapReadonly} from "../render/av/map/render";
import {hideTooltip} from "../../dialog/tooltip";
import {stickyRow} from "../render/av/row";
import {getContenteditableElement} from "../wysiwyg/getBlock";
@@ -571,7 +570,6 @@ export const disabledProtyle = (protyle: IProtyle) => {
disabledWYSIWYG(protyle.wysiwyg.element);
if (!wasDisabled) {
refreshCalendarReadonly(protyle);
- refreshMapReadonly(protyle);
}
if (protyle.breadcrumb) {
const readonlyButton = protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"]');
@@ -642,7 +640,6 @@ export const enableProtyle = (protyle: IProtyle) => {
}
});
refreshCalendarReadonly(protyle);
- refreshMapReadonly(protyle);
}
if (protyle.breadcrumb) {
const readonlyButton = protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"]');
diff --git a/app/src/protyle/util/onGetReadonlyBars.test.ts b/app/src/protyle/util/onGetReadonlyBars.test.ts
index 8f21cffd96..2d4f709739 100644
--- a/app/src/protyle/util/onGetReadonlyBars.test.ts
+++ b/app/src/protyle/util/onGetReadonlyBars.test.ts
@@ -35,7 +35,7 @@ for (const enable of [false, true]) {
state = reduceMobileBarsState(state, {type: "set-programmatic-scrolling", active: true});
},
hideElements() {}, updateMobileTitleReadonly() {}, disabledWYSIWYG() {},
- refreshCalendarReadonly() {}, refreshMapReadonly() {}, hideTooltip() {}, isMobile: () => true,
+ refreshCalendarReadonly() {}, hideTooltip() {}, isMobile: () => true,
isIPhone: () => false, isAndroid: () => true,
});
(enable ? exports.enable : exports.disable)();
diff --git a/app/src/protyle/util/transactionContract.ts b/app/src/protyle/util/transactionContract.ts
index 92a5574289..df8b6f3e51 100644
--- a/app/src/protyle/util/transactionContract.ts
+++ b/app/src/protyle/util/transactionContract.ts
@@ -41,7 +41,6 @@ const transactionActions: Record<IOperation["action"], true> = {
"setAttrViewColIcon": true,
"setAttrViewColDesc": true,
"setAttrViewColAttributePanelVisibility": true,
- "setAttrViewMap": true,
"insertAttrViewBlock": true,
"removeAttrViewBlock": true,
"addAttrViewCol": true,
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index e408026f35..cb91df7232 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -58,7 +58,7 @@ import {
shouldReloadForHeadingBatch,
} from "./transactionUpdate";
import {getMoveAffectedEmbedElements, shouldSyncMoveCopies} from "./transactionEmbed";
-import {cloneMoveElements, getVisibleMoveElements} from "./transactionMove";
+import {getVisibleMoveElements} from "./transactionMove";
import {normalizeHTMLAssetIFrameBlockDOM} from "../../asset/html";
import {sanitizeKernelHTML} from "../../util/hostCapabilities";
import {disposeCustomBlocksInElement} from "../../plugin/customBlockRender";
@@ -385,21 +385,21 @@ const promiseTransaction = (options: {
if (operation.nextID && updateElements.length > 0) {
protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.nextID}"]`).forEach(item => {
if (!isInEmbedBlock(item) && !item.contains(range.startContainer)) {
- item.before(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ item.before(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
}
});
} else if (operation.previousID && updateElements.length > 0) {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`)).forEach(item => {
if (!isInEmbedBlock(item) && !getNextBlockSibling(item)?.contains(range.startContainer)) {
- item.after(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ item.after(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
}
});
} else if (updateElements.length > 0) {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.parentID}"]`)).forEach(item => {
if (!isInEmbedBlock(item) && !getFirstBlock(item).contains(range.startContainer)) {
- const cloneElements = cloneMoveElements(primaryMoveElements, pendingAVElements);
+ const cloneElements = primaryMoveElements.map(element => element.cloneNode(true));
// 列表特殊处理
if (item.firstElementChild?.classList.contains("protyle-action")) {
item.firstElementChild.after(...cloneElements);
@@ -617,18 +617,9 @@ const promiseTransaction = (options: {
callback: (responseTransaction: {doOperations: IOperation[]}) => {
// 新增和更新的数据库载体必须在事务成功后渲染,确保内核已登记块及其笔记本归属。
responseTransaction.doOperations.forEach(operation => {
- if (operation.action === "insert" || operation.action === "update" || operation.action === "move") {
- const ids = operation.action === "move" ? [operation.id, ...(operation.blockIDs || [])] : [operation.id];
- ids.forEach(id => {
- protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${id}"]`).forEach(item => {
- if (operation.action !== "move" || item.getAttribute("data-av-type") === "map") {
- pendingAVElements.add(item);
- } else {
- item.querySelectorAll('[data-type="NodeAttributeView"][data-av-type="map"]').forEach(map => {
- pendingAVElements.add(map);
- });
- }
- });
+ if (operation.action === "insert" || operation.action === "update") {
+ protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach(item => {
+ pendingAVElements.add(item);
});
}
});
@@ -1188,7 +1179,6 @@ export const onTransaction = (protyle: IProtyle, operations: IOperation[], isUnd
return;
}
if (operation.action === "move") {
- const pendingAVElements = new Set<Element>();
if (operation.context?.ignoreProcess === "true") {
return;
}
@@ -1264,7 +1254,7 @@ export const onTransaction = (protyle: IProtyle, operations: IOperation[], isUnd
if (operation.nextID && updateElements.length > 0) {
protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.nextID}"]`).forEach(item => {
if (!isInEmbedBlock(item)) {
- item.before(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ item.before(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
}
});
@@ -1274,13 +1264,13 @@ export const onTransaction = (protyle: IProtyle, operations: IOperation[], isUnd
// 反链面板删除超级块中的最后一个段落块后撤销重做
const blockElement = hasTopClosestByAttribute(range.startContainer, "data-node-id", null);
if (blockElement) {
- blockElement.before(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ blockElement.before(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
}
} else {
previousElement.forEach(item => {
if (!isInEmbedBlock(item)) {
- item.after(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ item.after(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
}
});
@@ -1288,19 +1278,19 @@ export const onTransaction = (protyle: IProtyle, operations: IOperation[], isUnd
} else if (updateElements.length > 0) {
const parentElement = protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.parentID}"]`);
if (!protyle.options.backlinkData && operation.parentID === protyle.block.parentID && !protyle.block.showAll) {
- protyle.wysiwyg.element.prepend(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ protyle.wysiwyg.element.prepend(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
} else if (parentElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) {
// 反链面板删除超级块中的段落块后撤销再重做 https://github.com/siyuan-note/siyuan/issues/14496#issuecomment-2771372486
const topBlockElement = hasTopClosestByAttribute(getSelection().getRangeAt(0).startContainer, "data-node-id", null);
if (topBlockElement) {
- topBlockElement.before(...cloneMoveElements(primaryMoveElements, pendingAVElements));
+ topBlockElement.before(...primaryMoveElements.map(element => element.cloneNode(true)));
hasFind = true;
}
} else {
parentElement.forEach(item => {
if (!isInEmbedBlock(item)) {
- const cloneElements = cloneMoveElements(primaryMoveElements, pendingAVElements);
+ const cloneElements = primaryMoveElements.map(element => element.cloneNode(true));
// 列表特殊处理
if (item.firstElementChild?.classList.contains("protyle-action")) {
item.firstElementChild.after(...cloneElements);
@@ -1358,9 +1348,6 @@ export const onTransaction = (protyle: IProtyle, operations: IOperation[], isUnd
// 块移出后刷新源超级块的手柄(originSb 在元素被移除前捕获,仅含移出侧的超级块)
// https://github.com/siyuan-note/siyuan/issues/9521
refreshSbs(...originSbs);
- pendingAVElements.forEach(item => {
- if (item.isConnected) void avRender(item, protyle);
- });
return;
}
if (operation.action === "insert") {
@@ -1512,7 +1499,7 @@ export const onTransaction = (protyle: IProtyle, operations: IOperation[], isUnd
"setAttrViewColRollupFilters", "sortAttrViewKey", "setAttrViewColDesc", "setAttrViewColAttributePanelVisibility",
"duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID", "setAttrViewCardCoverPosition",
"setAttrViewBlockView", "setAttrViewBlockVisibleViews", "setAttrViewContextFilter", "setAttrViewCardSize", "setAttrViewCardWidth", "setAttrViewCardAspectRatio",
- "setAttrViewConditionalColors", "setAttrViewCalendar", "setAttrViewMap", "setAttrViewCardAspectRatioValue", "setAttrViewCardLayout", "setAttrViewColFullRow", "hideAttrViewName", "setAttrViewShowIcon",
+ "setAttrViewConditionalColors", "setAttrViewCalendar", "setAttrViewCardAspectRatioValue", "setAttrViewCardLayout", "setAttrViewColFullRow", "hideAttrViewName", "setAttrViewShowIcon",
"setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup", "sortAttrViewGroup",
"foldAttrViewGroup", "foldAttrViewGroups", "hideAttrViewAllGroups", "setAttrViewFitImage", "setAttrViewDisplayFieldName", "setAttrViewDisplayEmptyFields",
"insertAttrViewBlock", "setAttrViewColDateFillSpecificTime", "setAttrViewFillColBackgroundColor", "setAttrViewUpdatedIncludeTime",
diff --git a/app/src/protyle/wysiwyg/transactionAV.test.ts b/app/src/protyle/wysiwyg/transactionAV.test.ts
index 55d5a52e37..f8ff002b44 100644
--- a/app/src/protyle/wysiwyg/transactionAV.test.ts
+++ b/app/src/protyle/wysiwyg/transactionAV.test.ts
@@ -13,8 +13,8 @@ const compiled = transpileModule(readFileSync("src/protyle/wysiwyg/transaction.t
const fixture = () => {
const rendered: Element[] = [];
const carriers = [
- {isConnected: true, closest: (): Element => null, getAttribute: (name: string) => name === "data-av-type" ? "map" : "NodeAttributeView"},
- {isConnected: true, closest: (): Element => null, getAttribute: (name: string) => name === "data-av-type" ? "map" : "NodeAttributeView"},
+ {isConnected: true, closest: (): Element => null, getAttribute: (name: string) => name === "data-av-type" ? "table" : "NodeAttributeView"},
+ {isConnected: true, closest: (): Element => null, getAttribute: (name: string) => name === "data-av-type" ? "table" : "NodeAttributeView"},
];
let finish: (success: boolean) => void;
const exports: any = {};
@@ -69,9 +69,7 @@ const fixture = () => {
const insert = () => exports.transaction(protyle, [{
action: "insert", id: "carrier", previousID: "paragraph", data: '<div data-type="NodeAttributeView"></div>',
}]);
- const move = () => exports.transaction(protyle, [{action: "move", id: "carrier", previousID: "paragraph"}], undefined,
- {skipSync: true});
- return {protyle, carriers, rendered, insert, move, finish: (success: boolean) => finish(success)};
+ return {protyle, carriers, rendered, insert, finish: (success: boolean) => finish(success)};
};
test("本地模板数据库及其副本在插入事务成功后才渲染", async () => {
@@ -94,18 +92,6 @@ test("插入事务失败时不渲染尚未保存的数据库", async () => {
assert.equal(f.rendered.length, 0);
});
-test("moved database carriers rehydrate in the destination only after a successful transaction", async () => {
- for (const success of [true, false]) {
- const f = fixture();
- f.move();
- await new Promise(resolve => setImmediate(resolve));
- assert.equal(f.rendered.length, 0);
- f.finish(success);
- await waitForPendingTransactions(f.protyle);
- assert.deepEqual(f.rendered, success ? f.carriers : []);
- }
-});
-
test("等待插入事务期间移除的数据库副本不再渲染", async () => {
const f = fixture();
f.insert();
diff --git a/app/src/protyle/wysiwyg/transactionMapMove.test.ts b/app/src/protyle/wysiwyg/transactionMapMove.test.ts
deleted file mode 100644
index 1c5c047a92..0000000000
--- a/app/src/protyle/wysiwyg/transactionMapMove.test.ts
+++ /dev/null
@@ -1,259 +0,0 @@
-import * as assert from "node:assert/strict";
-import {readFileSync} from "node:fs";
-import {test} from "node:test";
-import {runInNewContext} from "node:vm";
-import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import {DOMElement, DOMFixture} from "../render/av/map/testDOM";
-import {cloneMoveElements, getVisibleMoveElements} from "./transactionMove";
-import {getMoveAffectedEmbedElements} from "./transactionEmbed";
-
-const compiled = transpileModule(readFileSync("src/protyle/wysiwyg/transaction.ts", "utf8"), {
- compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2021},
-}).outputText;
-
-const wrappers = new WeakMap<DOMFixture, WeakMap<object, MoveElement>>();
-
-class MoveDocument extends DOMFixture {
- wrap(node: object): MoveElement {
- let elements = wrappers.get(this);
- if (!elements) {
- elements = new WeakMap();
- wrappers.set(this, elements);
- }
- if (!elements.has(node)) elements.set(node, new MoveElement(node, this));
- return elements.get(node);
- }
-
- querySelectorAll(selector: string) { return this.documentElement.querySelectorAll(selector); }
-}
-
-// 仅补齐移动回放需要的克隆、兄弟插入、模板和后代选择器,不修改共享地图 DOM 测试夹具。
-class MoveElement extends DOMElement {
- get content() {
- assert.equal(this.tagName, "TEMPLATE");
- this.node.content ||= {nodeName: "#document-fragment", attrs: [], childNodes: []};
- return this.ownerDocument.wrap(this.node.content);
- }
-
- get innerHTML(): string { return this.node.tagName === "template" ? this.content.innerHTML : super.innerHTML; }
- set innerHTML(value: string) {
- if (this.node.tagName === "template") this.content.innerHTML = value;
- else super.innerHTML = value;
- }
-
- cloneNode(deep = false) {
- const clone = this.ownerDocument.createElement(this.node.tagName);
- this.node.attrs.forEach(({name, value}: {name: string; value: string}) => clone.setAttribute(name, value));
- if (deep) clone.innerHTML = this.innerHTML;
- return clone;
- }
-
- before(...children: DOMElement[]) { children.forEach(child => super.before(child)); }
-
- replaceWith(child: DOMElement) {
- if (child.node.nodeName === "#document-fragment") {
- this.before(...child.node.childNodes.map((node: object) => this.ownerDocument.wrap(node)));
- this.remove();
- } else {
- super.replaceWith(child);
- }
- }
-
- after(...children: DOMElement[]) {
- assert.ok(this.parentElement);
- const next = this.nextElementSibling;
- children.forEach(child => next ? next.before(child) : this.parentElement.append(child));
- }
-
- prepend(...children: DOMElement[]) {
- [...children].reverse().forEach(child => this.firstElementChild ? this.firstElementChild.before(child) : this.append(child));
- }
-
- querySelectorAll(selector: string): DOMElement[] {
- if (!selector.startsWith(":scope > ") && selector.includes(" ")) {
- const parts = selector.split(" ");
- assert.equal(parts.length, 2, `Unsupported move fixture selector: ${selector}`);
- return super.querySelectorAll(parts[1]).filter(item => item.parentElement?.closest(parts[0]));
- }
- return super.querySelectorAll(selector);
- }
-}
-
-const mapHTML = (id: string, runtime = true) => `<div class="av" data-node-id="${id}" data-type="NodeAttributeView" data-av-type="map"${runtime ? ' data-render="true"' : ""}>
-<div class="av__container">${runtime ? '<div class="av__map"><webview partition="siyuan-map-old"></webview></div>' : ""}<div class="av__scroll"></div></div></div>`;
-
-const fixture = () => {
- const document = new MoveDocument();
- const rendered: Array<{element: DOMElement; protyle: IProtyle}> = [];
- const requests: Array<{id: string; notebook: string; reply: (response: unknown) => void}> = [];
- const models: Array<{editor: {protyle: IProtyle}}> = [];
- const exports: typeof import("./transaction") = {} as typeof import("./transaction");
- const dependencies = {
- cloneMoveElements,
- getVisibleMoveElements,
- getMoveAffectedEmbedElements,
- Constants: {},
- invalidateTrackedRangesByOperations() {},
- invalidateViewFoldRequests() {},
- handleViewFoldSourceOperation: () => false,
- isInEmbedBlock: () => false,
- getAllModels: () => ({editor: models}),
- normalizeHTMLAssetIFrameBlockDOM: (html: string) => html,
- refreshSbResize() {},
- applyViewFoldStates() {},
- queueHeadingNumberRefresh() {},
- refreshHeadingFoldIndicators() {},
- shouldReloadForHeadingBatch: () => false,
- avRender: (element: DOMElement, protyle: IProtyle) => {
- assert.equal(element.isConnected, true, "Hydration must follow insertion into the document");
- assert.equal(element.closest(".protyle-wysiwyg"), protyle.wysiwyg.element);
- rendered.push({element, protyle});
- },
- fetchPost: (url: string, data: {id: string; notebook: string}, reply: (response: unknown) => void) => {
- assert.equal(url, "/api/block/getBlockDOM");
- requests.push({...data, reply});
- },
- };
- runInNewContext(compiled, {
- exports, document, require: () => dependencies,
- window: {siyuan: {blockPanels: []}},
- getSelection: () => ({rangeCount: 0}),
- });
- const editor = (id: string, html: string) => {
- const element = document.createElement("div");
- element.setAttribute("data-id", id);
- const wysiwyg = document.createElement("div");
- wysiwyg.className = "protyle-wysiwyg";
- wysiwyg.innerHTML = html;
- element.append(wysiwyg);
- document.body.append(element);
- const protyle = {element, wysiwyg: {element: wysiwyg}, notebookId: "notebook-" + id,
- block: {rootID: "document-" + id, showAll: true}, options: {}} as unknown as IProtyle;
- return {protyle, root: wysiwyg};
- };
- const replay = (protyle: IProtyle, operation: Partial<IOperation>) =>
- exports.onTransaction(protyle, [{action: "move", ...operation} as IOperation], false);
- const reply = (index: number, html = mapHTML("moved", false)) => requests[index].reply({
- code: 0, data: {id: requests[index].id, dom: html},
- });
- return {document, editor, replay, rendered, requests, reply, models};
-};
-
-for (const anchor of ["nextID", "previousID", "parentID"] as const) {
- test(`move replay hydrates a cleaned root map after ${anchor} placement`, () => {
- const f = fixture();
- const {protyle, root} = f.editor("destination", '<div data-node-id="target"></div>' + mapHTML("moved") + mapHTML("untouched"));
- const original = root.querySelector('[data-node-id="moved"]');
- const originalRuntime = original.querySelector(".av__map");
- const untouched = root.querySelector('[data-node-id="untouched"]');
- f.replay(protyle, {id: "moved", [anchor]: "target"});
- const moved = root.querySelector('[data-node-id="moved"]');
- assert.notEqual(moved, original);
- assert.equal(original.isConnected, false);
- assert.equal(original.querySelector(".av__map"), originalRuntime);
- assert.equal(moved.querySelector(".av__map"), null);
- assert.equal(moved.hasAttribute("data-render"), false);
- assert.deepEqual(f.rendered, [{element: moved, protyle}]);
- assert.equal(untouched.hasAttribute("data-render"), true);
- assert.ok(untouched.querySelector(".av__map"));
- const target = root.querySelector('[data-node-id="target"]');
- if (anchor === "nextID") assert.equal(moved.nextElementSibling, target);
- if (anchor === "previousID") assert.equal(moved.previousElementSibling, target);
- if (anchor === "parentID") assert.equal(moved.parentElement, target);
- assert.equal(f.requests.length, 0);
- });
-}
-
-test("move replay rehydrates maps nested in a moved container and a moved heading group", () => {
- const f = fixture();
- const {protyle, root} = f.editor("destination", '<div data-node-id="target"></div>' +
- '<div data-node-id="heading" data-type="NodeHeading"></div>' +
- '<div data-node-id="container" data-type="NodeSuperBlock">' + mapHTML("nested") + "</div>" + mapHTML("sibling"));
- f.replay(protyle, {id: "heading", blockIDs: ["container", "sibling"], nextID: "target"});
- assert.deepEqual(root.children.map(item => item.dataset.nodeId), ["heading", "container", "sibling", "target"]);
- const nested = root.querySelector('[data-node-id="nested"]');
- const sibling = root.querySelector('[data-node-id="sibling"]');
- assert.deepEqual(f.rendered, [{element: nested, protyle}, {element: sibling, protyle}]);
- assert.equal(nested.hasAttribute("data-render"), false);
- assert.equal(sibling.hasAttribute("data-render"), false);
- assert.equal(root.querySelector("webview"), null);
-});
-
-test("replay using another editor's map copy preserves that source and hydrates the destination", () => {
- const f = fixture();
- const source = f.editor("source", mapHTML("moved"));
- const destination = f.editor("destination", '<div data-node-id="target"></div>');
- const original = source.root.firstElementChild;
- f.models.push({editor: {protyle: source.protyle}});
- f.replay(destination.protyle, {id: "moved", previousID: "target"});
- const moved = destination.root.querySelector('[data-node-id="moved"]');
- assert.ok(original.isConnected);
- assert.ok(original.querySelector("webview"));
- assert.equal(original.getAttribute("data-render"), "true");
- assert.equal(moved.querySelector("webview"), null);
- assert.deepEqual(f.rendered, [{element: moved, protyle: destination.protyle}]);
- assert.equal(f.requests.length, 0);
-});
-
-test("async fallback hydrates concurrent same-block placeholders only in their requesting editor", () => {
- const f = fixture();
- const first = f.editor("first", '<div data-node-id="target"></div>');
- const second = f.editor("second", '<div data-node-id="target"></div>');
- for (const editor of [first, second]) f.replay(editor.protyle, {id: "moved", nextID: "target"});
- const firstPlaceholder = first.root.querySelector('[data-node-id="moved"]');
- const secondPlaceholder = second.root.querySelector('[data-node-id="moved"]');
- assert.equal(firstPlaceholder.getAttribute("data-protyle-id"), "first");
- assert.equal(secondPlaceholder.getAttribute("data-protyle-id"), "second");
- assert.deepEqual(f.requests.map(request => request.notebook), ["notebook-first", "notebook-second"]);
- assert.equal(f.rendered.length, 0);
- f.reply(1);
- assert.equal(first.root.querySelector('[data-node-id="moved"]'), firstPlaceholder);
- assert.equal(secondPlaceholder.isConnected, false);
- assert.deepEqual(f.rendered, [{element: second.root.querySelector('[data-node-id="moved"]'), protyle: second.protyle}]);
- f.reply(0);
- assert.equal(firstPlaceholder.isConnected, false);
- assert.deepEqual(f.rendered.map(item => item.protyle), [second.protyle, first.protyle]);
- assert.equal(first.root.querySelector('[data-protyle-id="first"]'), null);
- assert.equal(second.root.querySelector('[data-protyle-id="second"]'), null);
-});
-
-test("fallback does not hydrate a matching owner ID after its placeholder moves to another editor", () => {
- const f = fixture();
- const first = f.editor("first", '<div data-node-id="target"></div>');
- const second = f.editor("second", "");
- f.replay(first.protyle, {id: "moved", nextID: "target"});
- const placeholder = first.root.querySelector('[data-node-id="moved"]');
- second.root.append(placeholder);
- f.reply(0);
- assert.equal(second.root.firstElementChild, placeholder);
- assert.equal(placeholder.getAttribute("data-protyle-id"), "first");
- assert.equal(f.rendered.length, 0);
-});
-
-test("fallback preserves every returned sibling and hydrates a trailing map after fragment insertion", () => {
- const f = fixture();
- const {protyle, root} = f.editor("destination", '<div data-node-id="target"></div>');
- f.replay(protyle, {id: "moved", nextID: "target"});
- f.reply(0, '<div data-node-id="moved" data-type="NodeHeading">Heading</div>\n' +
- '<div data-node-id="paragraph">Paragraph</div>\n' + mapHTML("trailing-map", false));
- assert.deepEqual(root.children.map(item => item.dataset.nodeId), ["moved", "paragraph", "trailing-map", "target"]);
- assert.deepEqual(f.rendered.map(item => item.element.dataset.nodeId), ["moved", "paragraph", "trailing-map"]);
- assert.ok(f.rendered.every(item => item.protyle === protyle));
- assert.equal(root.querySelector("template"), null);
- assert.equal(root.querySelector('[data-node-id="paragraph"]').textContent, "Paragraph");
- assert.equal(root.querySelector('[data-protyle-id="destination"]'), null);
-});
-
-test("fallback ignores removed placeholders and mismatched owner IDs in the original editor", () => {
- for (const change of ["removed", "different-owner"]) {
- const f = fixture();
- const {protyle, root} = f.editor("destination", '<div data-node-id="target"></div>');
- f.replay(protyle, {id: "moved", nextID: "target"});
- const placeholder = root.querySelector('[data-node-id="moved"]');
- if (change === "removed") placeholder.remove();
- else placeholder.setAttribute("data-protyle-id", "other");
- f.reply(0);
- assert.equal(root.querySelector(".av"), null);
- assert.equal(f.rendered.length, 0);
- }
-});
diff --git a/app/src/protyle/wysiwyg/transactionMove.test.ts b/app/src/protyle/wysiwyg/transactionMove.test.ts
index fa51ec62bb..8d71b02044 100644
--- a/app/src/protyle/wysiwyg/transactionMove.test.ts
+++ b/app/src/protyle/wysiwyg/transactionMove.test.ts
@@ -1,7 +1,6 @@
import {describe, it} from "node:test";
import * as assert from "node:assert/strict";
-import {cloneMoveElements, getVisibleMoveElements} from "./transactionMove";
-import {DOMElement, DOMFixture} from "../render/av/map/testDOM";
+import {getVisibleMoveElements} from "./transactionMove";
class TestMoveElement {
nextElementSibling?: TestMoveElement;
@@ -58,33 +57,3 @@ describe("getVisibleMoveElements", () => {
assert.deepEqual(getVisibleMoveElements(asElement(heading), []), [heading]);
});
});
-
-it("move clones rebuild only map hosts and preserve database configuration and other layouts", () => {
- const document = new DOMFixture();
- const create = (html: string) => {
- const wrapper = document.createElement("div");
- wrapper.innerHTML = html;
- return wrapper.firstElementChild;
- };
- const mapHTML = '<div data-type="NodeAttributeView" data-node-id="carrier" data-av-id="database" data-av-type="map" custom-sy-av-view="view" data-render="true"><div class="av__container"><div class="av__map"><webview partition="temporary"></webview></div><div class="av__scroll"></div></div></div>';
- const tableHTML = '<div data-type="NodeAttributeView" data-av-type="table" data-render="true"><div class="av__container">table</div></div>';
- for (const html of [mapHTML, `<div data-type="NodeSuperBlock">${mapHTML}${tableHTML}</div>`]) {
- const source = create(html);
- Object.assign(source, {cloneNode: () => create(html)});
- const pending = new Set<Element>();
- const [clone] = cloneMoveElements([source as unknown as Element], pending);
- assert.equal(pending.size, 1);
- const map = [...pending][0] as unknown as DOMElement;
- assert.equal(map.getAttribute("data-render"), null);
- assert.equal(map.querySelector(".av__map"), null);
- assert.equal(map.getAttribute("custom-sy-av-view"), "view");
- assert.equal(map.getAttribute("data-av-id"), "database");
- assert.ok(map.querySelector(".av__scroll"));
- assert.ok(source.querySelector("webview"));
- const table = clone.querySelector('[data-av-type="table"]');
- if (table) {
- assert.equal(table.getAttribute("data-render"), "true");
- assert.equal(table.textContent, "table");
- }
- }
-});
diff --git a/app/src/protyle/wysiwyg/transactionMove.ts b/app/src/protyle/wysiwyg/transactionMove.ts
index 4f9abb02f3..e3fd55d6b1 100644
--- a/app/src/protyle/wysiwyg/transactionMove.ts
+++ b/app/src/protyle/wysiwyg/transactionMove.ts
@@ -32,17 +32,3 @@ export const getVisibleMoveElements = (sourceElement: Element, blockIDs?: string
}
return elements;
};
-
-export const cloneMoveElements = (elements: Element[], pendingMapElements?: Set<Element>) =>
- elements.map(item => {
- const clone = item.cloneNode(true) as Element;
- const maps = Array.from(clone.querySelectorAll('[data-type="NodeAttributeView"][data-av-type="map"]'));
- if (clone.matches('[data-type="NodeAttributeView"][data-av-type="map"]')) maps.unshift(clone);
- maps.forEach(map => {
- // 宿主连接和临时分区不能随块 DOM 复制,插入完成后重新创建地图。
- map.querySelector(":scope > .av__container > .av__map")?.remove();
- map.removeAttribute("data-render");
- pendingMapElements?.add(map);
- });
- return clone;
- });
diff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.ts
index 82aea2a26f..8e176095fa 100644
--- a/app/src/types/api/index.d.ts
+++ b/app/src/types/api/index.d.ts
@@ -212,7 +212,7 @@ export type AIToolEffectsInput = { "dataEgress"?: boolean | null; "externalCost"
export type AIUserSkillInfo = { "description": string; "enabled": boolean; "id": string; "name": string; "shadowed": boolean; };
-export type AVArchiveRenderData = { "colorOrder": Array<string> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "list" | "gallery" | "kanban" | "calendar" | "map"; "views": Array<AVViewData | null> | null; };
+export type AVArchiveRenderData = { "colorOrder": Array<string> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "list" | "gallery" | "kanban" | "calendar"; "views": Array<AVViewData | null> | null; };
export type AVAttributeViewBacklink = { "avID": string; "avName": string; "blockIDs": Array<string> | null; "boundBlockID": string; "boxID": string; "databaseBlockID": string; "databasePath": string; "icon": string; "isDetached": boolean; "itemID": string; "relations": Array<AVAttributeViewBacklinkRelation | null> | null; "title": string; "valueID": string; };
@@ -238,7 +238,7 @@ export type AVAttributeViewCustomColorInput = { "dark"?: AVAttributeViewColorThe
export type AVAttributeViewData = { "automations"?: AVAutomationConfig; "cardCoverPositions"?: Record<string, Record<string, AVCardCoverPosition | null> | null>; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID"?: string; "id": string; "keyIDs": Array<string> | null; "keyValues": Array<AVKeyValues | null> | null; "name": string; "newItemTemplates"?: Array<AVNewItemTemplate | null>; "spec": number; "viewID": string; "views": Array<AVView | null> | null; };
-export type AVAttributeViewFieldView = { "hidden": boolean; "icon": string; "id": string; "name": string; "type": "table" | "list" | "gallery" | "kanban" | "calendar" | "map"; };
+export type AVAttributeViewFieldView = { "hidden": boolean; "icon": string; "id": string; "name": string; "type": "table" | "list" | "gallery" | "kanban" | "calendar"; };
export type AVAttributeViewGroupItemPosition = { "groupID": string; "previousID": string; };
@@ -264,7 +264,7 @@ export type AVAutomationValue = { "keyID"?: string; "mode": "static" | "source"
export type AVAutomationValueInput = { "keyID"?: string; "mode": "static" | "source" | "currentTime" | "triggerItem"; "value"?: AVValueInput | null; };
-export type AVAvSearchResult = { "avID": string; "avName": string; "blockID": string; "children"?: Array<AVAvSearchResult | null>; "hPath": string; "matched"?: boolean; "viewID": string; "viewLayout": "" | "table" | "list" | "gallery" | "kanban" | "calendar" | "map"; "viewName": string; };
+export type AVAvSearchResult = { "avID": string; "avName": string; "blockID": string; "children"?: Array<AVAvSearchResult | null>; "hPath": string; "matched"?: boolean; "viewID": string; "viewLayout": "" | "table" | "list" | "gallery" | "kanban" | "calendar"; "viewName": string; };
export type AVBlockAttributeViewKeys = { "avID": string; "avName": string; "blockIDs": Array<string> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "itemPositions": Array<AVAttributeViewItemPosition | null> | null; "keyValues": Array<AVKeyValues | null> | null; };
@@ -358,18 +358,8 @@ export type AVLayoutGallery = { "cardAspectRatio": number; "cardAspectRatioValue
export type AVLayoutKanban = { "cardAspectRatio": number; "cardAspectRatioValue": number; "cardLayout": number; "cardSize": number; "cardWidth": number; "coverFrom": number; "coverFromAssetKeyID"?: string; "displayEmptyFields": boolean; "displayFieldName": boolean; "fields": Array<AVViewKanbanField | null> | null; "fillColBackgroundColor": boolean; "filters"?: Array<AVViewFilter | null>; "fitImage": boolean; "id": string; "pageSize"?: number; "showIcon": boolean; "sorts"?: Array<AVViewSort | null>; "spec": number; "wrapField": boolean; } | ({ "cardAspectRatio": number; "cardAspectRatioValue": number; "cardLayout": number; "cardSize": number; "cardWidth": number; "coverFrom": number; "coverFromAssetKeyID"?: string; "displayEmptyFields": boolean; "displayFieldName": boolean; "fields": Array<AVViewKanbanField | null> | null; "fillColBackgroundColor": boolean; "fitImage": boolean; } & { "filters"?: never; "id"?: never; "pageSize"?: never; "showIcon"?: never; "sorts"?: never; "spec"?: never; "wrapField"?: never; });
-export type AVLayoutMap = { "columns": Array<AVViewTableColumn | null> | null; "filters"?: Array<AVViewFilter | null>; "id": string; "pageSize"?: number; "rowIds": Array<string> | null; "settings": AVMapSettings; "showIcon": boolean; "sorts"?: Array<AVViewSort | null>; "spec": number; "wrapField": boolean; } | ({ "columns": Array<AVViewTableColumn | null> | null; "rowIds": Array<string> | null; "settings": AVMapSettings; } & { "filters"?: never; "id"?: never; "pageSize"?: never; "showIcon"?: never; "sorts"?: never; "spec"?: never; "wrapField"?: never; });
-
export type AVLayoutTable = { "columns": Array<AVViewTableColumn | null> | null; "filters"?: Array<AVViewFilter | null>; "id": string; "pageSize"?: number; "rowIds": Array<string> | null; "showIcon": boolean; "sorts"?: Array<AVViewSort | null>; "spec": number; "wrapField": boolean; } | ({ "columns": Array<AVViewTableColumn | null> | null; "rowIds": Array<string> | null; } & { "filters"?: never; "id"?: never; "pageSize"?: never; "showIcon"?: never; "sorts"?: never; "spec"?: never; "wrapField"?: never; });
-export type AVMapSettings = { "height"?: 320 | 480 | 640 | 800; "locationKeyID": string; };
-
-export type AVMapSettingsInput = { "height"?: 320 | 480 | 640 | 800; "locationKeyID": string; };
-
-export type AVMapUnplacedData = { "rows": Array<AVTableRow | null> | null; "total": number; };
-
-export type AVMapUnplacedRequestInput = { "blockID"?: string | null; "id": string; "page"?: number | null; "pageSize"?: number | null; "query"?: string | null; "search"?: string | null; "viewID": string; };
-
export type AVNewItemFieldValue = { "mode": "static" | "currentTime"; "value"?: AVValue; };
export type AVNewItemFieldValueInput = { "mode"?: "static" | "currentTime"; "value"?: AVValueInput | null; };
@@ -404,7 +394,7 @@ export type AVRelativeDate = { "count": number; "direction": number; "unit": num
export type AVRelativeDateInput = { "count"?: number | null; "direction"?: number | null; "unit"?: number | null; };
-export type AVRenderData = { "colorOrder": Array<string> | null; "contextFilter": AVAttributeViewContextFilter | null; "contextFilterFields": Array<AVAttributeViewContextFilterField | null> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "target"?: AVAttributeViewRenderTarget; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "list" | "gallery" | "kanban" | "calendar" | "map"; "views": Array<AVViewData | null> | null; };
+export type AVRenderData = { "colorOrder": Array<string> | null; "contextFilter": AVAttributeViewContextFilter | null; "contextFilterFields": Array<AVAttributeViewContextFilterField | null> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "target"?: AVAttributeViewRenderTarget; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "list" | "gallery" | "kanban" | "calendar"; "views": Array<AVViewData | null> | null; };
export type AVRenderResult = (AVRenderData & { "error"?: never; }) | (AVViewNotFound & { "colorOrder"?: never; "contextFilter"?: never; "contextFilterFields"?: never; "customColors"?: never; "defaultTemplateID"?: never; "id"?: never; "isMirror"?: never; "name"?: never; "newItemTemplates"?: never; "target"?: never; "usedCustomColorIndexes"?: never; "view"?: never; "viewID"?: never; "viewType"?: never; "views"?: never; });
@@ -432,7 +422,7 @@ export type AVSelectOption = { "color": string; "desc": string; "name": string;
export type AVSelectOptionInput = { "color"?: string | null; "desc"?: string | null; "name"?: string | null; "resolvedColor"?: AVAttributeViewColorInput | null; };
-export type AVTable = { "calendar"?: AVCalendarSettings; "calendarRange"?: AVCalendarRange; "calendarTargetDate"?: number; "columns": Array<AVTableColumn | null> | null; "conditionalColors": Array<AVConditionalColorRule | null> | null; "desc": string; "filters": Array<AVViewFilter | null> | null; "group": AVViewGroup | null; "groupCalc"?: AVGroupCalc; "groupFolded": boolean; "groupHidden": number; "groupKey"?: AVKey; "groupValue"?: AVValue; "groups"?: Array<AVViewInstance>; "hideAttrViewName": boolean; "icon": string; "id": string; "map"?: AVMapSettings; "mapMarkerScope"?: "page"; "name": string; "pageSize": number; "rowCount": number; "rows": Array<AVTableRow | null> | null; "showIcon": boolean; "sorts": Array<AVViewSort | null> | null; "wrapField": boolean; } | ({ "calendar"?: AVCalendarSettings; "calendarRange"?: AVCalendarRange; "calendarTargetDate"?: number; "columns": Array<AVTableColumn | null> | null; "map"?: AVMapSettings; "mapMarkerScope"?: "page"; "rowCount": number; "rows": Array<AVTableRow | null> | null; } & { "conditionalColors"?: never; "desc"?: never; "filters"?: never; "group"?: never; "groupCalc"?: never; "groupFolded"?: never; "groupHidden"?: never; "groupKey"?: never; "groupValue"?: never; "groups"?: never; "hideAttrViewName"?: never; "icon"?: never; "id"?: never; "name"?: never; "pageSize"?: never; "showIcon"?: never; "sorts"?: never; "wrapField"?: never; });
+export type AVTable = { "calendar"?: AVCalendarSettings; "calendarRange"?: AVCalendarRange; "calendarTargetDate"?: number; "columns": Array<AVTableColumn | null> | null; "conditionalColors": Array<AVConditionalColorRule | null> | null; "desc": string; "filters": Array<AVViewFilter | null> | null; "group": AVViewGroup | null; "groupCalc"?: AVGroupCalc; "groupFolded": boolean; "groupHidden": number; "groupKey"?: AVKey; "groupValue"?: AVValue; "groups"?: Array<AVViewInstance>; "hideAttrViewName": boolean; "icon": string; "id": string; "name": string; "pageSize": number; "rowCount": number; "rows": Array<AVTableRow | null> | null; "showIcon": boolean; "sorts": Array<AVViewSort | null> | null; "wrapField": boolean; } | ({ "calendar"?: AVCalendarSettings; "calendarRange"?: AVCalendarRange; "calendarTargetDate"?: number; "columns": Array<AVTableColumn | null> | null; "rowCount": number; "rows": Array<AVTableRow | null> | null; } & { "conditionalColors"?: never; "desc"?: never; "filters"?: never; "group"?: never; "groupCalc"?: never; "groupFolded"?: never; "groupHidden"?: never; "groupKey"?: never; "groupValue"?: never; "groups"?: never; "hideAttrViewName"?: never; "icon"?: never; "id"?: never; "name"?: never; "pageSize"?: never; "showIcon"?: never; "sorts"?: never; "wrapField"?: never; });
export type AVTableCell = { "bgColor": string; "color": string; "id": string; "value": AVValue | null; "valueType": "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; } | ({ "bgColor": string; "color": string; } & { "id"?: never; "value"?: never; "valueType"?: never; });
@@ -520,9 +510,9 @@ export type AVValueUpdatedInput = { "content"?: number | null; "content2"?: numb
export type AVValuesData = { "values": Record<string, AVValue | null> | null; };
-export type AVView = { "calendar"?: AVLayoutCalendar; "conditionalColors": Array<AVConditionalColorRule | null> | null; "desc": string; "filters"?: Array<AVViewFilter | null>; "gallery"?: AVLayoutGallery; "group"?: AVViewGroup; "groupCalc"?: AVGroupCalc; "groupCreated": number; "groupFolded": boolean; "groupHidden": number; "groupItemIds": Array<string> | null; "groupKey"?: AVKey; "groupSort": number; "groupVal"?: AVValue; "groups"?: Array<AVView | null>; "hideAttrViewName": boolean; "icon": string; "id": string; "itemIds"?: Array<string>; "kanban"?: AVLayoutKanban; "list"?: AVLayoutTable; "map"?: AVLayoutMap; "name": string; "pageSize": number; "sorts"?: Array<AVViewSort | null>; "table"?: AVLayoutTable; "type": "table" | "list" | "gallery" | "kanban" | "calendar" | "map"; };
+export type AVView = { "calendar"?: AVLayoutCalendar; "conditionalColors": Array<AVConditionalColorRule | null> | null; "desc": string; "filters"?: Array<AVViewFilter | null>; "gallery"?: AVLayoutGallery; "group"?: AVViewGroup; "groupCalc"?: AVGroupCalc; "groupCreated": number; "groupFolded": boolean; "groupHidden": number; "groupItemIds": Array<string> | null; "groupKey"?: AVKey; "groupSort": number; "groupVal"?: AVValue; "groups"?: Array<AVView | null>; "hideAttrViewName": boolean; "icon": string; "id": string; "itemIds"?: Array<string>; "kanban"?: AVLayoutKanban; "list"?: AVLayoutTable; "name": string; "pageSize": number; "sorts"?: Array<AVViewSort | null>; "table"?: AVLayoutTable; "type": "table" | "list" | "gallery" | "kanban" | "calendar"; };
-export type AVViewData = { "desc": string; "hideAttrViewName": boolean; "icon": string; "id": string; "name": string; "pageSize": number; "type": "table" | "list" | "gallery" | "kanban" | "calendar" | "map"; };
+export type AVViewData = { "desc": string; "hideAttrViewName": boolean; "icon": string; "id": string; "name": string; "pageSize": number; "type": "table" | "list" | "gallery" | "kanban" | "calendar"; };
export type AVViewFilter = { "column": string; "combination"?: "and" | "or"; "dateEndpoint"?: "start" | "end"; "filters"?: Array<AVViewFilter | null>; "operator": "" | "=" | "!=" | "\u003e" | "\u003e=" | "\u003c" | "\u003c=" | "Contains" | "Does not contains" | "Contains any item" | "Does not contain any item" | "Is empty" | "Is not empty" | "Starts with" | "Ends with" | "Is between" | "Is true" | "Is false"; "quantifier"?: string; "relativeDate"?: AVRelativeDate; "relativeDate2"?: AVRelativeDate; "value": AVValue | null; "valueSource"?: "stored" | "rendered"; };
@@ -1406,8 +1396,6 @@ export type MCPOAuthStatus = { "clients": Array<MCPOAuthClient> | null; "enabled
export type MCPOAuthTokenRequestInput = { "client_id"?: string; "client_secret"?: string; "code"?: string; "code_verifier"?: string; "grant_type"?: string; "redirect_uri"?: string; "refresh_token"?: string; "resource"?: string; "scope"?: string; "token"?: string; "token_type_hint"?: string; };
-export type MapRuntime = { "provider": "openfreemap"; };
-
export type MarkdownHTMLRequestInput = { "markdown": string; "mode"?: string | null; };
export type MigrateLegacyMindmapsData = { "blocks": Array<BlockDOMData> | null; "converted": number; };
@@ -2386,9 +2374,9 @@ export type TransactionListConversionResultInput = { "focusID": string; "removed
export type TransactionNewItemTemplatesInput = { "defaultTemplateID"?: string | null; "templates"?: Array<AVNewItemTemplateInput | null> | null; };
-export type TransactionOperation = { "action": "updateAttrs"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionAttributeChangeInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "create"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "restoreCreatedDoc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeCreatedDoc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "update"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "insert"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "delete"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": BlockDeleteDataInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "move"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "swapBlockRef"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionBlockSwapInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": Array<string> | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "convertList"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionListConversionInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": TransactionListConversionResult | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "moveOutlineHeading"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "append"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "appendInsert"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "prependInsert"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "foldHeading"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "unfoldHeading"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrs"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "doUpdateUpdated"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "addFlashcards"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeFlashcards"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewNewItemTemplates"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionNewItemTemplatesInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewAutomations"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVAutomationConfigInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewConditionalColors"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVConditionalColorRuleInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewFilters"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewFilterInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewContextFilter"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColRelationFilters"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewFilterInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColRollupFilters"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewFilterInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewSorts"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewSortInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewPageSize"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColsWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Record<string, string> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColAlign"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColWrap"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColHidden"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColPin"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColIcon"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDesc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColAttributePanelVisibility"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "insertAttrViewBlock"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": TransactionInsertedItems | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewBlock"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "addAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewRow"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVRowOrderChangeInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewKey"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewBinding"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewCell"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVValueInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewCells"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColOptions"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVSelectOptionInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewColOption"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColOption"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionOptionChangeInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColOptionDesc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionOptionDescriptionInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCustomColors"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionCustomColorsInput | Array<AVAttributeViewCustomColorInput | null> | null | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColCalc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVFieldCalcInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColNumberFormat"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDateFormat"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "replaceAttrViewBlock"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": TransactionReplacedItem | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColTemplate"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "addAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": string | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewViewName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewViewIcon"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewViewDesc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "duplicateAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "duplicateAttrViewRow"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColRelation"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColRollup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionRollupInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "hideAttrViewName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDateFillCreated"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDateFillSpecificTime"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCreatedIncludeTime"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewUpdatedIncludeTime"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "duplicateAttrViewKey"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCoverFrom"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCoverFromAssetKeyID"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardCoverPosition"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionCardCoverPositionInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardSize"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewMap"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVMapSettingsInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCalendar"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVCalendarSettingsInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardLayout"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColFullRow"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewFitImage"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewDisplayFieldName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewDisplayEmptyFields"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewFillColBackgroundColor"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewShowIcon"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewWrapField"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "changeAttrViewLayout"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewBlockView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewBlockVisibleViews"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardAspectRatio"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardAspectRatioValue"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVViewGroupInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "hideAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "hideAttrViewAllGroups"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "foldAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "foldAttrViewGroups"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Record<string, boolean> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "syncAttrViewTableColWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": UnknownTransactionAction; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": JSONValue; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": JSONValue; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; };
+export type TransactionOperation = { "action": "updateAttrs"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionAttributeChangeInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "create"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "restoreCreatedDoc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeCreatedDoc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "update"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "insert"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "delete"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": BlockDeleteDataInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "move"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "swapBlockRef"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionBlockSwapInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": Array<string> | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "convertList"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionListConversionInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": TransactionListConversionResult | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "moveOutlineHeading"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "append"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "appendInsert"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "prependInsert"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "foldHeading"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "unfoldHeading"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrs"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null | string | Array<string>; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "doUpdateUpdated"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "addFlashcards"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeFlashcards"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewNewItemTemplates"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionNewItemTemplatesInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewAutomations"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVAutomationConfigInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewConditionalColors"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVConditionalColorRuleInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewFilters"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewFilterInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewContextFilter"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColRelationFilters"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewFilterInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColRollupFilters"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewFilterInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewSorts"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVViewSortInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewPageSize"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColsWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Record<string, string> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColAlign"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColWrap"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColHidden"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColPin"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColIcon"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDesc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColAttributePanelVisibility"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "insertAttrViewBlock"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": TransactionInsertedItems | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewBlock"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "addAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewRow"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVRowOrderChangeInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewCol"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewKey"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewBinding"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewCell"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVValueInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewCells"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColOptions"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Array<AVSelectOptionInput | null> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewColOption"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColOption"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionOptionChangeInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColOptionDesc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionOptionDescriptionInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCustomColors"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionCustomColorsInput | Array<AVAttributeViewCustomColorInput | null> | null | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColCalc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVFieldCalcInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColNumberFormat"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDateFormat"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "replaceAttrViewBlock"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": TransactionReplacedItem | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColTemplate"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "addAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": string | null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewViewName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewViewIcon"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewViewDesc"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "duplicateAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "duplicateAttrViewRow"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": string | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColRelation"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "updateAttrViewColRollup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionRollupInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "hideAttrViewName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDateFillCreated"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColDateFillSpecificTime"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCreatedIncludeTime"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewUpdatedIncludeTime"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "duplicateAttrViewKey"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCoverFrom"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCoverFromAssetKeyID"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardCoverPosition"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": TransactionCardCoverPositionInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardSize"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCalendar"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVCalendarSettingsInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardLayout"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewColFullRow"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewFitImage"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewDisplayFieldName"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewDisplayEmptyFields"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewFillColBackgroundColor"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewShowIcon"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewWrapField"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "changeAttrViewLayout"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewBlockView"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewBlockVisibleViews"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardAspectRatio"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewCardAspectRatioValue"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "setAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": AVViewGroupInput | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "hideAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": number | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "hideAttrViewAllGroups"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "foldAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": boolean | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "foldAttrViewGroups"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": Record<string, boolean> | null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "syncAttrViewTableColWidth"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "removeAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": "sortAttrViewGroup"; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": null; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": null; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; } | { "action": UnknownTransactionAction; "avID": string; "backRelationKeyID": string; "blockID": string; "blockIDs": Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdate | null>; "context": TransactionContext; "data": JSONValue; "deckID": string; "format": string; "groupID": string; "id": string; "ignoreDefaultFill": boolean; "isDetached": boolean; "isTwoWay": boolean; "keyID": string; "layout": string; "name": string; "nextID": string; "parentID": string; "previousID": string; "removeDest": boolean; "retData": JSONValue; "rootID": string; "rowID": string; "srcIDs": Array<string> | null; "srcs": Array<TransactionSourceFieldsInput | null> | null; "targetGroupID": string; "type": "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID": string; "viewIDs"?: Array<string>; };
-export type TransactionOperationRequest = { "action": "updateAttrs"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionAttributeChangeInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "create"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "restoreCreatedDoc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeCreatedDoc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "update"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "insert"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "delete"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: BlockDeleteDataInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "move"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "swapBlockRef"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionBlockSwapInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: Array<string> | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "convertList"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionListConversionInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: TransactionListConversionResultInput | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "moveOutlineHeading"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "append"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "appendInsert"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "prependInsert"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "foldHeading"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "unfoldHeading"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrs"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "doUpdateUpdated"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "addFlashcards"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeFlashcards"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewNewItemTemplates"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionNewItemTemplatesInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewAutomations"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVAutomationConfigInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewConditionalColors"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVConditionalColorRuleInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewFilters"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewFilterInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewContextFilter"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColRelationFilters"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewFilterInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColRollupFilters"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewFilterInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewSorts"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewSortInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewPageSize"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColsWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Record<string, string> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColAlign"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColWrap"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColHidden"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColPin"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColIcon"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDesc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColAttributePanelVisibility"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "insertAttrViewBlock"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: TransactionInsertedItemsInput | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewBlock"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "addAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewRow"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVRowOrderChangeInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewKey"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewBinding"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewCell"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVValueInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewCells"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColOptions"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVSelectOptionInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewColOption"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColOption"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionOptionChangeInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColOptionDesc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionOptionDescriptionInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCustomColors"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionCustomColorsInput | Array<AVAttributeViewCustomColorInput | null> | null | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColCalc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVFieldCalcInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColNumberFormat"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDateFormat"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "replaceAttrViewBlock"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: TransactionReplacedItemInput | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColTemplate"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "addAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: string | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewViewName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewViewIcon"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewViewDesc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "duplicateAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "duplicateAttrViewRow"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColRelation"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColRollup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionRollupInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "hideAttrViewName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDateFillCreated"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDateFillSpecificTime"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCreatedIncludeTime"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewUpdatedIncludeTime"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "duplicateAttrViewKey"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCoverFrom"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCoverFromAssetKeyID"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardCoverPosition"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionCardCoverPositionInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardSize"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewMap"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVMapSettingsInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCalendar"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVCalendarSettingsInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardLayout"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColFullRow"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewFitImage"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewDisplayFieldName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewDisplayEmptyFields"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewFillColBackgroundColor"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewShowIcon"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewWrapField"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "changeAttrViewLayout"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewBlockView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewBlockVisibleViews"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardAspectRatio"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardAspectRatioValue"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVViewGroupInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "hideAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "hideAttrViewAllGroups"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "foldAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "foldAttrViewGroups"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Record<string, boolean> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "syncAttrViewTableColWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": UnknownTransactionAction; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: JSONValue; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: JSONValue; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; };
+export type TransactionOperationRequest = { "action": "updateAttrs"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionAttributeChangeInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "create"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "restoreCreatedDoc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeCreatedDoc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "update"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "insert"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "delete"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: BlockDeleteDataInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "move"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "swapBlockRef"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionBlockSwapInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: Array<string> | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "convertList"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionListConversionInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: TransactionListConversionResultInput | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "moveOutlineHeading"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "append"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "appendInsert"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "prependInsert"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "foldHeading"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "unfoldHeading"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrs"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null | string | Array<string>; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "doUpdateUpdated"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "addFlashcards"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeFlashcards"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewNewItemTemplates"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionNewItemTemplatesInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewAutomations"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVAutomationConfigInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewConditionalColors"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVConditionalColorRuleInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewFilters"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewFilterInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewContextFilter"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColRelationFilters"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewFilterInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColRollupFilters"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewFilterInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewSorts"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVViewSortInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewPageSize"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColsWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Record<string, string> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColAlign"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColWrap"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColHidden"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColPin"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColIcon"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDesc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColAttributePanelVisibility"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "insertAttrViewBlock"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: TransactionInsertedItemsInput | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewBlock"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "addAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewRow"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVRowOrderChangeInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewCol"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewKey"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewBinding"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewCell"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVValueInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewCells"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColOptions"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Array<AVSelectOptionInput | null> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewColOption"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColOption"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionOptionChangeInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColOptionDesc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionOptionDescriptionInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCustomColors"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionCustomColorsInput | Array<AVAttributeViewCustomColorInput | null> | null | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColCalc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVFieldCalcInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColNumberFormat"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDateFormat"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "replaceAttrViewBlock"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: TransactionReplacedItemInput | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColTemplate"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "addAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: string | null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewViewName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewViewIcon"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewViewDesc"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "duplicateAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "duplicateAttrViewRow"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: string | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColRelation"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "updateAttrViewColRollup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionRollupInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "hideAttrViewName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDateFillCreated"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColDateFillSpecificTime"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCreatedIncludeTime"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewUpdatedIncludeTime"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "duplicateAttrViewKey"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCoverFrom"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCoverFromAssetKeyID"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardCoverPosition"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: TransactionCardCoverPositionInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardSize"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCalendar"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVCalendarSettingsInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardLayout"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewColFullRow"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewFitImage"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewDisplayFieldName"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewDisplayEmptyFields"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewFillColBackgroundColor"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewShowIcon"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewWrapField"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "changeAttrViewLayout"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewBlockView"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewBlockVisibleViews"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardAspectRatio"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewCardAspectRatioValue"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "setAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: AVViewGroupInput | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "hideAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: number | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "hideAttrViewAllGroups"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "foldAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: boolean | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "foldAttrViewGroups"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: Record<string, boolean> | null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "syncAttrViewTableColWidth"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "removeAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": "sortAttrViewGroup"; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: null; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: null; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; } | { "action": UnknownTransactionAction; "avID"?: string | null; "backRelationKeyID"?: string | null; "blockID"?: string | null; "blockIDs"?: Array<string> | null; "cellUpdates"?: Array<TransactionCellUpdateInput | null> | null; "context"?: TransactionContext | null; "data"?: JSONValue; "deckID"?: string | null; "format"?: string | null; "groupID"?: string | null; "id"?: string | null; "ignoreDefaultFill"?: boolean | null; "isDetached"?: boolean | null; "isTwoWay"?: boolean | null; "keyID"?: string | null; "layout"?: string | null; "name"?: string | null; "nextID"?: string | null; "parentID"?: string | null; "previousID"?: string | null; "removeDest"?: boolean | null; "retData"?: JSONValue; "rootID"?: string | null; "rowID"?: string | null; "srcIDs"?: Array<string> | null; "srcs"?: Array<TransactionSourceFieldsInput | null> | null; "targetGroupID"?: string | null; "type"?: "" | "block" | "text" | "number" | "date" | "select" | "mSelect" | "url" | "email" | "phone" | "location" | "mAsset" | "template" | "created" | "updated" | "checkbox" | "relation" | "rollup" | "lineNumber"; "viewID"?: string | null; "viewIDs"?: Array<string> | null; };
export type TransactionOptionChangeInput = { "newColor": string; "newDesc": string; "newName": string; "oldColor"?: string | null; "oldName": string; };
@@ -3567,20 +3555,6 @@ export interface APIPOSTRoutes {
/** 服务器路由要求;资源权限与笔记本租约仍由内核校验 */
authorization?: readonly ["authenticated","writable"];
};
- /**
- * 返回地图选定位置字段尚无坐标的条目,包含合法的仅名称值,不包含零坐标、无效值或超出地图投影范围的已有坐标。
- * 空绑定按视图字段顺序使用首个位置字段;显式绑定失效时返回空列表,不自动改绑或写入配置。
- * 损坏或不支持的位置数据沿用现有读取校验并返回错误,保留源数据,不静默当作未定位条目。
- * 保留当前视图筛选、上下文筛选、query 搜索和排序,search 额外匹配标题;独立分页默认 50 条,上限 100 条。
- * 仅允许非只读管理员访问,保留加密笔记本读取租约;只读取实时数据,不创建、升级或保存数据库。
- */
- "/api/av/getAttributeViewMapUnplaced": {
- request: AVMapUnplacedRequestInput;
- response: { "code": 0; "data": AVMapUnplacedData; "msg": string; } | { "code": -1; "data": { "closeTimeout": number; } | null; "msg": string; };
- body: "json";
- /** 服务器路由要求;资源权限与笔记本租约仍由内核校验 */
- authorization?: readonly ["authenticated","admin","writable"];
- };
"/api/av/getAttributeViewPasteRows": {
request: GetAttributeViewPasteRowsRequestInput;
response: { "code": 0; "data": AVPasteRowsData; "msg": string; } | { "code": -1; "data": { "closeTimeout": number; } | null; "msg": string; };
@@ -5568,17 +5542,6 @@ export interface APIPOSTRoutes {
/** 服务器路由要求;资源权限与笔记本租约仍由内核校验 */
authorization?: readonly ["authenticated","admin","writable"];
};
- /**
- * 返回内置 OpenFreeMap 标识,不读取或返回凭据,无需服务 ID。
- * 仅管理员可用,响应禁止缓存;认证 bypass 模式返回 mapAuthenticationBypass。
- */
- "/api/map/getRuntime": {
- request: EmptyRequestInput;
- response: { "code": 0; "data": MapRuntime | null; "msg": string; } | { "code": -1; "data": { "closeTimeout": number; } | null; "msg": string; };
- body: "none";
- /** 服务器路由要求;资源权限与笔记本租约仍由内核校验 */
- authorization?: readonly ["authenticated","admin"];
- };
/**
* 接收 name 和精确匹配的 redirectURI,返回客户端 id 及仅显示一次的 secret。
* 要求管理员权限并禁止只读模式;OAuth 令牌只用于 /mcp,不解锁加密笔记本。
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 8e2235a073..359aa08a51 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -25,7 +25,7 @@ type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
"kernel-plugin-state-change" |
"before-show-tooltip" | "before-hide-tooltip" |
"common-menu-open" | "common-menu-closed"
-type TAVView = "table" | "list" | "gallery" | "kanban" | "calendar" | "map";
+type TAVView = "table" | "list" | "gallery" | "kanban" | "calendar";
type TAVAlign = "" | "left" | "center" | "right"
type TAVDateFormat = "" | "full" | "month-day-year" | "day-month-year" | "year-month-day" | "lunar"
type TAVCol = import("./av").AVKeyType;
@@ -1293,17 +1293,7 @@ interface IAVCalendarRange {
}
// 表格、列表和日历共用行列结构,布局由 viewType 区分。
-interface IAVMapSettings {
- /** 位置字段引用;空值按视图顺序使用首个位置字段而不写回;显式字段缺失或类型变化时保留,不自动改绑。 */
- locationKeyID: string;
- /** 按视图保存的地图高度(CSS px);省略时为 480,显式 0 和 null 无效。 */
- height?: 320 | 480 | 640 | 800;
-}
-
interface IAVTable extends IAVView {
- /** 地图只渲染当前加载页中的 WGS84 坐标。 */
- map?: IAVMapSettings;
- mapMarkerScope?: "page";
/** 仅日历布局返回的持久化字段设置。 */
calendar?: IAVCalendarSettings;
/** 回显本次请求的日期范围,省略范围的请求不返回此字段。 */
diff --git a/app/stage/map/host.css b/app/stage/map/host.css
deleted file mode 100644
index ead4c2acea..0000000000
--- a/app/stage/map/host.css
+++ /dev/null
@@ -1,14 +0,0 @@
-html, body, #map {
- width: 100%;
- height: 100%;
- margin: 0;
- overflow: hidden;
-}
-
-html {
- color-scheme: light;
-}
-
-html[data-theme="dark"] {
- color-scheme: dark;
-}
diff --git a/app/stage/map/index.html b/app/stage/map/index.html
deleted file mode 100644
index 6abf4567ec..0000000000
--- a/app/stage/map/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <meta name="referrer" content="strict-origin-when-cross-origin">
- <link rel="stylesheet" href="/stage/map/host.css">
- <script defer src="/stage/build/map/host.js"></script>
-</head>
-<body><div id="map"></div></body>
-</html>
diff --git a/app/stage/map/wrapper.html b/app/stage/map/wrapper.html
deleted file mode 100644
index 631c5729d2..0000000000
--- a/app/stage/map/wrapper.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <meta name="referrer" content="strict-origin-when-cross-origin">
- <link rel="stylesheet" href="/stage/map/host.css">
- <script defer src="/stage/build/map/wrapper.js"></script>
-</head>
-<body></body>
-</html>
diff --git a/app/tests/api-contract.types.ts b/app/tests/api-contract.types.ts
index f23c35b5a1..127fef52ea 100644
--- a/app/tests/api-contract.types.ts
+++ b/app/tests/api-contract.types.ts
@@ -6,20 +6,10 @@ declare const fetchGet: FetchGet;
declare const fetchSyncPost: FetchSyncPost;
declare const dynamicURL: string;
-fetchPost("/api/av/getAttributeViewMapUnplaced", {id: "database", viewID: "map", query: "current", search: "title", page: 2, pageSize: 50}, response => {
- if (response.code === 0) {
- const total: number = response.data.total;
- const itemID: string | undefined = response.data.rows?.[0]?.id;
- void [total, itemID];
- }
-});
-fetchPost("/api/av/getAttributeViewMapUnplaced", {id: "database", viewID: "map", blockID: null, page: null});
-// @ts-expect-error 未定位条目查询必须指定地图视图。
-fetchPost("/api/av/getAttributeViewMapUnplaced", {id: "database"});
-// @ts-expect-error 未定位条目页码必须为数字。
-fetchPost("/api/av/getAttributeViewMapUnplaced", {id: "database", viewID: "map", page: "2"});
-// @ts-expect-error 未定位条目查询仅支持 POST。
-fetchGet("/api/av/getAttributeViewMapUnplaced", () => undefined);
+// @ts-expect-error 地图未定位条目接口已移除。
+fetchPost("/api/av/getAttributeViewMapUnplaced", {id: "database", viewID: "retired-view"});
+// @ts-expect-error 在线地图运行时接口已移除。
+fetchPost("/api/map/getRuntime", {});
fetchPost("/api/ai/agent/manageSkills", {action: "list"}, response => {
if (response.code === 0) {
diff --git a/app/tests/fixtures/map-webview-boundary/README.md b/app/tests/fixtures/map-webview-boundary/README.md
deleted file mode 100644
index 09043b6403..0000000000
--- a/app/tests/fixtures/map-webview-boundary/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# 独立地图 webview 原型
-
-此入口使用正式 createMapHostManager 和合成条目,不读取笔记,也不接入现有笔记窗口。主窗口保留本地实际配置:`nodeIntegration=true`、`contextIsolation=false`、`webSecurity=false`。地图 guest 使用独立内存会话、固定预载脚本和既有资源路由,强制启用 sandbox、contextIsolation 和 webSecurity,关闭全部 Node 能力。
-
-在 `app/` 中运行,确保没有设置 `ELECTRON_RUN_AS_NODE`:
-
-```sh
-node node_modules/electron/cli.js tests/fixtures/map-webview-boundary/harness.cjs
-```
-
-默认是真实 OpenFreeMap 模式,直接读取开发者已有的 `stage/build/map/` 产物,使用固定合成坐标。缺产物会明确报错,不自动编译或替换成假图。此模式需要访问 OpenFreeMap。先等终端输出边界检查通过与窗口就绪,再确认真实瓦片出图。
-
-不访问地图服务的合成模式,以及自动安全与覆盖断言:
-
-```sh
-node node_modules/electron/cli.js tests/fixtures/map-webview-boundary/harness.cjs --synthetic
-node node_modules/electron/cli.js tests/fixtures/map-webview-boundary/harness.cjs --synthetic --verify
-```
-
-远程内核宿主边界使用本机测试服务器代替真实内核,但保留远程主窗口的 `webSecurity=true`、正式 `createRemoteDocumentContentSecurityPolicy` 和 `shouldBlockRemoteFrameNavigation` 策略,以及独立 owner 会话;不会删除 CSP。地图授权守卫在 owner 首次加载前注册,先验证无分区、普通分区、持久分区的未授权 webview,以及 iframe/object 均被拒绝,再创建合法地图,完成同样的就绪、隔离、圆角像素、菜单覆盖和输入断言。
-
-```sh
-node node_modules/electron/cli.js tests/fixtures/map-webview-boundary/harness.cjs --remote --synthetic --verify
-node node_modules/electron/cli.js tests/fixtures/map-webview-boundary/harness.cjs --remote --real
-```
-
-如果正式远程 CSP 或导航策略拦住合法地图,远程测试必须失败;不要为使测试通过而修改 CSP、关闭 webSecurity 或移除子框架拦截。真实模式仍需已有地图产物与 OpenFreeMap 网络,合成模式不能证明真实瓦片或 WebGL 可用。
-
-终端会在远程宿主安全断言通过后输出固定的 `Remote map owner policy: PASS.`;启动或验证失败会输出 `Remote map webview verification: FAIL.` 及固定失败阶段,不输出原始异常或私有地址。自动验证还会在合法地图就绪后再次检查默认拒绝仍生效。
-
-自动验证覆盖 guest Node/IPC 与 owner DOM 不可访问、独立会话不受默认会话删除 CSP 影响、内核 API/非白名单/worker 请求拒绝、导航及伪造 guest 拒绝、普通 DOM 菜单合成像素及真实输入、Esc、地图内点击关闭菜单且同次点击仍传给地图、滚动、地图实例/视野/visibility 稳定。合成适配器验证不等于真实 OFM/WebGL 出图验证。
-
-手动打开普通菜单,输入中文并使用输入法候选,按 Esc,反复开关菜单,滚动地图所在容器。地图应持续可见,不重建、不重置视野;菜单应覆盖地图并正确接受输入。输入法与平台合成仍需在目标桌面实际确认。
-
-```sh
-node --test tests/mapWebviewStartup.test.js tests/mapWebviewBoundary.test.js
-```
-
-没有 DISPLAY/WAYLAND_DISPLAY 的 Linux 环境会明确跳过真实 Electron 验证,单元测试通过不能替代运行验证。禁止使用 `--no-sandbox`、`--disable-web-security` 或其他安全降级参数。开发环境实装 Electron 44.5.1,package.json 声明 44.7.0;两个版本的真实桌面验证结果需要分别记录。
-
-本地和远程 Electron 均使用网页内的受控地图 webview,普通菜单直接覆盖地图;远程仅放行主进程登记的地图预约,其余 webview 仍默认拒绝。此入口用于持续验证同一个正式宿主及网络隔离边界。
diff --git a/app/tests/fixtures/map-webview-boundary/harness.cjs b/app/tests/fixtures/map-webview-boundary/harness.cjs
deleted file mode 100644
index 047939e5a6..0000000000
--- a/app/tests/fixtures/map-webview-boundary/harness.cjs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Electron 默认应用通过动态导入执行此入口,不使用 require.main 判断。
-// 可复用测试只导入 harnessSupport.cjs,该模块导入时不会创建窗口。
-const {app, BrowserWindow} = require("electron");
-const {createHarness, createTemporaryProfile, verifyHarness} = require("./harnessSupport.cjs");
-
-if (!app || !BrowserWindow) {
- console.error("Map webview prototype requires Electron GUI mode; check ELECTRON_RUN_AS_NODE.");
- process.exitCode = 1;
-} else {
- let temporary;
- let remoteRequested = false;
- const fail = error => {
- console.error("Map webview prototype startup failed.");
- if (process.argv.includes("--verify")) {
- // 只输出安全的断言位置和操作符,不泄露探测地址、令牌或断言值。
- const failure = error.cause || error;
- const locations = typeof failure.stack === "string" ?
- failure.stack.matchAll(/\bharnessSupport\.cjs:(\d+):(\d+)\)?(?:\r?\n|$)/g) : [];
- for (const location of locations) {
- console.error("Verification location: harnessSupport.cjs:" + location[1] + ":" + location[2]);
- }
- if (failure.code === "ERR_ASSERTION") {
- const operators = ["strictEqual", "notStrictEqual", "deepStrictEqual", "notDeepStrictEqual", "==", "!=", "fail"];
- console.error("Verification assertion: ERR_ASSERTION" +
- (operators.includes(failure.operator) ? "; operator: " + failure.operator : ""));
- }
- }
- if (remoteRequested) console.error("Remote map webview verification: FAIL.");
- const codes = ["attachPreferenceMismatch", "hostAttachFailed", "hostDocumentLoadFailed", "hostDocumentMismatch",
- "hostRendererGone", "hostDestroyed", "hostBootstrapTimeout", "hostSDKTimeout", "documentCSPBlocked",
- "isolationAssertionFailed", "isolationCheckTimeout", "fixtureSetupFailed", "remoteOwnerPolicyFailed", "ownerClosed", "sdkUnavailable", "hostUnavailable",
- "sdkScriptLoadFailed", "sdkGlobalMissing", "mapCreationFailed", "mapReadyTimeout", "mapUnavailable"];
- if (codes.includes(error?.code)) {
- const prefKeys = ["sandbox", "contextIsolation", "webSecurity", "nodeIntegration", "nodeIntegrationInSubFrames",
- "nodeIntegrationInWorker", "webviewTag", "allowRunningInsecureContent", "experimentalFeatures", "disablePopups", "safeDialogs", "disableDialogs"];
- console.error("Boundary stage: " + error.code +
- (prefKeys.includes(error.preference) ? "; preference: " + error.preference : "") +
- (Number.isInteger(error.netError) && error.netError < 0 && error.netError > -1000 ? "; net error: " + error.netError : ""));
- }
- if (error?.code === "MAP_FIXTURE_ASSETS_MISSING") {
- console.error("Real mode requires existing app/stage/build/map assets. Run your normal development build first; this fixture does not build or substitute them.");
- }
- try {
- for (const win of BrowserWindow.getAllWindows()) if (!win.isDestroyed()) win.destroy();
- } finally {
- temporary?.cleanup();
- app.exit(1);
- }
- };
- try {
- console.info("Map webview prototype starting...");
- const flags = new Set(process.argv.slice(2));
- remoteRequested = flags.has("--remote");
- if ([...flags].some(flag => !["--real", "--synthetic", "--verify", "--remote"].includes(flag)) ||
- (flags.has("--real") && flags.has("--synthetic")) || (flags.has("--verify") && !flags.has("--synthetic"))) {
- throw new Error("Invalid fixture mode");
- }
- temporary = createTemporaryProfile();
- app.once("will-quit", temporary.cleanup);
- app.once("quit", temporary.cleanup);
- void createHarness({profile: temporary.profile, mode: flags.has("--synthetic") ? "synthetic" : "real",
- automate: flags.has("--verify"), ...(flags.has("--remote") && {kernelMode: "remote"})}).then(async harness => {
- console.info("Map webview prototype window ready.");
- if (flags.has("--verify")) {
- try { await verifyHarness(harness); }
- catch (failure) {
- const error = new Error("Fixture verification failed", {cause: failure});
- error.code = failure?.code === "isolationCheckTimeout" ? "isolationCheckTimeout" : "isolationAssertionFailed";
- throw error;
- }
- console.info("Map webview prototype verification passed.");
- await harness.destroy();
- app.exit(0);
- }
- }).catch(fail);
- } catch (error) {
- fail(error);
- }
-}
diff --git a/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs b/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs
deleted file mode 100644
index fc4b091513..0000000000
--- a/app/tests/fixtures/map-webview-boundary/harnessSupport.cjs
+++ /dev/null
@@ -1,469 +0,0 @@
-const assert = require("node:assert/strict");
-const fs = require("node:fs");
-const http = require("node:http");
-const os = require("node:os");
-const path = require("node:path");
-const {randomBytes} = require("node:crypto");
-const {createMapHostManager} = require("../../../electron/mapHostManager");
-const {hasUnsafeMapSwitches, mapHostFiles} = require("../../../electron/mapHostPolicy");
-const {createRemoteDocumentContentSecurityPolicy, shouldBlockRemoteFrameNavigation} = require("../../../electron/remoteKernel");
-
-const appDir = path.resolve(__dirname, "../../..");
-const ownerPreferences = Object.freeze({nodeIntegration: true, nodeIntegrationInSubFrames: false,
- nodeIntegrationInWorker: false, webviewTag: true, webSecurity: false, contextIsolation: false,
- autoplayPolicy: "user-gesture-required"});
-const remoteOwnerPreferences = Object.freeze({...ownerPreferences, webSecurity: true});
-const {MAP_WEBVIEW_PREFERENCES: guestPreferences, getMapWebviewPreferenceMismatch: getGuestPreferenceMismatch} =
- require("../../../electron/mapWebviewHost");
-// Electron 44 的 getLastWebPreferences 只回传此固定子集,不包含 preload 等构造参数。
-const reportedPreferenceKeys = Object.freeze(["sandbox", "contextIsolation", "webSecurity", "nodeIntegration",
- "nodeIntegrationInSubFrames", "nodeIntegrationInWorker", "webviewTag", "allowRunningInsecureContent",
- "experimentalFeatures", "disablePopups", "safeDialogs", "disableDialogs"]);
-const checkRealAssets = (directory = appDir) => {
- for (const [relative] of Object.values(mapHostFiles)) {
- try {
- if (!fs.statSync(path.join(directory, relative)).isFile()) throw new Error("Missing asset");
- } catch (_error) {
- const error = new Error("Real map assets are missing");
- error.code = "MAP_FIXTURE_ASSETS_MISSING";
- throw error;
- }
- }
-};
-
-const createTemporaryProfile = () => {
- const profile = fs.mkdtempSync(path.join(os.tmpdir(), "siyuan-map-webview-"));
- return {profile, cleanup() {
- if (path.dirname(path.resolve(profile)) !== path.resolve(os.tmpdir()) ||
- !path.basename(profile).startsWith("siyuan-map-webview-")) return;
- try { fs.rmSync(profile, {recursive: true, force: true, maxRetries: 3, retryDelay: 100}); }
- catch (_error) { /* Electron 退出时可能暂时保留配置目录的文件锁。 */ }
- }};
-};
-
-// 合成模式复用真实协议、准备阶段和运行时,仅替换地图适配器。
-const createSyntheticFiles = () => {
- const ts = require("typescript");
- const directory = path.join(appDir, "src/protyle/render/av/map");
- const modules = Object.fromEntries(["protocol", "loadingBudget", "bootstrap", "hostRuntime"].map(name =>
- ["./" + name, ts.transpileModule(fs.readFileSync(path.join(directory, name + ".ts"), "utf8"), {
- compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020},
- }).outputText]));
- modules["./providersLoader"] = `
- window.mapFixture = {fits: 0, revisions: [], destroyed: 0, visible: [], clicks: 0, locked: false};
- exports.prepareAVMapAssets = async () => ({lock() { window.mapFixture.locked = true; }, destroy() {}});
- exports.loadAVMapAdapter = async (_init, container, callbacks) => {
- window.mapFixture.callbacks = callbacks;
- container.style.background = "rgb(25, 119, 145)";
- container.textContent = "Synthetic map adapter. No provider network or WebGL.";
- container.addEventListener("click", () => window.mapFixture.clicks++);
- return {setPoints(points, revision) { window.mapFixture.revisions.push(revision); },
- fit() { window.mapFixture.fits++; }, resize() {}, setTheme() {},
- setVisible(value) { window.mapFixture.visible.push(value); },
- destroy() { window.mapFixture.destroyed++; }};
- };`;
- const runtime = `(() => {
- const modules = {${Object.entries(modules).map(([name, source]) =>
- `${JSON.stringify(name)}: (require, exports) => {${source}\n}`).join(",")}};
- const cache = {};
- const load = name => {
- if (!modules[name]) throw new Error("Unknown fixture module");
- if (!cache[name]) { cache[name] = {}; modules[name](load, cache[name]); }
- return cache[name];
- };
- load("./hostRuntime").connectAVMapRuntime(window);
- })();`;
- return new Map([["stage/map/index.html", fs.readFileSync(path.join(appDir, "stage/map/index.html"))],
- ["stage/map/host.css", fs.readFileSync(path.join(appDir, "stage/map/host.css"))],
- ["stage/build/map/host.js", Buffer.from(runtime)]]);
-};
-
-const waitFor = async (predicate, label, timeout = 5000) => {
- const deadline = Date.now() + timeout;
- while (!await predicate()) {
- assert.ok(Date.now() < deadline, label);
- await new Promise(resolve => setTimeout(resolve, 25));
- }
-};
-
-// 远程夹具复用正式导航策略,并保留响应 CSP,不运行本地夹具的移除响应头逻辑。
-const installRemoteOwnerGuards = (owner, ownerSession, evidence) => {
- const record = url => {
- try { evidence.blockedFramePaths.push(new URL(url).pathname); } catch (_error) { /* 只记录可解析的夹具路径。 */ }
- };
- owner.on("will-frame-navigate", event => {
- if (shouldBlockRemoteFrameNavigation({isMainFrame: event.isMainFrame})) {
- record(event.url);
- event.preventDefault();
- }
- });
- ownerSession.webRequest.onBeforeRequest((details, callback) => {
- const cancel = shouldBlockRemoteFrameNavigation({resourceType: details.resourceType});
- if (cancel) record(details.url);
- callback({cancel});
- });
-};
-
-const verifyRemoteOwnerRejections = async ({owner, origin, evidence}, expectedAttached = 0) => {
- const evaluate = source => owner.executeJavaScript(source);
- const before = evidence.rejectedAttachments;
- const blockedBefore = evidence.blockedFramePaths.length;
- await evaluate(`(() => {
- if (!window.remoteFixtureViolations) {
- window.remoteFixtureViolations = [];
- document.addEventListener("securitypolicyviolation", event => {
- window.remoteFixtureViolations.push({directive: event.effectiveDirective, uri: event.blockedURI});
- });
- } else window.remoteFixtureViolations.length = 0;
- for (const partition of ["", "unreserved-remote-map", "persist:unreserved-remote-map"]) {
- const view = document.createElement("webview");
- view.className = "remote-boundary-probe";
- view.setAttribute("src", ${JSON.stringify(origin + "/api/fixture-private")});
- if (partition) view.setAttribute("partition", partition);
- document.body.appendChild(view);
- }
- const frame = document.createElement("iframe");
- frame.className = "remote-boundary-probe";
- frame.src = ${JSON.stringify(origin + "/fixture-blocked-frame")};
- document.body.appendChild(frame);
- const object = document.createElement("object");
- object.className = "remote-boundary-probe";
- object.data = ${JSON.stringify(origin + "/fixture-blocked-object")};
- document.body.appendChild(object);
- })()`);
- await waitFor(() => evidence.rejectedAttachments >= before + 3, "remote ordinary and persistent webviews are denied without a matching reservation");
- for (const pathname of ["/fixture-blocked-frame", "/fixture-blocked-object"]) {
- await waitFor(async () => evidence.blockedFramePaths.slice(blockedBefore).includes(pathname) || await evaluate(
- `window.remoteFixtureViolations.some(value => value.uri === ${JSON.stringify(origin + pathname)})`),
- "remote iframe and object policy rejects " + pathname);
- }
- assert.equal(evidence.attached, expectedAttached, "an unreserved guest never attaches");
- assert.equal(evidence.privateRequests, 0);
- assert.equal(evidence.frameRequests, 0, "blocked embedded documents never reach the server");
- await evaluate('document.querySelectorAll(".remote-boundary-probe").forEach(element => element.remove())');
-};
-
-// 编译实际业务样式和可见性函数,避免夹具自行重写圆角规则或命中判断。
-const readMapCornerAssets = () => {
- const ts = require("typescript");
- const source = fs.readFileSync(path.join(appDir, "src/protyle/render/av/map/host.ts"), "utf8");
- const parsed = ts.createSourceFile("host.ts", source, ts.ScriptTarget.Latest, true);
- const visibility = parsed.statements.find(statement => ts.isVariableStatement(statement) &&
- statement.declarationList.declarations.some(declaration => declaration.name.getText(parsed) === "getAVMapVisibility"));
- assert.ok(visibility, "production visibility function exists");
- const theme = fs.readFileSync(path.join(appDir, "appearance/themes/daylight/theme.css"), "utf8");
- const radius = theme.match(/--b3-border-radius:\s*([^;]+);/);
- assert.ok(radius, "production theme defines the shared corner radius");
- return {css: require("sass").compile(path.join(appDir, "src/assets/scss/business/_av.scss")).css,
- radius: radius[1].trim(), visibility: ts.transpileModule(visibility.getText(parsed), {
- compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020},
- }).outputText};
-};
-
-const verifyMapCorners = async harness => {
- const {owner, guest, win} = harness;
- const assets = readMapCornerAssets();
- const evaluate = source => owner.executeJavaScript(source);
- const before = await evaluate(`(() => {
- const rect = document.getElementById("map-slot").getBoundingClientRect();
- return {x: rect.x, y: rect.y, width: rect.width, height: rect.height};
- })()`);
- await owner.insertCSS(assets.css);
- await evaluate(`document.documentElement.style.setProperty("--b3-border-radius", ${JSON.stringify(assets.radius)});
- document.getElementById("map-slot").classList.add("av__map-canvas");`);
- const state = await evaluate(`(() => {
- const exports = {};
- ${assets.visibility}
- const slot = document.getElementById("map-slot");
- const rect = slot.getBoundingClientRect();
- return {bounds: {x: rect.x, y: rect.y, width: rect.width, height: rect.height},
- visibility: exports.getAVMapVisibility(slot)};
- })()`);
- assert.deepEqual(state.bounds, before, "production child clipping preserves the map position and height");
- assert.deepEqual(state.visibility, {visible: true, viewport: {x: 0, y: 0, width: before.width, height: before.height}},
- "rounded guest corners retain the rectangular owner hit region and attribution viewport");
- // 移除合成文案,确保内侧采样不会碰到字形;不改变生产 guest 的隔离配置。
- const caption = await guest.executeJavaScript('document.getElementById("map").textContent');
- await guest.executeJavaScript('document.getElementById("map").textContent = ""');
- try {
- const pixel = async (x, y) => {
- const shot = await win.webContents.capturePage({x: Math.round(before.x + x), y: Math.round(before.y + y), width: 1, height: 1});
- const bitmap = shot.toBitmap();
- return [bitmap[2], bitmap[1], bitmap[0]].join();
- };
- for (const x of [0, before.width - 1]) {
- for (const y of [0, before.height - 1]) {
- await waitFor(async () => await pixel(x, y) === "255,255,255", "owner background is visible at every clipped guest corner");
- }
- }
- const inset = Math.ceil(parseFloat(assets.radius)) + 2;
- for (const x of [inset, before.width - inset - 1]) {
- for (const y of [inset, before.height - inset - 1]) {
- await waitFor(async () => await pixel(x, y) === "25,119,145", "the guest remains painted inside every rounded corner");
- }
- }
- } finally {
- await guest.executeJavaScript(`document.getElementById("map").textContent = ${JSON.stringify(caption)}`);
- }
-};
-
-const createHarness = async ({profile, mode = "real", automate = false, kernelMode = "local"} = {}) => {
- if (typeof profile !== "string" || !path.isAbsolute(profile) || !["real", "synthetic"].includes(mode) ||
- !["local", "remote"].includes(kernelMode)) {
- throw new Error("An isolated profile and fixed fixture mode are required");
- }
- const {app, BrowserWindow, MessageChannelMain, ipcMain, session} = require("electron");
- if (hasUnsafeMapSwitches(app.commandLine)) throw new Error("Unsafe process switches are prohibited");
- if (mode === "real") checkRealAssets();
- app.setPath("userData", profile);
- await app.whenReady();
- const syntheticFiles = mode === "synthetic" ? createSyntheticFiles() : undefined;
- const instanceID = randomBytes(24).toString("hex");
- let win, owner, ownerSession, origin, guest, manager, src, partition, startupTimer, closed = false, isolating = false;
- let initialized = false;
- let resolveReady, rejectReady;
- const readiness = new Promise((resolve, reject) => { resolveReady = resolve; rejectReady = reject; });
- void readiness.catch(() => {});
- const evidence = {privateRequests: 0, guestNetworkRequests: 0, defaultHeaderCalls: 0,
- defaultGuestHeaderCalls: 0, rejectedAttachments: 0, attached: 0, replies: [], diagnostics: [],
- ownerDocumentCSP: "", frameRequests: 0, blockedFramePaths: []};
- const ownerHTML = fs.readFileSync(path.join(__dirname, "owner.html"), "utf8");
- const server = http.createServer((request, response) => {
- const files = {"/stage/build/app/": ["owner.html", "text/html"],
- "/stage/fixture-owner.js": ["owner.js", "text/javascript"], "/stage/fixture-owner.css": ["owner.css", "text/css"]};
- const resource = files[request.url];
- if (!resource) {
- if (request.url.startsWith("/fixture-blocked-")) evidence.frameRequests++;
- else if (request.url.startsWith("/api/")) evidence.privateRequests++;
- else evidence.guestNetworkRequests++;
- response.writeHead(403).end();
- return;
- }
- const csp = kernelMode === "remote" ? createRemoteDocumentContentSecurityPolicy(ownerHTML, origin) : "default-src 'none'";
- if (request.url === "/stage/build/app/") evidence.ownerDocumentCSP = csp;
- response.setHeader("Content-Security-Policy", csp);
- response.setHeader("Content-Type", resource[1]);
- response.end(fs.readFileSync(path.join(__dirname, resource[0])));
- });
- const onCreated = (_event, contents) => {
- if (!contents.isDestroyed() && contents.getType() === "webview" && contents.hostWebContents === owner && !guest) guest = contents;
- };
- const onState = (event, value) => {
- if (event.sender !== owner || event.senderFrame !== owner.mainFrame || closed || value?.instanceID !== instanceID) return;
- if (value.type === "attached") { src = value.src; partition = value.partition; }
- else if (value.type === "ready") { clearTimeout(startupTimer); resolveReady(); }
- else if (value.type === "error") {
- const error = new Error("Map fixture failure");
- error.code = value.code;
- rejectReady(error);
- } else if (value.type === "markerClick") evidence.replies.push(value);
- };
- const destroy = async () => {
- if (closed) return;
- closed = true;
- const error = new Error("Map fixture closed before ready");
- error.code = "ownerClosed";
- rejectReady(error);
- clearTimeout(startupTimer);
- manager?.destroyAll();
- ipcMain.removeListener("map-webview-fixture-state", onState);
- app.removeListener("web-contents-created", onCreated);
- if (win && !win.isDestroyed()) win.destroy();
- if (kernelMode === "local") session.defaultSession.webRequest.onHeadersReceived(null);
- else ownerSession?.webRequest.onBeforeRequest(null);
- server.closeAllConnections?.();
- if (server.listening) await new Promise(resolve => server.close(resolve));
- };
- try {
- await new Promise((resolve, reject) => { server.once("error", reject); server.listen(0, "127.0.0.1", resolve); });
- origin = `http://127.0.0.1:${server.address().port}`;
- ownerSession = kernelMode === "remote" ? session.fromPartition("siyuan-fixture-owner-" + randomBytes(24).toString("hex"), {cache: false}) : session.defaultSession;
- if (kernelMode === "local") session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
- evidence.defaultHeaderCalls++;
- if (details.url.includes("/stage/map/") || details.url.includes("/stage/build/map/")) evidence.defaultGuestHeaderCalls++;
- callback({responseHeaders: Object.fromEntries(Object.entries(details.responseHeaders || {})
- .filter(([name]) => !["content-security-policy", "x-frame-options", "access-control-allow-origin"].includes(name.toLowerCase())))});
- });
- manager = createMapHostManager({app, ipcMain, session, BrowserWindow, MessageChannelMain, appDir,
- getTarget: id => owner && id === owner.id ? {mode: kernelMode, origin} : undefined,
- isInitialized: id => initialized && owner && id === owner.id,
- readFile: syntheticFiles ? async filename => {
- const relative = path.relative(appDir, filename).split(path.sep).join("/");
- if (!syntheticFiles.has(relative)) throw new Error("Unknown synthetic fixture asset");
- return syntheticFiles.get(relative);
- } : undefined});
- app.on("web-contents-created", onCreated);
- ipcMain.on("map-webview-fixture-state", onState);
- win = new BrowserWindow({width: 820, height: 620, useContentSize: true, show: true,
- webPreferences: {...(kernelMode === "remote" ? remoteOwnerPreferences : ownerPreferences), session: ownerSession}});
- owner = win.webContents;
- manager.registerOwner(owner);
- if (kernelMode === "remote") installRemoteOwnerGuards(owner, ownerSession, evidence);
- owner.on("will-attach-webview", event => { queueMicrotask(() => { if (event.defaultPrevented) evidence.rejectedAttachments++; }); });
- owner.on("did-attach-webview", () => { evidence.attached++; });
- win.on("closed", () => { void destroy().then(() => { if (!automate) app.quit(); }); });
- startupTimer = setTimeout(() => {
- const error = new Error("Owner fixture startup deadline exceeded");
- error.code = "hostBootstrapTimeout";
- rejectReady(error);
- }, 85000);
- await Promise.race([win.loadURL(origin + "/stage/build/app/"), readiness]);
- if (kernelMode === "remote") {
- try { await verifyRemoteOwnerRejections({owner, origin, evidence}); }
- catch (error) { error.code = "remoteOwnerPolicyFailed"; throw error; }
- }
- initialized = true;
- owner.send("map-webview-fixture-start", {instanceID, mode});
- await readiness;
- const harness = {win, owner, get guest() { return guest; }, session: guest.session, origin,
- get src() { return src; }, get partition() { return partition; }, instanceID, mode, kernelMode, evidence, destroy};
- isolating = true;
- await verifyIsolation(harness);
- console.info("Map webview boundary checks passed: isolated session, opaque origin, no Node/IPC or owner DOM access, private network denied.");
- if (kernelMode === "remote") console.info("Remote map owner policy: PASS. Web security and production CSP retained; unreserved guests, iframes and objects denied.");
- return harness;
- } catch (error) {
- await destroy();
- if (isolating && error.code !== "isolationCheckTimeout") error.code = "isolationAssertionFailed";
- else if (!error.code) error.code = "fixtureSetupFailed";
- throw error;
- }
-};
-
-const verifyIsolationChecks = async harness => {
- const {owner, guest, evidence, origin} = harness;
- const inspect = source => guest.executeJavaScript(source);
- const ownerPrefs = owner.getLastWebPreferences();
- for (const [name, value] of Object.entries(harness.kernelMode === "remote" ? remoteOwnerPreferences : ownerPreferences)) {
- if (reportedPreferenceKeys.includes(name)) assert.equal(ownerPrefs[name], value, name);
- }
- assert.equal(getGuestPreferenceMismatch(guest.getLastWebPreferences()), undefined);
- assert.notEqual(guest.session, owner.session);
- assert.notEqual(guest.getOSProcessId(), owner.getOSProcessId());
- assert.equal(guest.session.isPersistent(), false);
- assert.deepEqual(await inspect(`(() => {
- const ownerVisible = target => { try { return !!target?.document?.getElementById("owner-private-sentinel"); } catch (_) { return false; } };
- let evalBlocked = false; try { (0, eval)("1"); } catch (_) { evalBlocked = true; }
- return {origin: window.origin, require: typeof require, process: typeof process, ipc: typeof ipcRenderer,
- bridge: Object.keys(window.siyuanMapDesktop), parentOwner: ownerVisible(parent), topOwner: ownerVisible(top),
- openerOwner: ownerVisible(opener), evalBlocked};
- })()`), {origin: "null", require: "undefined", process: "undefined", ipc: "undefined", bridge: ["version"],
- parentOwner: false, topOwner: false, openerOwner: false, evalBlocked: true});
- if (harness.kernelMode === "remote") {
- const html = fs.readFileSync(path.join(__dirname, "owner.html"), "utf8");
- assert.equal(evidence.ownerDocumentCSP, createRemoteDocumentContentSecurityPolicy(html, origin));
- assert.equal(evidence.defaultHeaderCalls, 0, "remote owner never installs the local CSP-removal hook");
- assert.equal(evidence.frameRequests, 0);
- assert.ok(evidence.rejectedAttachments >= 3, "remote default denial is active before the map reservation");
- } else {
- assert.ok(evidence.defaultHeaderCalls > 0, "the unsafe owner header-removal fixture is active");
- }
- assert.equal(evidence.defaultGuestHeaderCalls, 0, "guest resources bypass the owner's default session entirely");
- assert.equal(evidence.guestNetworkRequests, 0, "fixed local guest resources never reach the kernel server");
- for (const target of [origin + "/api/fixture-private", "https://example.invalid/private", "file:///fixture-private"]) {
- assert.equal(await inspect(`fetch(${JSON.stringify(target)}).then(() => false, () => true)`), true);
- }
- assert.equal(evidence.privateRequests, 0, "private API probes never reach the kernel server");
-};
-
-const verifyIsolation = async harness => {
- let timer;
- const deadline = new Promise((_resolve, reject) => {
- timer = setTimeout(() => {
- const error = new Error("Map isolation check deadline exceeded");
- error.code = "isolationCheckTimeout";
- reject(error);
- }, 5000);
- });
- try { await Promise.race([verifyIsolationChecks(harness), deadline]); }
- finally { clearTimeout(timer); }
-};
-
-const verifyHarness = async harness => {
- assert.equal(harness.mode, "synthetic", "automated adapter checks require explicit synthetic mode");
- const {owner, guest, win, evidence, origin, src} = harness;
- const evaluate = source => owner.executeJavaScript(source);
- const inspect = source => guest.executeJavaScript(source);
- await verifyIsolation(harness);
- await waitFor(() => inspect("window.mapFixture?.fits === 1 && window.mapFixture.visible.at(-1) === true"), "runtime receives points and visibility");
- if (harness.kernelMode === "remote") await verifyRemoteOwnerRejections(harness, 1);
- assert.equal(await inspect("window.mapFixture.locked"), true);
- const privateURL = origin + "/api/fixture-private";
- assert.deepEqual(await inspect(`new Promise(resolve => {
- const code = "fetch(" + ${JSON.stringify(JSON.stringify(privateURL))} + ").then(() => postMessage({denied:false}), () => postMessage({denied:true,node:typeof require,process:typeof process}))";
- const url = URL.createObjectURL(new Blob([code], {type:"text/javascript"}));
- const worker = new Worker(url);
- const done = result => { worker.terminate(); URL.revokeObjectURL(url); resolve(result); };
- worker.onmessage = event => done(event.data);
- worker.onerror = () => done({workerFailed:true});
- })`), {denied: true, node: "undefined", process: "undefined"});
- await inspect(`window.open(${JSON.stringify(privateURL)}); window.location.href = ${JSON.stringify(privateURL)}`);
- await new Promise(resolve => setTimeout(resolve, 100));
- assert.equal(guest.getURL(), src);
- assert.equal(evidence.privateRequests, 0);
- await verifyMapCorners(harness);
- const identity = guest.id;
- const before = await inspect("JSON.stringify({fits:mapFixture.fits,revisions:mapFixture.revisions,visible:mapFixture.visible})");
- const pixel = async () => {
- const shot = await win.webContents.capturePage({x: 600, y: 285, width: 1, height: 1});
- const bitmap = shot.toBitmap();
- return [bitmap[2], bitmap[1], bitmap[0]];
- };
- await waitFor(async () => (await pixel()).join() === "25,119,145", "the guest surface is composited into the owner page");
- await evaluate("window.setFixtureMenu(true)");
- await waitFor(async () => (await pixel()).join() === "214,49,49", "ordinary DOM menu paints over the guest");
- owner.sendInputEvent({type: "mouseDown", x: 435, y: 200, button: "left", clickCount: 1});
- owner.sendInputEvent({type: "mouseUp", x: 435, y: 200, button: "left", clickCount: 1});
- await waitFor(() => evaluate("window.ownerFixture.menuActions === 1"), "the overlaid menu receives real input");
- assert.equal(await inspect("window.mapFixture.clicks"), 0);
- await evaluate("document.getElementById('menu-input').focus()");
- owner.sendInputEvent({type: "keyDown", keyCode: "Escape"});
- owner.sendInputEvent({type: "keyUp", keyCode: "Escape"});
- await waitFor(() => evaluate("document.getElementById('menu').hidden"), "Escape dismisses the ordinary DOM menu");
- await waitFor(async () => (await pixel()).join() === "25,119,145", "dismissal uncovers the still-rendered map");
- assert.equal(guest.id, identity);
- assert.equal(await inspect("JSON.stringify({fits:mapFixture.fits,revisions:mapFixture.revisions,visible:mapFixture.visible})"), before,
- "opening/closing an ordinary menu neither hides, rebuilds nor refits the map");
- await evaluate("window.setFixtureMenu(true)");
- guest.sendInputEvent({type: "mouseDown", x: 40, y: 100, button: "left", clickCount: 1});
- guest.sendInputEvent({type: "mouseUp", x: 40, y: 100, button: "left", clickCount: 1});
- await waitFor(() => evaluate("document.getElementById('menu').hidden && window.ownerFixture.dismissals === 1"),
- "a real map press dismisses the owner menu through the production manager");
- await waitFor(() => inspect("window.mapFixture.clicks === 1"), "the same map click still reaches the map");
- assert.equal(guest.id, identity);
- assert.equal(await inspect("JSON.stringify({fits:mapFixture.fits,revisions:mapFixture.revisions,visible:mapFixture.visible})"), before);
- await evaluate("document.getElementById('scroll-area').scrollTop = 80");
- assert.equal(await evaluate("document.getElementById('scroll-area').scrollTop"), 80);
- assert.equal(guest.id, identity);
- // 拒绝第二个伪造 guest,不影响已准入的 guest 和独立会话。
- const rejectedBeforeForgery = evidence.rejectedAttachments;
- await evaluate(`(() => {
- const bad = document.createElement("webview");
- bad.setAttribute("src", ${JSON.stringify(privateURL)});
- bad.setAttribute("partition", ${JSON.stringify(harness.partition)});
- bad.setAttribute("nodeintegration", "");
- bad.setAttribute("disablewebsecurity", "");
- document.body.appendChild(bad);
- })()`);
- await waitFor(() => evidence.rejectedAttachments > rejectedBeforeForgery, "a forged second guest is rejected before creation");
- assert.equal(evidence.attached, 1);
- assert.equal(evidence.privateRequests, 0);
- assert.equal(guest.id, identity);
- await inspect("window.mapFixture.callbacks.onMarkerClick('foreign-row', 1); window.mapFixture.callbacks.onMarkerClick('synthetic-row-1', 0)");
- await new Promise(resolve => setTimeout(resolve, 50));
- assert.equal(evidence.replies.length, 0);
- await inspect("window.mapFixture.callbacks.onMarkerClick('synthetic-row-1', 1)");
- await waitFor(() => evidence.replies.length === 1, "the existing finite protocol accepts only current member actions");
- await evaluate(`window.fixtureGuest.setAttribute("src", ${JSON.stringify(privateURL)})`);
- await new Promise(resolve => setTimeout(resolve, 100));
- assert.ok(guest.isDestroyed() || guest.getURL() === src, "dynamic src changes cannot load another document");
- assert.equal(evidence.privateRequests, 0);
- if (!guest.isDestroyed()) {
- await evaluate("window.fixtureGuest.remove()");
- await waitFor(() => guest.isDestroyed(), "removing the DOM guest destroys its renderer");
- }
-};
-
-module.exports = {createHarness, createTemporaryProfile, verifyHarness, checkRealAssets,
- createSyntheticFiles, ownerPreferences, remoteOwnerPreferences, guestPreferences, verifyIsolation, readMapCornerAssets,
- installRemoteOwnerGuards};
diff --git a/app/tests/fixtures/map-webview-boundary/owner.css b/app/tests/fixtures/map-webview-boundary/owner.css
deleted file mode 100644
index 6ed58db757..0000000000
--- a/app/tests/fixtures/map-webview-boundary/owner.css
+++ /dev/null
@@ -1,11 +0,0 @@
-body { margin: 0; padding: 20px; font: 15px system-ui, sans-serif; color: #202124; background: #fff; }
-header { display: flex; align-items: center; gap: 16px; }
-button, input { font: inherit; padding: 8px; }
-#scroll-area { position: absolute; left: 20px; top: 110px; width: 740px; height: 410px; overflow: auto; border: 1px solid #444; }
-#map-slot { width: 720px; height: 360px; }
-webview { display: flex; width: 100%; height: 100%; }
-.spacer { height: 300px; padding: 16px; }
-#menu { position: fixed; z-index: 10; left: 360px; top: 90px; width: 260px; height: 230px; box-sizing: border-box; padding: 16px; background: rgb(214, 49, 49); color: white; border-radius: 8px; }
-#menu[hidden] { display: none; }
-#menu label { display: block; }
-#menu input { box-sizing: border-box; width: 100%; margin: 8px 0; }
diff --git a/app/tests/fixtures/map-webview-boundary/owner.html b/app/tests/fixtures/map-webview-boundary/owner.html
deleted file mode 100644
index e6ce2d4d7d..0000000000
--- a/app/tests/fixtures/map-webview-boundary/owner.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>Map webview boundary prototype</title>
- <link rel="stylesheet" href="/stage/fixture-owner.css">
- <script defer src="/stage/fixture-owner.js"></script>
-</head>
-<body>
- <header>
- <button id="toggle-menu" type="button">Open ordinary DOM menu</button>
- <span id="status">Preparing isolated map...</span>
- </header>
- <p>Isolated map prototype with synthetic points. Open the menu, enter Chinese text, press Escape, and scroll.</p>
- <div id="scroll-area"><div id="map-slot"></div><div class="spacer">Scroll inside this region.</div></div>
- <div id="owner-private-sentinel" hidden>Owner-only fixture data</div>
- <div id="menu" class="b3-menu" hidden>
- <label>中文输入 <input id="menu-input" placeholder="输入中文,测试组合输入"></label>
- <button id="menu-action" type="button">Menu action</button>
- <p>Escape or click outside to close.</p>
- </div>
-</body>
-</html>
diff --git a/app/tests/fixtures/map-webview-boundary/owner.js b/app/tests/fixtures/map-webview-boundary/owner.js
deleted file mode 100644
index f9a5bd59cb..0000000000
--- a/app/tests/fixtures/map-webview-boundary/owner.js
+++ /dev/null
@@ -1,61 +0,0 @@
-const {ipcRenderer} = require("electron");
-const menu = document.getElementById("menu");
-const status = document.getElementById("status");
-window.ownerFixture = {ready: 0, menuActions: 0, errors: [], replies: [], changes: 0, dismissals: 0};
-window.setFixtureMenu = open => { menu.hidden = !open; };
-document.getElementById("toggle-menu").addEventListener("click", () => window.setFixtureMenu(menu.hidden));
-document.getElementById("menu-action").addEventListener("click", () => { window.ownerFixture.menuActions++; });
-document.getElementById("menu-input").addEventListener("input", () => { window.ownerFixture.changes++; });
-document.addEventListener("keydown", event => {
- if (event.key === "Escape" && !event.isComposing) window.setFixtureMenu(false);
-});
-document.addEventListener("pointerdown", event => {
- if (!menu.contains(event.target) && event.target.id !== "toggle-menu") window.setFixtureMenu(false);
-});
-let instanceID, mode;
-const envelope = () => ({version: 1, instanceID});
-const send = value => ipcRenderer.send("siyuan-map-command", {...envelope(), ...value});
-const report = value => ipcRenderer.send("map-webview-fixture-state", {...envelope(), ...value});
-const fail = code => {
- window.ownerFixture.errors.push(code);
- status.textContent = "Map failed: " + code;
- report({type: "error", code});
-};
-ipcRenderer.once("map-webview-fixture-start", async (_event, settings) => {
- instanceID = settings.instanceID;
- mode = settings.mode;
- try {
- const response = await ipcRenderer.invoke("siyuan-map-create", {...envelope(), provider: "openfreemap", theme: "light"});
- if (response?.version !== 1 || response.instanceID !== instanceID || response.mode !== "webview" || response.error) {
- fail(response?.error || "hostCreateInvalidResponse");
- return;
- }
- const guest = document.createElement("webview");
- guest.id = "map-guest";
- guest.setAttribute("partition", response.partition);
- guest.setAttribute("src", response.src);
- report({type: "attached", src: response.src, partition: response.partition});
- document.getElementById("map-slot").appendChild(guest);
- window.fixtureGuest = guest;
- status.textContent = mode === "real" ? "Loading real OpenFreeMap..." : "Loading synthetic boundary adapter...";
- } catch (_error) { fail("hostCreateRejected"); }
-});
-ipcRenderer.on("siyuan-map-reply", (_event, value) => {
- if (value?.version !== 1 || value.instanceID !== instanceID) return;
- if (value.type === "ready") {
- window.ownerFixture.ready++;
- send({type: "setPoints", revision: 1, points: [{id: "synthetic-row-1", longitude: 121.4737, latitude: 31.2304},
- {id: "synthetic-row-2", longitude: 121.5037, latitude: 31.2404}]});
- send({type: "visibility", visible: true, viewport: {x: 0, y: 0, width: 720, height: 360}});
- status.textContent = mode === "real" ? "Real OpenFreeMap ready" : "Synthetic boundary adapter ready";
- report({type: "ready"});
- } else if (value.type === "dismissMenu" && window.ownerFixture.ready) {
- window.ownerFixture.dismissals++;
- window.setFixtureMenu(false);
- } else if (value.type === "error") fail(value.code);
- else if (value.type === "markerClick") {
- window.ownerFixture.replies.push(value);
- report(value);
- }
-});
-window.addEventListener("pagehide", () => ipcRenderer.send("siyuan-map-destroy", envelope()), {once: true});
diff --git a/app/tests/mapAssets.test.js b/app/tests/mapAssets.test.js
deleted file mode 100644
index cf1240df4f..0000000000
--- a/app/tests/mapAssets.test.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const assert = require("node:assert/strict");
-const path = require("node:path");
-const {test} = require("node:test");
-const config = require("../webpack.map");
-
-test("map asset plugin emits only fixed renderer resources and tracks their source dependencies", () => {
- const assets = new Map();
- const compilation = {
- fileDependencies: new Set(),
- emitAsset(name, source) { assets.set(name, source.source()); },
- hooks: {processAssets: {tap(_options, callback) { callback(); }}},
- };
- const compiler = {hooks: {thisCompilation: {tap(_name, callback) { callback(compilation); }}}};
- const options = config({}, {mode: "production"});
- options.plugins.forEach(plugin => plugin.apply(compiler));
- assert.deepEqual([...assets.keys()].sort(), ["maplibre-LICENSE.txt", "maplibre-gl-csp-worker.js", "maplibre-gl.css", "maplibre-gl.js"]);
- for (const name of ["maplibre-gl-csp.js", "maplibre-gl-csp-worker.js", "maplibre-gl.css", "LICENSE.txt"]) {
- assert.ok(compilation.fileDependencies.has(require.resolve("maplibre-gl/dist/" + name)));
- }
- assert.equal(options.target, "web");
- assert.equal(options.output.path, path.resolve(__dirname, "../stage/build/map"));
- assert.equal(options.output.clean, true);
-});
diff --git a/app/tests/mapAttribution.test.js b/app/tests/mapAttribution.test.js
deleted file mode 100644
index f86972a39a..0000000000
--- a/app/tests/mapAttribution.test.js
+++ /dev/null
@@ -1,432 +0,0 @@
-const assert = require("node:assert/strict");
-const fs = require("node:fs");
-const os = require("node:os");
-const path = require("node:path");
-
-const closeTileServer = server => new Promise(resolve => {
- server.close(resolve);
- // 断言可能在刻意挂起的瓦片响应释放之前失败,清理时必须关闭这些连接。
- server.closeAllConnections();
-});
-
-const sampleTilePixel = (tileMap, timeout) => new Promise((resolve, reject) => {
- if (timeout <= 0) { resolve([0, 0, 0, 0]); return; }
- const canvas = tileMap.getCanvas();
- const gl = canvas.getContext("webgl2");
- const pixel = new Uint8Array(4);
- const finish = error => {
- clearTimeout(timer);
- tileMap.off("render", sample);
- if (error) reject(error);
- else resolve(Array.from(pixel));
- };
- const sample = () => {
- try {
- gl.readPixels(Math.floor(canvas.width / 2), Math.floor(canvas.height / 2), 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
- if (pixel[3] > 0) finish();
- } catch (error) { finish(error); }
- };
- const timer = setTimeout(() => finish(), timeout);
- tileMap.on("render", sample);
- tileMap.triggerRepaint();
-});
-
-const install = (sources, css, controlledClock) => {
- document.head.innerHTML = "";
- document.body.innerHTML = '<div id="map" class="maplibregl-map"></div>';
- const style = document.createElement("style");
- style.textContent = css + "body{margin:0} #map{width:100vw;height:100vh;position:relative;background:lightblue}";
- document.head.append(style);
- const modules = {};
- for (const [name, source] of Object.entries(sources)) {
- const exports = {};
- new Function("require", "exports", source)(name => {
- assertModule(name, modules[name.slice(2)]);
- return modules[name.slice(2)];
- }, exports);
- modules[name] = exports;
- }
- const container = document.getElementById("map");
- class FakeMap {
- callbacks = new Map();
- controls = [];
- style = {stylesheet: {}, tileManagers: {source: {used: true, getSource: () => ({attribution:
- '<a href="https://openfreemap.org" target="_blank">OpenFreeMap</a> ' +
- '<a href="https://www.openmaptiles.org/" target="_blank">&copy; OpenMapTiles</a> ' +
- 'Data from <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>'})}}};
- on(name, callback) {
- if (!this.callbacks.has(name)) this.callbacks.set(name, []);
- this.callbacks.get(name).push(callback);
- }
- off(name, callback) {
- this.callbacks.set(name, this.callbacks.get(name)?.filter(item => item !== callback) || []);
- }
- remove() { this.controls.forEach(control => control.onRemove()); }
- getCanvasContainer() { return container; }
- _getUIString() { return "Toggle attribution"; }
- addControl(control) {
- this.controls.push(control);
- const wrapper = document.createElement("div");
- wrapper.className = "maplibregl-ctrl-bottom-right";
- container.append(wrapper);
- wrapper.append(control.onAdd(this));
- }
- emit(name) { this.callbacks.get(name)?.slice().forEach(callback => callback()); }
- constructor() { window.mapFixture = this; }
- }
- if (controlledClock) {
- let now = 0, nextFrame = 0;
- const frames = new Map();
- window.requestAnimationFrame = callback => { frames.set(++nextFrame, callback); return nextFrame; };
- window.cancelAnimationFrame = frame => frames.delete(frame);
- window.advanceAttribution = elapsed => {
- now += elapsed;
- const pending = [...frames.values()];
- frames.clear();
- pending.forEach(callback => callback(now));
- };
- window.pendingAttributionFrames = () => frames.size;
- }
- window.attributionLinks = [];
- window.attributionAdapter = modules.providers.createAVMapAdapter("openfreemap", {
- Map: FakeMap, AttributionControl: window.maplibregl.AttributionControl,
- }, container, {onMarkerClick() {}, onError() {}, onAttributionClick: link => window.attributionLinks.push(link)});
- window.showAttribution = visible => window.attributionAdapter.setVisible(visible,
- visible ? {x: 0, y: 0, width: window.innerWidth, height: window.innerHeight} : undefined);
- window.showAttribution(true);
- window.mapFixture.emit("load");
-};
-
-const assertModule = (name, module) => {
- if (!module) throw new Error(`Unknown fixture module: ${name}`);
-};
-
-const verifyTileHTTP = async (win, sources, css, sdk) => {
- const http = require("node:http");
- const png = Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAADUlEQVQImWOoWHDiPwAGVALgQhC29AAAAABJRU5ErkJggg==", "base64");
- let failNextTile = false;
- let failedTiles = 0;
- let holdTiles = true;
- const pendingTiles = [];
- const server = http.createServer((request, response) => {
- if (request.url === "/") {
- response.setHeader("Content-Type", "text/html");
- response.end("<!doctype html><html><head></head><body style='margin:0'><div id='map' style='width:800px;height:600px'></div></body></html>");
- } else if (request.url === "/worker.js") {
- response.setHeader("Content-Type", "text/javascript");
- response.end(fs.readFileSync(require.resolve("maplibre-gl/dist/maplibre-gl-csp-worker.js")));
- } else if (/^\/tile\/\d+\/\d+\/\d+\.png$/.test(request.url)) {
- if (failNextTile) {
- failNextTile = false;
- failedTiles++;
- response.writeHead(503).end("Temporary fixture failure");
- } else {
- const sendTile = () => {
- response.setHeader("Content-Type", "image/png");
- response.end(png);
- };
- if (holdTiles) pendingTiles.push(sendTile);
- else sendTile();
- }
- } else {
- response.writeHead(404).end();
- }
- });
- await new Promise((resolve, reject) => {
- server.once("error", reject);
- server.listen(0, "127.0.0.1", resolve);
- });
- const origin = `http://127.0.0.1:${server.address().port}`;
- try {
- await win.loadURL(origin);
- await win.webContents.executeJavaScript(sdk);
- const installRealMap = (sources, css, origin) => new Promise((resolve, reject) => {
- const timer = setTimeout(() => reject(new Error("Fixture map did not load")), 15000);
- const style = document.createElement("style");
- style.textContent = css;
- document.head.append(style);
- const modules = {};
- for (const [name, source] of Object.entries(sources)) {
- const exports = {};
- new Function("require", "exports", source)(name => {
- if (!modules[name.slice(2)]) throw new Error(`Unknown fixture module: ${name}`);
- return modules[name.slice(2)];
- }, exports);
- modules[name] = exports;
- }
- const sdk = window.maplibregl;
- sdk.setWorkerUrl(origin + "/worker.js");
- window.tileHTTP = {errors: [], removed: 0, tileError: null, ready: false, loaded: false};
- class FixtureMap extends sdk.Map {
- constructor(options) {
- super({...options, canvasContextAttributes: {...options.canvasContextAttributes, preserveDrawingBuffer: true},
- style: {version: 8, sources: {fixture: {type: "raster", tileSize: 256,
- tiles: [origin + "/tile/{z}/{x}/{y}.png"], minzoom: 0, maxzoom: 6, attribution: "Fixture data"}},
- layers: [{id: "fixture", type: "raster", source: "fixture"}]}});
- window.tileMap = this;
- this.on("error", event => {
- window.tileHTTP.tileError = {status: event.error?.status, sourceId: event.sourceId,
- state: event.tile?.state, canonical: event.tile?.tileID?.canonical};
- });
- this.on("load", () => { window.tileHTTP.loaded = true; });
- }
- remove() { window.tileHTTP.removed++; super.remove(); }
- }
- window.tileAdapter = modules.providers.createAVMapAdapter("openfreemap", {...sdk, Map: FixtureMap},
- document.getElementById("map"), {onMarkerClick() {}, onReady() {
- window.tileHTTP.ready = true;
- clearTimeout(timer);
- resolve();
- },
- onError(code) {
- window.tileHTTP.errors.push(code);
- window.tileAdapter?.destroy();
- clearTimeout(timer);
- reject(new Error("Fixture map failed: " + code));
- }});
- });
- await win.webContents.executeJavaScript(`(${installRealMap.toString()})(${JSON.stringify(sources)},
- ${JSON.stringify(css)}, ${JSON.stringify(origin)})`);
- assert.equal(await win.webContents.executeJavaScript("tileHTTP.ready"), true);
- assert.equal(await win.webContents.executeJavaScript(
- "tileMap.getCanvas().getContext('webgl2').getContextAttributes().preserveDrawingBuffer"), true,
- "the fixture requests a retained WebGL buffer through the installed SDK API");
- assert.equal(await win.webContents.executeJavaScript("tileHTTP.loaded"), false);
- await win.webContents.executeJavaScript("tileAdapter.setPoints([{id:'fixture', longitude:121, latitude:31}],1); tileAdapter.fit(); void 0");
- assert.equal(await win.webContents.executeJavaScript("document.querySelectorAll('.maplibregl-marker').length"), 1);
- // 真实网络瓦片延迟超过原有 20 秒就绪期限;记录和相机已经可以使用。
- await new Promise(resolve => setTimeout(resolve, 21000));
- assert.ok(pendingTiles.length > 0);
- assert.deepEqual(await win.webContents.executeJavaScript("({ready:tileHTTP.ready,loaded:tileHTTP.loaded,removed:tileHTTP.removed,errors:tileHTTP.errors})"),
- {ready: true, loaded: false, removed: 0, errors: []});
- holdTiles = false;
- pendingTiles.splice(0).forEach(sendTile => sendTile());
- const loadDeadline = Date.now() + 10000;
- while (!await win.webContents.executeJavaScript("tileHTTP.loaded") && Date.now() < loadDeadline) {
- await new Promise(resolve => setTimeout(resolve, 50));
- }
- assert.equal(await win.webContents.executeJavaScript("tileHTTP.loaded"), true, "delayed tiles eventually finish rendering");
- const pixel = await win.webContents.executeJavaScript(`(${sampleTilePixel.toString()})(tileMap,
- ${Math.max(0, loadDeadline - Date.now())})`);
- assert.ok(pixel[3] > 0, "the real WebGL canvas paints the delayed raster tile");
- failNextTile = true;
- await win.webContents.executeJavaScript("tileMap.setZoom(3); void 0");
- const deadline = Date.now() + 10000;
- let state;
- do {
- await new Promise(resolve => setTimeout(resolve, 50));
- state = await win.webContents.executeJavaScript("tileHTTP");
- } while (!state.tileError && Date.now() < deadline);
- assert.equal(failedTiles, 1);
- assert.equal(state.tileError?.status, 503);
- assert.equal(state.tileError.sourceId, "fixture");
- assert.equal(state.tileError.state, "errored");
- assert.ok(Number.isInteger(state.tileError.canonical.z));
- assert.deepEqual(state.errors, []);
- assert.equal(state.removed, 0, "a real HTTP tile 503 preserves the loaded SDK map");
- await win.webContents.executeJavaScript("tileAdapter.setPoints([{id:'fixture', longitude:0, latitude:0}],1); void 0");
- assert.equal(await win.webContents.executeJavaScript("document.querySelectorAll('.maplibregl-marker').length"), 1);
- await win.webContents.executeJavaScript("tileMap.fire('error', {error: new Error('fixture fatal worker')}); void 0");
- state = await win.webContents.executeJavaScript("tileHTTP");
- assert.deepEqual(state.errors, ["mapUnavailable"]);
- assert.equal(state.removed, 1, "unclassified SDK errors retain the fatal cleanup path");
- } finally {
- try { await win.webContents.executeJavaScript("window.tileAdapter?.destroy()"); }
- finally { await closeTileServer(server); }
- }
-};
-
-const inspect = () => {
- const attribution = document.querySelector(".maplibregl-ctrl-attrib");
- const text = attribution.querySelector(".maplibregl-ctrl-attrib-inner");
- const rect = attribution.getBoundingClientRect();
- return {tag: attribution.tagName, buttonTag: attribution.firstElementChild.tagName, open: attribution.open,
- expandedClass: attribution.classList.contains("maplibregl-compact-show"),
- textVisible: text.checkVisibility(), hidden: document.hidden,
- radius: getComputedStyle(attribution).borderTopLeftRadius,
- corners: [rect.left + 1, rect.right - 1].flatMap(x => [rect.top + 1, rect.bottom - 1]
- .map(y => attribution.contains(document.elementFromPoint(x, y))))};
-};
-
-if (process.versions.electron && process.type === "browser") {
- const {app, BrowserWindow} = require("electron");
- app.setPath("userData", process.argv[2]);
- app.whenReady().then(async () => {
- const win = new BrowserWindow({width: 800, height: 600, useContentSize: true, show: true,
- webPreferences: {sandbox: true, nodeIntegration: false, contextIsolation: true, backgroundThrottling: false}});
- let code = 0;
- try {
- const ts = require("typescript");
- const compile = name => ts.transpileModule(fs.readFileSync(
- path.join(__dirname, "../src/protyle/render/av/map", name + ".ts"), "utf8"), {
- compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020},
- }).outputText;
- const sources = Object.fromEntries(["protocol", "attribution", "providers"]
- .filter(name => fs.existsSync(path.join(__dirname, "../src/protyle/render/av/map", name + ".ts")))
- .map(name => [name, compile(name)]));
- const css = fs.readFileSync(require.resolve("maplibre-gl/dist/maplibre-gl.css"), "utf8");
- const sdk = fs.readFileSync(require.resolve("maplibre-gl/dist/maplibre-gl-csp.js"), "utf8");
- const evaluate = source => win.webContents.executeJavaScript(source);
- const state = () => evaluate(`(${inspect.toString()})()`);
- const setup = async controlled => {
- await win.loadURL("data:text/html,<html><head></head><body></body></html>");
- await evaluate(sdk);
- await evaluate(`const assertModule = ${assertModule.toString()};
- (${install.toString()})(${JSON.stringify(sources)}, ${JSON.stringify(css)}, ${controlled})`);
- };
- await setup(false);
- const initial = await state();
- assert.equal(initial.tag, "DETAILS");
- assert.equal(initial.buttonTag, "SUMMARY");
- assert.equal(initial.hidden, false);
- assert.equal(initial.radius, "12px");
- assert.ok(initial.corners.some(hit => !hit), "rounded transparent corners do not hit attribution");
- assert.equal(initial.textVisible, true);
- const deadline = Date.now() + 10000;
- while ((await state()).open && Date.now() < deadline) {
- await new Promise(resolve => setTimeout(resolve, 100));
- }
- assert.equal((await state()).open, false, "actual visible time automatically collapses after five seconds");
- assert.equal((await state()).textVisible, false);
- await evaluate("window.attributionAdapter.destroy()");
-
- await setup(true);
- await evaluate("document.getElementById('map').style.width = '780px'; advanceAttribution(0); advanceAttribution(4000)");
- await evaluate("attributionAdapter.setVisible(true, {x: 0, y: 0, width: 790, height: 600}); advanceAttribution(1000)");
- assert.equal((await state()).open, false, "an entirely visible viewport change preserves four elapsed seconds");
- await evaluate("window.attributionAdapter.destroy()");
-
- await setup(true);
- win.webContents.debugger.attach("1.3");
- await win.webContents.debugger.sendCommand("Emulation.setFocusEmulationEnabled", {enabled: true});
- const click = async selector => {
- const point = await evaluate(`(() => {const rect = document.querySelector(${JSON.stringify(selector)})
- .getBoundingClientRect(); return {x: rect.x + rect.width / 2, y: rect.y + rect.height / 2};})()`);
- for (const type of ["mousePressed", "mouseReleased"]) {
- await win.webContents.debugger.sendCommand("Input.dispatchMouseEvent", {
- type, ...point, button: "left", clickCount: 1,
- });
- }
- };
- await evaluate("advanceAttribution(0); advanceAttribution(4999)");
- assert.equal((await state()).open, true);
- await evaluate("showAttribution(false); advanceAttribution(10000); showAttribution(true); advanceAttribution(0); advanceAttribution(4999)");
- assert.equal((await state()).open, true, "hidden time is not charged");
- await evaluate("advanceAttribution(1)");
- assert.equal((await state()).open, false);
- assert.equal((await state()).expandedClass, false);
- await click("summary");
- assert.equal((await state()).open, true, "trusted click expands once without a duplicate native toggle");
- assert.equal((await state()).textVisible, true);
- await evaluate("showAttribution(false)");
- await click("summary");
- assert.equal((await state()).open, false, "local disclosure survives delayed host visibility messages");
- await click("summary");
- assert.equal((await state()).open, true);
- await click('a[href="https://maplibre.org/"]');
- assert.deepEqual(await evaluate("window.attributionLinks"), [], "hidden host cannot open an official link");
- await evaluate("showAttribution(true)");
- for (const href of ["https://maplibre.org/", "https://openfreemap.org", "https://www.openmaptiles.org/",
- "https://www.openstreetmap.org/copyright"]) {
- await click(`a[href="${href}"]`);
- }
- assert.deepEqual(await evaluate("window.attributionLinks"), ["maplibre", "openfreemap", "openmaptiles", "openstreetmap"]);
- await evaluate("document.querySelector('summary').click(); advanceAttribution(10000); mapFixture.emit('drag')");
- assert.equal((await state()).open, true, "synthetic input, elapsed time and drag preserve the user's choice");
- await click("summary");
- assert.equal((await state()).open, false);
- await evaluate("window.attributionAdapter.destroy()");
- assert.deepEqual(await evaluate("[pendingAttributionFrames(), [...mapFixture.callbacks.values()].flat().length]"), [0, 0],
- "destroy releases application and real SDK control listeners");
- await verifyTileHTTP(win, sources, css, sdk);
- } catch (error) {
- console.error(error);
- code = 1;
- } finally {
- win.destroy();
- app.exit(code);
- }
- });
-} else {
- const {test} = require("node:test");
- const {execFile} = require("node:child_process");
- const {promisify} = require("node:util");
- test("tile pixel checks sample render frames and release their listener on paint or deadline", async t => {
- assert.deepEqual(await sampleTilePixel({}, 0), [0, 0, 0, 0], "an expired load budget never waits for another frame");
- for (const outcome of ["painted", "transparent", "error"]) {
- const painted = outcome === "painted";
- let deadline, render, reads = 0, repaints = 0;
- const timer = {}, cleared = [];
- t.mock.method(global, "setTimeout", (callback, delay) => {
- assert.equal(delay, 123);
- deadline = callback;
- return timer;
- });
- t.mock.method(global, "clearTimeout", value => cleared.push(value));
- const map = {
- getCanvas: () => ({width: 800, height: 600, getContext: () => ({
- RGBA: 1, UNSIGNED_BYTE: 2,
- readPixels(x, y, width, height, format, type, pixel) {
- assert.deepEqual([x, y, width, height, format, type], [400, 300, 1, 1, 1, 2]);
- reads++;
- if (outcome === "error") throw new Error("fixture readPixels failure");
- pixel[3] = painted ? 255 : 0;
- },
- })}),
- on(name, callback) { assert.equal(name, "render"); render = callback; },
- off(name, callback) { assert.equal(name, "render"); assert.equal(callback, render); render = null; },
- triggerRepaint() { repaints++; },
- };
- const pending = sampleTilePixel(map, 123);
- assert.equal(reads, 0, "sampling waits for a completed render");
- assert.equal(repaints, 1);
- const rejected = outcome === "error" ? assert.rejects(pending, /fixture readPixels failure/) : null;
- assert.doesNotThrow(() => render(), "render callbacks report failures through the awaited promise");
- if (outcome === "transparent") deadline();
- if (rejected) await rejected;
- else assert.deepEqual(await pending, [0, 0, 0, painted ? 255 : 0]);
- assert.equal(reads, 1);
- assert.equal(render, null);
- assert.deepEqual(cleared, [timer]);
- t.mock.restoreAll();
- }
- });
- test("tile fixture cleanup completes even when a failed assertion leaves responses held", async () => {
- const http = require("node:http");
- let response;
- let requestReceived;
- const received = new Promise(resolve => { requestReceived = resolve; });
- const server = http.createServer((_request, incomingResponse) => {
- response = incomingResponse;
- requestReceived();
- });
- await new Promise(resolve => server.listen(0, "127.0.0.1", resolve));
- const request = http.get(`http://127.0.0.1:${server.address().port}/tile/0/0/0.png`);
- request.on("error", () => {});
- await received;
- let rescued = false;
- const rescue = setTimeout(() => { rescued = true; response.destroy(); }, 1000);
- try {
- await closeTileServer(server);
- assert.equal(rescued, false, "teardown must close held responses before waiting for the server");
- } finally {
- clearTimeout(rescue);
- request.destroy();
- server.closeAllConnections();
- }
- });
- test("MapLibre attribution uses its real rounded DOM and supports trusted disclosure and visible display time", {
- skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY
- ? "Real Electron DOM verification requires DISPLAY or WAYLAND_DISPLAY" : false,
- }, async () => {
- const profile = fs.mkdtempSync(path.join(os.tmpdir(), "siyuan-map-attribution-"));
- const env = {...process.env};
- delete env.ELECTRON_RUN_AS_NODE;
- try {
- await promisify(execFile)(require("electron"), [__filename, profile], {env, windowsHide: true, timeout: 60000});
- } finally {
- assert.equal(path.dirname(path.resolve(profile)), path.resolve(os.tmpdir()));
- fs.rmSync(profile, {recursive: true, force: true, maxRetries: 5, retryDelay: 100});
- }
- });
-}
diff --git a/app/tests/mapWebviewBoundary.test.js b/app/tests/mapWebviewBoundary.test.js
deleted file mode 100644
index 67f37f8373..0000000000
--- a/app/tests/mapWebviewBoundary.test.js
+++ /dev/null
@@ -1,189 +0,0 @@
-const assert = require("node:assert/strict");
-const {test} = require("node:test");
-const {execFile} = require("node:child_process");
-const {promisify} = require("node:util");
-const fs = require("node:fs");
-const os = require("node:os");
-const path = require("node:path");
-const {EventEmitter} = require("node:events");
-const {ownerPreferences, remoteOwnerPreferences, guestPreferences, createSyntheticFiles, checkRealAssets,
- verifyIsolation, readMapCornerAssets, installRemoteOwnerGuards} =
- require("./fixtures/map-webview-boundary/harnessSupport.cjs");
-const {createMapSessionRouter} = require("../electron/mapHostManager");
-const {createMapContentSecurityPolicy} = require("../electron/mapHostPolicy");
-const {createRemoteDocumentContentSecurityPolicy} = require("../electron/remoteKernel");
-
-test("verification failures identify the assertion location without exposing probe secrets", async () => {
- const vm = require("node:vm");
- const source = fs.readFileSync(path.join(__dirname, "fixtures/map-webview-boundary/harness.cjs"), "utf8");
- for (const duringSetup of [false, true]) {
- const failure = Object.assign(new Error("https://private.invalid/?token=secret-token"), {
- code: "ERR_ASSERTION", operator: "deepStrictEqual", actual: "secret-token",
- stack: "Error: https://private.invalid/?token=secret-token\n" +
- " at waitFor (C:\\private\\harnessSupport.cjs:84:16)\n" +
- " at async verifyMapCorners (/private/harnessSupport.cjs:196:17)\n" +
- " at async verifyHarness (C:\\private\\harnessSupport.cjs:404:5)\n",
- });
- const messages = [];
- let resolveExit;
- const exited = new Promise(resolve => { resolveExit = resolve; });
- vm.runInNewContext(source, {
- process: {argv: ["electron", "harness.cjs", "--synthetic", "--verify"]},
- console: {info() {}, error: value => messages.push(String(value))},
- require: name => name === "electron" ? {
- app: {once() {}, exit: resolveExit}, BrowserWindow: {getAllWindows: () => []},
- } : {
- createTemporaryProfile: () => ({profile: "fixture", cleanup() {}}),
- createHarness: async () => { if (duringSetup) throw failure; return {}; },
- verifyHarness: async () => { throw failure; },
- },
- });
- assert.equal(await exited, 1);
- assert.match(messages.join("\n"), /Verification location: harnessSupport\.cjs:84:16/);
- assert.match(messages.join("\n"), /Verification location: harnessSupport\.cjs:196:17/);
- assert.match(messages.join("\n"), /Verification location: harnessSupport\.cjs:404:5/);
- assert.match(messages.join("\n"), /Verification assertion: ERR_ASSERTION; operator: deepStrictEqual/);
- assert.doesNotMatch(messages.join("\n"), /private|secret-token|https:/);
- }
-});
-
-test("remote fixture retains web security and rejects subframes and objects with the production navigation policy", () => {
- assert.equal(remoteOwnerPreferences.webviewTag, true);
- assert.equal(remoteOwnerPreferences.webSecurity, true);
- assert.equal(remoteOwnerPreferences.nodeIntegrationInSubFrames, false);
- const owner = new EventEmitter(), evidence = {blockedFramePaths: []};
- let beforeRequest;
- installRemoteOwnerGuards(owner, {webRequest: {onBeforeRequest(callback) { beforeRequest = callback; }}}, evidence);
- for (const [resourceType, expected] of [["mainFrame", false], ["script", false], ["subFrame", true], ["object", true]]) {
- let result;
- beforeRequest({resourceType, url: "https://fixture.invalid/" + resourceType}, value => { result = value; });
- assert.deepEqual(result, {cancel: expected});
- }
- for (const isMainFrame of [true, false]) {
- let prevented = false;
- owner.emit("will-frame-navigate", {isMainFrame, url: "https://fixture.invalid/frame",
- preventDefault() { prevented = true; }});
- assert.equal(prevented, !isMainFrame);
- }
- assert.deepEqual(evidence.blockedFramePaths, ["/subFrame", "/object", "/frame"]);
-});
-
-test("remote isolation verification fails if owner security, CSP or pre-reservation denial is missing", async () => {
- const origin = "http://127.0.0.1:1234";
- const html = fs.readFileSync(path.join(__dirname, "fixtures/map-webview-boundary/owner.html"), "utf8");
- const result = {origin: "null", require: "undefined", process: "undefined", ipc: "undefined", bridge: ["version"],
- parentOwner: false, topOwner: false, openerOwner: false, evalBlocked: true};
- const fixture = () => ({origin, kernelMode: "remote",
- owner: {getLastWebPreferences: () => remoteOwnerPreferences, session: {}, getOSProcessId: () => 1},
- guest: {getLastWebPreferences: () => guestPreferences, session: {isPersistent: () => false},
- getOSProcessId: () => 2, executeJavaScript: source => Promise.resolve(source.startsWith("fetch(") ? true : result)},
- evidence: {defaultHeaderCalls: 0, defaultGuestHeaderCalls: 0, guestNetworkRequests: 0, privateRequests: 0,
- ownerDocumentCSP: createRemoteDocumentContentSecurityPolicy(html, origin), frameRequests: 0, rejectedAttachments: 3}});
- await verifyIsolation(fixture());
- for (const weaken of [
- value => { value.owner.getLastWebPreferences = () => ownerPreferences; },
- value => { value.evidence.ownerDocumentCSP = ""; },
- value => { value.evidence.defaultHeaderCalls = 1; },
- value => { value.evidence.frameRequests = 1; },
- value => { value.evidence.rejectedAttachments = 0; },
- ]) {
- const value = fixture();
- weaken(value);
- await assert.rejects(verifyIsolation(value));
- }
-});
-
-test("common isolation checks have a fixed deadline and clear their timer on success, failure and timeout", async t => {
- let fire, delay;
- const timer = {}, cleared = [];
- t.mock.method(global, "setTimeout", (callback, milliseconds) => { fire = callback; delay = milliseconds; return timer; });
- t.mock.method(global, "clearTimeout", value => { cleared.push(value); });
- const result = {origin: "null", require: "undefined", process: "undefined", ipc: "undefined", bridge: ["version"],
- parentOwner: false, topOwner: false, openerOwner: false, evalBlocked: true};
- const harness = inspect => ({origin: "http://127.0.0.1:1234",
- owner: {getLastWebPreferences: () => ownerPreferences, session: {}, getOSProcessId: () => 1},
- guest: {getLastWebPreferences: () => guestPreferences, session: {isPersistent: () => false},
- getOSProcessId: () => 2, executeJavaScript: inspect},
- evidence: {defaultHeaderCalls: 1, defaultGuestHeaderCalls: 0, guestNetworkRequests: 0, privateRequests: 0}});
- await verifyIsolation(harness(source => Promise.resolve(source.startsWith("fetch(") ? true : result)));
- assert.equal(delay, 5000);
- assert.deepEqual(cleared, [timer]);
- await assert.rejects(verifyIsolation(harness(() => Promise.reject(new Error("fixture probe failed")))));
- assert.deepEqual(cleared, [timer, timer]);
- const pending = verifyIsolation(harness(() => new Promise(() => {})));
- const rejected = assert.rejects(pending, {code: "isolationCheckTimeout"});
- assert.equal(delay, 5000);
- fire();
- await rejected;
- assert.deepEqual(cleared, [timer, timer, timer]);
-});
-
-test("independent guest router retains exact CSP and denies private resources without using the owner session", async () => {
- const hooks = {}, protocols = {}, permissions = {};
- const ses = {webRequest: {}, protocol: {handle(name, fn) { protocols[name] = fn; }}, on() {},
- allowNTLMCredentialsForDomains() {}, closeAllConnections() {}, clearStorageData() {}, clearAuthCache() {}, clearCache() {}, clearHostResolverCache() {}};
- for (const name of ["onBeforeRequest", "onBeforeSendHeaders", "onHeadersReceived"]) ses.webRequest[name] = fn => { hooks[name] = fn; };
- for (const name of ["setPermissionRequestHandler", "setPermissionCheckHandler", "setDevicePermissionHandler", "setDisplayMediaRequestHandler", "setCertificateVerifyProc"]) {
- ses[name] = fn => { permissions[name] = fn; };
- }
- const origin = "http://127.0.0.1:1234";
- let reads = 0;
- const router = createMapSessionRouter({ses, origin, appDir: path.resolve(__dirname, ".."), readFile: async () => {
- reads++;
- return Buffer.from("<!doctype html><div id=map></div>");
- }});
- try {
- const document = await protocols.http(new Request(origin + "/stage/map/index.html?provider=openfreemap"));
- assert.equal(document.headers.get("Content-Security-Policy"), createMapContentSecurityPolicy(origin));
- assert.match(document.headers.get("Content-Security-Policy"), /sandbox allow-scripts/);
- assert.match(document.headers.get("Content-Security-Policy"), /frame-ancestors 'none'/);
- let filtered;
- hooks.onHeadersReceived({responseHeaders: {"Content-Security-Policy": ["fixed-policy"], "Set-Cookie": ["private=value"]}}, value => { filtered = value; });
- assert.deepEqual(filtered.responseHeaders, {"Content-Security-Policy": ["fixed-policy"]});
- for (const url of [origin + "/api/private", "https://example.invalid/private", "file:///private"]) {
- const handler = url.startsWith("file:") ? protocols.file : protocols.http;
- assert.equal((await handler(new Request(url))).status, 403);
- }
- assert.equal(reads, 1);
- assert.equal(permissions.setPermissionCheckHandler(), false);
- assert.equal(permissions.setDevicePermissionHandler(), false);
- let allowed;
- permissions.setPermissionRequestHandler({}, "clipboard-read", value => { allowed = value; });
- assert.equal(allowed, false);
- } finally { router.destroy(); }
-});
-
-test("synthetic mode bundles the existing runtime while real mode fails explicitly when production assets are absent", () => {
- const files = createSyntheticFiles();
- assert.equal(files.size, 3);
- const runtime = files.get("stage/build/map/host.js").toString();
- assert.match(runtime, /connectAVMapRuntime/);
- assert.match(runtime, /parseAVMapCommand/);
- assert.match(runtime, /getAVMapLockedPolicy/);
- assert.doesNotThrow(() => new Function(runtime));
- const empty = fs.mkdtempSync(path.join(os.tmpdir(), "siyuan-map-missing-assets-"));
- try { assert.throws(() => checkRealAssets(empty), {code: "MAP_FIXTURE_ASSETS_MISSING"}); }
- finally { fs.rmSync(empty, {recursive: true, force: true}); }
-});
-
-test("corner fixture compiles production styles and visibility logic without a GUI", () => {
- const assets = readMapCornerAssets();
- assert.match(assets.css, /\.av__map-canvas > webview/);
- assert.match(assets.radius, /^\d+(?:\.\d+)?px$/);
- assert.doesNotThrow(() => new Function("exports", assets.visibility));
-});
-
-for (const kernelMode of ["local", "remote"]) {
- test(`real Electron ${kernelMode} webview retains owner policy, clips rounded corners and stays behind DOM menus`, {
- skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY
- ? "Real Electron verification requires DISPLAY or WAYLAND_DISPLAY; no unsafe startup fallback is allowed" : false,
- }, async () => {
- const env = {...process.env};
- delete env.ELECTRON_RUN_AS_NODE;
- const flags = ["--synthetic", "--verify", ...(kernelMode === "remote" ? ["--remote"] : [])];
- const result = await promisify(execFile)(require("electron"), [path.join(__dirname, "fixtures/map-webview-boundary/harness.cjs"),
- ...flags], {env, windowsHide: true, timeout: 90000});
- assert.match(result.stdout, /Map webview prototype verification passed\./);
- if (kernelMode === "remote") assert.match(result.stdout, /Remote map owner policy: PASS\./);
- });
-}
diff --git a/app/tests/mapWebviewStartup.test.js b/app/tests/mapWebviewStartup.test.js
deleted file mode 100644
index 78d737ddf2..0000000000
--- a/app/tests/mapWebviewStartup.test.js
+++ /dev/null
@@ -1,193 +0,0 @@
-const assert = require("node:assert/strict");
-const {test} = require("node:test");
-const {spawnSync} = require("node:child_process");
-const path = require("node:path");
-const {pathToFileURL} = require("node:url");
-
-const entryPath = path.join(__dirname, "fixtures/map-webview-boundary/harness.cjs");
-const entry = pathToFileURL(entryPath).href;
-const support = pathToFileURL(path.join(__dirname, "fixtures/map-webview-boundary/harnessSupport.cjs")).href;
-
-// 在独立进程中复现 Electron 的动态导入,只替换 Electron 和可复用的测试辅助模块。
-const runEntry = (scenario = "success", args = []) => spawnSync(process.execPath, ["--input-type=module", "--eval", `
- import {createRequire} from "node:module";
- const require = createRequire(import.meta.url);
- const Module = require("node:module");
- const load = Module._load;
- const calls = [];
- const options = [];
- const scenario = ${JSON.stringify(scenario)};
- const args = ${JSON.stringify(args)};
- process.argv = [process.execPath, ${JSON.stringify(entryPath)}, ...args];
- const electron = {app: {
- once(name) { calls.push(name); },
- exit(code) { calls.push("exit:" + code); process.exitCode = code; },
- commandLine: {hasSwitch(name) {
- return args.some(arg => arg === "--" + name || arg.startsWith("--" + name + "="));
- }}
- }, BrowserWindow: {getAllWindows() { return [{isDestroyed: () => false,
- destroy() { calls.push("destroy"); }}, {isDestroyed: () => true,
- destroy() { throw new Error("destroyed window must be skipped"); }}]; }}};
- const helper = {
- createTemporaryProfile() {
- calls.push("profile");
- if (scenario === "profile-failure") throw new Error("private fixture error");
- return {profile: "isolated-fixture-profile", cleanup() { calls.push("cleanup"); }};
- },
- createHarness(value) {
- options.push(value);
- calls.push("create");
- if (scenario === "sync-failure") throw new Error("private fixture error");
- if (scenario === "isolation-timeout") {
- return Promise.reject(Object.assign(new Error("private fixture error"), {code: "isolationCheckTimeout"}));
- }
- return scenario === "async-failure" ? Promise.reject(new Error("private fixture error")) :
- Promise.resolve({destroy() { calls.push("destroy-harness"); }});
- },
- verifyHarness(harness) {
- if (!harness || typeof harness.destroy !== "function") throw new Error("missing harness");
- calls.push("verify");
- return scenario === "verification-failure" ? Promise.reject(new Error("private fixture error")) :
- Promise.resolve();
- }
- };
- Module._load = function(name, parent, isMain) {
- if (name === "electron") return scenario === "node-mode" ? "electron-binary" : electron;
- if (name === "./harnessSupport.cjs") return helper;
- return load.call(this, name, parent, isMain);
- };
- await import(${JSON.stringify(entry)});
- await import(${JSON.stringify(entry)});
- await new Promise(resolve => setImmediate(resolve));
- console.log("fixture-state:" + JSON.stringify({calls, options}));
-`], {cwd: path.join(__dirname, ".."), encoding: "utf8", timeout: 10000});
-
-const readState = result => {
- assert.equal(result.error, undefined);
- const state = result.stdout.match(/^fixture-state:(.+)$/m);
- assert.ok(state, result.stderr || result.stdout);
- return JSON.parse(state[1]);
-};
-
-test("manual webview dynamic-import entry starts exactly once and reports readiness", () => {
- const result = runEntry();
- const state = readState(result);
- assert.equal(result.status, 0, result.stderr);
- assert.equal(result.stdout.split("Map webview prototype starting...").length - 1, 1);
- assert.equal(result.stdout.split("Map webview prototype window ready.").length - 1, 1);
- assert.deepEqual(state.calls, ["profile", "will-quit", "quit", "create"]);
- assert.deepEqual(state.options, [{profile: "isolated-fixture-profile", mode: "real", automate: false}]);
- assert.equal(result.stderr, "");
-});
-
-test("manual webview mode flags select real or synthetic harness and synthetic verification", () => {
- const cases = [
- {args: ["--real"], mode: "real", automate: false},
- {args: ["--synthetic"], mode: "synthetic", automate: false},
- {args: ["--synthetic", "--verify"], mode: "synthetic", automate: true},
- {args: ["--verify", "--synthetic"], mode: "synthetic", automate: true},
- ];
- for (const {args, mode, automate} of cases) {
- const result = runEntry("success", args);
- const state = readState(result);
- assert.equal(result.status, 0, `${args.join(" ")}: ${result.stderr}`);
- assert.deepEqual(state.options, [{profile: "isolated-fixture-profile", mode, automate}]);
- if (automate) {
- assert.match(result.stdout, /Map webview prototype verification passed\./);
- assert.equal(state.calls.filter(call => call === "verify").length, 1);
- assert.ok(state.calls.includes("destroy-harness"));
- assert.ok(state.calls.includes("exit:0"));
- } else {
- assert.ok(!state.calls.includes("verify"));
- }
- assert.equal(result.stderr, "");
- }
-});
-
-test("manual webview entry rejects conflicting, unsupported and unsafe switches before creating the harness", () => {
- const cases = [
- ["--real", "--synthetic"],
- ["--synthetic", "--real"],
- ["--verify"],
- ["--real", "--verify"],
- ["--unknown-option"],
- ["--synthetic", "--no-sandbox"],
- ["--synthetic", "--disable-web-security"],
- ];
- for (const args of cases) {
- const result = runEntry("success", args);
- const state = readState(result);
- assert.equal(result.status, 1, args.join(" "));
- assert.match(result.stderr, /Map webview prototype startup failed\./);
- assert.deepEqual(state.options, []);
- assert.doesNotMatch(result.stdout, /window ready|verification passed/);
- }
-});
-
-test("manual webview startup cleans up synchronous, asynchronous and profile failures", () => {
- for (const scenario of ["sync-failure", "async-failure", "profile-failure"]) {
- const result = runEntry(scenario);
- const state = readState(result);
- assert.equal(result.status, 1, scenario);
- assert.match(result.stderr, /Map webview prototype startup failed\./, scenario);
- assert.doesNotMatch(result.stdout + result.stderr, /private fixture error|window ready/, scenario);
- assert.equal(state.calls.filter(call => call === "destroy").length, 1, scenario);
- assert.equal(state.calls.filter(call => call === "exit:1").length, 1, scenario);
- assert.equal(state.calls.filter(call => call === "cleanup").length, scenario === "profile-failure" ? 0 : 1,
- scenario);
- }
-});
-
-test("synthetic verification failures clean up without reporting success or exception details", () => {
- const result = runEntry("verification-failure", ["--synthetic", "--verify"]);
- const state = readState(result);
- assert.equal(result.status, 1);
- assert.match(result.stderr, /Map webview prototype startup failed\./);
- assert.doesNotMatch(result.stdout + result.stderr, /private fixture error|verification passed/);
- assert.ok(state.calls.includes("verify"));
- assert.ok(state.calls.includes("destroy"));
- assert.ok(state.calls.includes("cleanup"));
- assert.ok(state.calls.includes("exit:1"));
-});
-
-test("isolation timeout reports a fixed boundary stage and cleans up without exposing private details", () => {
- const result = runEntry("isolation-timeout");
- const state = readState(result);
- assert.equal(result.status, 1);
- assert.match(result.stderr, /Map webview prototype startup failed\./);
- assert.match(result.stderr, /Boundary stage: isolationCheckTimeout/);
- assert.doesNotMatch(result.stdout + result.stderr, /private fixture error|window ready/);
- assert.equal(state.calls.filter(call => call === "destroy").length, 1);
- assert.equal(state.calls.filter(call => call === "cleanup").length, 1);
- assert.equal(state.calls.filter(call => call === "exit:1").length, 1);
-});
-
-test("Node-mode webview invocation explains ELECTRON_RUN_AS_NODE without creating resources", () => {
- const result = runEntry("node-mode");
- const state = readState(result);
- assert.equal(result.status, 1);
- assert.match(result.stderr, /Map webview prototype requires Electron GUI mode; check ELECTRON_RUN_AS_NODE\./);
- assert.deepEqual(state, {calls: [], options: []});
- assert.doesNotMatch(result.stdout, /prototype starting|window ready/);
-});
-
-test("importing webview harness support does not start Electron or create a profile", () => {
- const result = spawnSync(process.execPath, ["--input-type=module", "--eval", `
- import {createRequire} from "node:module";
- const require = createRequire(import.meta.url);
- const Module = require("node:module");
- const load = Module._load;
- Module._load = function(name, parent, isMain) {
- if (name === "electron") throw new Error("support must not initialize Electron");
- return load.call(this, name, parent, isMain);
- };
- require("node:fs").mkdtempSync = () => { throw new Error("support must not create a profile"); };
- const imported = await import(${JSON.stringify(support)});
- if (typeof imported.default.createHarness !== "function") throw new Error("missing reusable harness");
- if (typeof imported.default.createTemporaryProfile !== "function") throw new Error("missing profile helper");
- `], {cwd: path.join(__dirname, ".."), encoding: "utf8", timeout: 10000});
- assert.equal(result.error, undefined);
- assert.equal(result.status, 0, result.stderr);
- assert.equal(result.stdout, "");
- assert.equal(result.stderr, "");
-});
diff --git a/app/tests/retiredMapAssets.test.js b/app/tests/retiredMapAssets.test.js
new file mode 100644
index 0000000000..adaecfc587
--- /dev/null
+++ b/app/tests/retiredMapAssets.test.js
@@ -0,0 +1,45 @@
+const assert = require("node:assert/strict");
+const fs = require("node:fs");
+const path = require("node:path");
+const test = require("node:test");
+
+const app = path.resolve(__dirname, "..");
+const read = name => fs.readFileSync(path.join(app, name), "utf8");
+
+test("frontend scripts and dependencies no longer build or include the map SDK", () => {
+ const pkg = JSON.parse(read("package.json"));
+ assert.equal(pkg.devDependencies["maplibre-gl"], undefined);
+ assert.equal(pkg.dependencies["maplibre-gl"], undefined);
+ Object.values(pkg.scripts).forEach(script => assert.doesNotMatch(script, /webpack\.map/));
+ assert.doesNotMatch(read("pnpm-lock.yaml"), /maplibre/);
+ for (const removed of ["webpack.map.js", "stage/map/index.html", "stage/map/wrapper.html",
+ "electron/mapHostManager.js", "electron/mapWebviewHost.js"]) {
+ assert.equal(fs.existsSync(path.join(app, removed)), false, removed);
+ }
+});
+
+test("all desktop packages exclude stale map sources and generated output", () => {
+ const configs = fs.readdirSync(app).filter(name => /^electron-builder(?:-[\w-]+)?\.yml$/.test(name));
+ assert.equal(configs.length, 6);
+ for (const name of configs) {
+ const stage = read(name).match(/from: "stage"\s+to: "stage"\s+filter: (\[[^\n]+\])/);
+ assert.ok(stage, name);
+ const filters = JSON.parse(stage[1]);
+ assert.ok(filters.includes("**/*"), name);
+ for (const excluded of ["!map/**/*", "!build/map/**/*", "!ocr/runtime/**/*"]) {
+ assert.ok(filters.includes(excluded), name + ": " + excluded);
+ }
+ }
+});
+
+test("Docker and mobile packaging exclude stale map resources", () => {
+ const docker = read("../.dockerignore").trim().split(/\r?\n/);
+ assert.ok(docker.includes("app/stage/map"));
+ assert.ok(docker.includes("app/stage/build/map"));
+ const android = read("../scripts/android-dev-run.mjs");
+ const ci = read("../.github/workflows/cd.yml");
+ for (const root of ["stage/map", "stage/build/map"]) {
+ assert.ok(android.includes('"--exclude=' + root + '"'));
+ assert.ok(ci.includes("'" + root + "/*'"));
+ }
+});
diff --git a/app/webpack.map.js b/app/webpack.map.js
deleted file mode 100644
index f7a95a982e..0000000000
--- a/app/webpack.map.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const fs = require("fs");
-const path = require("path");
-const webpack = require("webpack");
-const {EsbuildPlugin} = require("esbuild-loader");
-
-// 地图代码独立使用 web 目标,不共享 electron-renderer 的运行时或依赖包。
-class MapLibreAssetsPlugin {
- apply(compiler) {
- compiler.hooks.thisCompilation.tap("MapLibreAssetsPlugin", (compilation) => {
- compilation.hooks.processAssets.tap({name: "MapLibreAssetsPlugin",
- stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL}, () => {
- const files = {
- "maplibre-gl.js": "maplibre-gl/dist/maplibre-gl-csp.js",
- "maplibre-gl-csp-worker.js": "maplibre-gl/dist/maplibre-gl-csp-worker.js",
- "maplibre-gl.css": "maplibre-gl/dist/maplibre-gl.css",
- "maplibre-LICENSE.txt": "maplibre-gl/dist/LICENSE.txt",
- };
- for (const [name, source] of Object.entries(files)) {
- const resolved = require.resolve(source);
- compilation.fileDependencies.add(resolved);
- compilation.emitAsset(name, new webpack.sources.RawSource(fs.readFileSync(resolved)));
- }
- });
- });
- }
-}
-
-module.exports = (_env, argv = {}) => ({
- name: "map-host",
- mode: argv.mode || "development",
- watch: argv.mode !== "production",
- target: "web",
- devtool: false,
- entry: {host: "./src/protyle/render/av/map/hostEntry.ts", wrapper: "./src/protyle/render/av/map/wrapperEntry.ts"},
- output: {
- path: path.resolve(__dirname, "stage/build/map"),
- filename: "[name].js",
- publicPath: "/stage/build/map/",
- globalObject: "globalThis",
- clean: true,
- },
- resolve: {extensions: [".ts", ".js"]},
- module: {rules: [{test: /\.ts$/, include: path.resolve(__dirname, "src/protyle/render/av/map"),
- loader: "esbuild-loader", options: {target: "es2021"}}]},
- optimization: {
- minimize: argv.mode === "production",
- minimizer: [new EsbuildPlugin({target: "es2021"})],
- splitChunks: false,
- runtimeChunk: false,
- },
- plugins: [new MapLibreAssetsPlugin()],
-});
diff --git a/kernel/api/av_contract_map.go b/kernel/api/av_contract_map.go
deleted file mode 100644
index 62ef19c0df..0000000000
--- a/kernel/api/av_contract_map.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package api
-
-import (
- "github.com/siyuan-note/siyuan/kernel/apicontract"
- "github.com/siyuan-note/siyuan/kernel/av"
-)
-
-func toContractAVMapSettings(value *av.MapSettings) *apicontract.AVMapSettings {
- if value == nil {
- return nil
- }
- return &apicontract.AVMapSettings{LocationKeyID: value.LocationKeyID, Height: apicontract.AVMapHeight(value.Height)}
-}
-
-func toContractAVLayoutMap(value *av.LayoutMap) *apicontract.AVLayoutMap {
- if value == nil {
- return nil
- }
- return &apicontract.AVLayoutMap{
- AVBaseLayout: toContractAVBaseLayout(value.BaseLayout),
- Columns: avContractSlice(value.Columns, toContractAVViewTableColumn),
- RowIDs: value.RowIDs,
- Settings: *toContractAVMapSettings(&value.Settings),
- }
-}
diff --git a/kernel/api/av_contract_mapping.go b/kernel/api/av_contract_mapping.go
index 3ec26b67df..38d7695828 100644
--- a/kernel/api/av_contract_mapping.go
+++ b/kernel/api/av_contract_mapping.go
@@ -30,8 +30,6 @@ func avContractView(value av.Viewable) apicontract.AVViewInstance {
switch view := value.(type) {
case *av.Table:
return apicontract.NewAVTableInstance(toContractAVTable(view))
- case *av.Map:
- return apicontract.NewAVTableInstance(toContractAVTable(view.Table))
case *av.Calendar:
return apicontract.NewAVTableInstance(toContractAVTable(view.Table))
case *av.List:
@@ -50,8 +48,6 @@ func toContractAVTable(value *av.Table) *apicontract.AVTable {
}
return &apicontract.AVTable{
AVBaseInstance: toContractAVBaseInstance(value.BaseInstance),
- Map: toContractAVMapSettings(value.Map),
- MapMarkerScope: value.MapMarkerScope,
Calendar: toContractAVCalendarSettings(value.Calendar),
CalendarRange: toContractAVCalendarRange(value.CalendarRange),
CalendarTargetDate: value.CalendarTargetDate,
@@ -1033,7 +1029,6 @@ func toContractAVView(value *av.View) *apicontract.AVView {
LayoutType: string(value.LayoutType),
Table: toContractAVLayoutTable(value.Table),
List: toContractAVLayoutTable(value.List),
- Map: toContractAVLayoutMap(value.Map),
Calendar: toContractAVLayoutCalendar(value.Calendar),
Gallery: toContractAVLayoutGallery(value.Gallery),
Kanban: toContractAVLayoutKanban(value.Kanban),
diff --git a/kernel/api/av_contract_render.go b/kernel/api/av_contract_render.go
index 80af4f79f3..8f61fa09d9 100644
--- a/kernel/api/av_contract_render.go
+++ b/kernel/api/av_contract_render.go
@@ -56,12 +56,7 @@ func renderAttrView(blockID, avID, viewID, query string, page, pageSize int, gro
}
data := apicontract.AVRenderData{AVArchiveRenderData: avArchiveRenderData(attrView, view), ContextFilter: toContractAVAttributeViewContextFilter(contextFilter), ContextFilterFields: avContractSlice(model.GetAttributeViewContextFilterFields(attrView, blockID), toContractAVAttributeViewContextFilterField), Target: toContractAVAttributeViewRenderTarget(target)}
if filter != nil {
- if mapped, ok := view.(*av.Map); ok {
- view, target = model.FilterAttributeViewMapForPublish(mapped, page, pageSize, target, filter)
- data.Target = toContractAVAttributeViewRenderTarget(target)
- } else {
- view = filter(view)
- }
+ view = filter(view)
if calendar, ok := view.(*av.Calendar); ok {
// 发布过滤后重新计算定位,避免返回不可访问条目的日期和行位置。
visibleTargetID := ""
diff --git a/kernel/api/av_map.go b/kernel/api/av_map.go
deleted file mode 100644
index 4dbec459e1..0000000000
--- a/kernel/api/av_map.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package api
-
-import (
- "strings"
-
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/apicontract"
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/model"
-)
-
-var getAttributeViewMapUnplaced = contractHandler(apicontract.GetAttributeViewMapUnplaced, func(c *gin.Context, request apicontract.AVMapUnplacedRequest) apicontract.Response[apicontract.AVMapUnplacedData] {
- if err := holdAttributeViewRequest(c, request.BlockID, request.ID); err != nil {
- return apicontract.Failure[apicontract.AVMapUnplacedData](-1, model.Conf.Language(314))
- }
- view, _, _, err := model.RenderAttributeViewWithTargetReadOnly(request.BlockID, request.ID, request.ViewID, request.Query,
- 1, -1, nil, "", false, false, "", "")
- if err != nil {
- return apicontract.Failure[apicontract.AVMapUnplacedData](-1, err.Error())
- }
- mapped, ok := view.(*av.Map)
- if !ok || mapped.Map == nil {
- return apicontract.Failure[apicontract.AVMapUnplacedData](-1, av.ErrViewNotFound.Error())
- }
- rows := attributeViewMapUnplacedRows(mapped, request.Search)
- total := len(rows)
- rows = paginateAttributeViewRows(rows, avPage(request.Page, 1), avPage(request.PageSize, 50))
- return apicontract.Success(apicontract.AVMapUnplacedData{
- Rows: avContractSlice(rows, toContractAVTableRow), Total: total,
- })
-})
-
-func attributeViewMapUnplacedRows(mapped *av.Map, search string) (rows []*av.TableRow) {
- keyID := mapped.Map.LocationKeyID
- if keyID == "" {
- // 与地图显示一致,只在空绑定时按视图顺序派生默认字段,不持久化设置。
- for _, column := range mapped.Columns {
- if column.Type == av.KeyTypeLocation {
- keyID = column.ID
- break
- }
- }
- }
- key := mapped.GetColumn(keyID)
- if key == nil || key.Type != av.KeyTypeLocation {
- return
- }
- search = strings.ToLower(strings.TrimSpace(search))
- // 此集合已完成当前视图的上下文筛选、筛选、搜索和排序,不受地图行分页影响。
- for _, row := range mapped.RowsBeforePagination {
- value := row.GetValue(keyID)
- if value == nil || value.Type != av.KeyTypeLocation {
- continue
- }
- location := value.Location
- if location != nil && (location.Normalize() != nil || location.Latitude != nil || location.Longitude != nil) {
- continue
- }
- if attributeViewRowMatchesTitle(row, search) {
- rows = append(rows, row)
- }
- }
- return
-}
diff --git a/kernel/api/contract_av_location_mapping_test.go b/kernel/api/contract_av_location_mapping_test.go
index 3467ae13b1..7f122804ce 100644
--- a/kernel/api/contract_av_location_mapping_test.go
+++ b/kernel/api/contract_av_location_mapping_test.go
@@ -40,7 +40,7 @@ func TestAVContractLocationFieldAndRenderMapping(t *testing.T) {
table := &av.Table{BaseInstance: &av.BaseInstance{ID: "view"},
Columns: []*av.TableColumn{{BaseInstanceField: field}},
Rows: []*av.TableRow{{ID: "item", Cells: []*av.TableCell{{BaseValue: &av.BaseValue{Value: value, ValueType: key.Type}}}}}}
- for _, view := range []av.Viewable{table, &av.List{Table: table}, &av.Map{Table: table}} {
+ for _, view := range []av.Viewable{table, &av.List{Table: table}} {
assertAVContractJSONEqual(t, view, avContractView(view))
}
}
diff --git a/kernel/api/contract_av_map_test.go b/kernel/api/contract_av_map_test.go
deleted file mode 100644
index 2cd7f449a8..0000000000
--- a/kernel/api/contract_av_map_test.go
+++ /dev/null
@@ -1,361 +0,0 @@
-package api
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "net/http"
- "net/http/httptest"
- "os"
- "reflect"
- "testing"
-
- "github.com/88250/lute/ast"
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/apicontract"
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/model"
- "github.com/siyuan-note/siyuan/kernel/treenode"
-)
-
-func TestAVContractMapMapping(t *testing.T) {
- table := &av.Table{Map: &av.MapSettings{LocationKeyID: "20261009000000-abcdefg", Height: 640},
- MapMarkerScope: "page", Columns: []*av.TableColumn{}, Rows: []*av.TableRow{}, RowCount: 120}
- assertAVContractJSONEqual(t, &av.Map{Table: table}, avContractView(&av.Map{Table: table}))
- layout := &av.LayoutMap{LayoutTable: av.NewLayoutTable(), Settings: *table.Map}
- assertAVContractJSONEqual(t, layout, toContractAVLayoutMap(layout))
- view := &av.View{ID: "view", LayoutType: av.LayoutTypeMap, Map: layout}
- assertAVContractJSONEqual(t, view, toContractAVView(view))
- bundle, err := apicontract.BuildBundle()
- if err != nil {
- t.Fatal(err)
- }
- response := apicontract.Success(apicontract.NewAVRenderResult(apicontract.AVRenderData{
- AVArchiveRenderData: apicontract.AVArchiveRenderData{ViewType: "map", View: avContractView(&av.Map{Table: table})},
- }))
- payload, err := json.Marshal(response)
- if err != nil {
- t.Fatal(err)
- }
- if err = bundle.ValidateResponse("POST", "/api/av/renderAttributeView", payload); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestAVContractMapPublishRedactsPrivateTemplateDependencies(t *testing.T) {
- fixture := setupAttributeViewContextFilterAPITest(t)
- database, view := fixture.attrView, fixture.attrView.Views[0]
- primary := database.GetBlockKeyValues()
- sourceID, publicID, privateID, privateDocID := ast.NewNodeID(), ast.NewNodeID(), ast.NewNodeID(), ast.NewNodeID()
- privateTree := treenode.NewTree(ast.NewNodeID(), "/"+privateDocID+".sy", "/Private", "Private")
- treenode.UpsertBlockTree(privateTree)
- av.UpsertBlockRel(database.ID, fixture.databaseID)
- const privateContent = "private-template-target"
- primary.Values = []*av.Value{
- {ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: sourceID, Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: "Source"}},
- {ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: publicID, Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: "Public"}},
- {ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: privateID, Type: av.KeyTypeBlock, Block: &av.ValueBlock{ID: privateDocID, Content: privateContent}},
- }
- secretKey := av.NewKey(ast.NewNodeID(), "Secret", "", av.KeyTypeRelation)
- secretKey.Relation = &av.Relation{AvID: database.ID}
- publicKey := av.NewKey(ast.NewNodeID(), "Public", "", av.KeyTypeRelation)
- publicKey.Relation = &av.Relation{AvID: database.ID}
- labelKey := av.NewKey(ast.NewNodeID(), "Label", "", av.KeyTypeText)
- selectorKey := av.NewKey(ast.NewNodeID(), "Selector", "", av.KeyTypeText)
- displayKey := av.NewKey(ast.NewNodeID(), "Display", "", av.KeyTypeText)
- displayKey.RenderTemplate = fmt.Sprintf(`.action{getHPathByID %q}`, privateDocID)
- database.KeyValues = []*av.KeyValues{primary,
- {Key: secretKey, Values: []*av.Value{{ID: ast.NewNodeID(), KeyID: secretKey.ID, BlockID: sourceID, Type: av.KeyTypeRelation,
- Relation: &av.ValueRelation{BlockIDs: []string{privateID}}}}},
- {Key: publicKey, Values: []*av.Value{{ID: ast.NewNodeID(), KeyID: publicKey.ID, BlockID: sourceID, Type: av.KeyTypeRelation,
- Relation: &av.ValueRelation{BlockIDs: []string{publicID}}}}},
- {Key: labelKey, Values: []*av.Value{{ID: ast.NewNodeID(), KeyID: labelKey.ID, BlockID: sourceID, Type: av.KeyTypeText, Text: &av.ValueText{Content: "public label"}}}},
- {Key: selectorKey, Values: []*av.Value{{ID: ast.NewNodeID(), KeyID: selectorKey.ID, BlockID: sourceID, Type: av.KeyTypeText, Text: &av.ValueText{Content: secretKey.ID}}}},
- {Key: displayKey, Values: []*av.Value{{ID: ast.NewNodeID(), KeyID: displayKey.ID, BlockID: sourceID, Type: av.KeyTypeText, Text: &av.ValueText{Content: "public scalar"}}}},
- }
- templates := []struct {
- name, content, publicContent, privateMarker string
- key *av.Key
- }{
- {name: "ByName", content: ".action{.Secret_raw.Relation.BlockIDs}", privateMarker: privateID},
- {name: "ByID", content: fmt.Sprintf(`.action{$value := index .id_mod_raw %q}.action{$value.Relation.BlockIDs}`, secretKey.ID), privateMarker: privateID},
- {name: "Indirect", content: ".action{.ByName}", privateMarker: privateID},
- {name: "Range", content: ".action{range .Secret_raw.Relation.BlockIDs}.action{.}.action{end}", privateMarker: privateID},
- {name: "Dynamic", content: ".action{index .id_mod .Selector}", privateMarker: privateContent},
- {name: "Chain", content: fmt.Sprintf(`.action{(index .id_mod_raw %q).Relation.BlockIDs}`, secretKey.ID), privateMarker: privateID},
- {name: "Constant", content: "constant result", publicContent: "constant result"},
- {name: "Local", content: ".action{.Label}", publicContent: "public label"},
- {name: "PublicRelation", content: ".action{.Public_raw.Relation.BlockIDs}", publicContent: "[" + publicID + "]"},
- {name: "StaticID", content: fmt.Sprintf(`.action{index .id_mod %q}`, labelKey.ID), publicContent: "public label"},
- }
- view.LayoutType = av.LayoutTypeMap
- view.Map = &av.LayoutMap{LayoutTable: view.Table}
- view.Table = nil
- view.Map.Columns = nil
- for _, keyValues := range database.KeyValues {
- view.Map.Columns = append(view.Map.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: keyValues.Key.ID}})
- }
- for i := range templates {
- test := &templates[i]
- test.key = av.NewKey(ast.NewNodeID(), test.name, "", av.KeyTypeTemplate)
- test.key.Template = test.content
- database.KeyValues = append(database.KeyValues, &av.KeyValues{Key: test.key})
- view.Map.Columns = append(view.Map.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: test.key.ID}})
- }
- view.ItemIDs = []string{sourceID, publicID, privateID}
- view.Filters = []*av.ViewFilter{{Column: labelKey.ID, Operator: av.FilterOperatorIsEqual,
- Value: &av.Value{Type: av.KeyTypeText, Text: &av.ValueText{Content: "public label"}}}}
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- path := av.GetAttributeViewDataPath(database.ID)
- before, _ := os.ReadFile(path)
- context, _ := gin.CreateTestContext(httptest.NewRecorder())
- context.Request = httptest.NewRequest(http.MethodPost, "/api/av/renderAttributeView", nil)
- filter := func(viewable av.Viewable) av.Viewable {
- return model.FilterAttributeViewByPublishAccess(context, model.PublishAccess{{ID: privateDocID, Disable: true}}, database.ID, "", viewable)
- }
- for _, published := range []bool{false, true} {
- responseFilter := func(viewable av.Viewable) av.Viewable { return viewable }
- if published {
- responseFilter = filter
- }
- response := renderAttrView("", database.ID, view.ID, "", 1, 50, nil, av.LayoutTypeMap, false, false, "", "", responseFilter, true)
- body, err := json.Marshal(response)
- if err != nil {
- t.Fatal(err)
- }
- var result struct {
- Code int
- Data struct{ View *av.Table }
- }
- if err = json.Unmarshal(body, &result); err != nil || result.Code != 0 || result.Data.View == nil || len(result.Data.View.Rows) != 1 {
- t.Fatalf("map template render failed: %s (%v)", body, err)
- }
- row := result.Data.View.Rows[0]
- displayValue := row.GetValue(displayKey.ID)
- if displayValue == nil || displayValue.Text == nil || displayValue.Text.Content != "public scalar" ||
- (published && displayValue.RenderedContent != "") || (!published && displayValue.RenderedContent == "") {
- t.Fatal("map display-template redaction failed or changed the stored scalar")
- }
- for _, test := range templates {
- value := row.GetValue(test.key.ID)
- if value == nil || value.Template == nil {
- t.Fatalf("missing template %s", test.name)
- }
- if !published && test.privateMarker != "" {
- if !bytes.Contains([]byte(value.Template.Content), []byte(test.privateMarker)) {
- t.Fatalf("fixture template %s did not expose its private dependency: %q", test.name, value.Template.Content)
- }
- } else if value.Template.Content != test.publicContent {
- t.Fatalf("template %s published=%t content=%q, want %q", test.name, published, value.Template.Content, test.publicContent)
- }
- }
- if published && (len(row.GetValue(secretKey.ID).Relation.BlockIDs) != 0 || bytes.Contains(body, []byte(privateID)) || bytes.Contains(body, []byte(privateContent))) {
- t.Fatal("map response retained a private relation or derived template value")
- }
- }
- after, _ := os.ReadFile(path)
- if !bytes.Equal(before, after) {
- t.Fatal("map template redaction changed source storage")
- }
-}
-
-func TestAVContractMapPublishPagesAccessibleResult(t *testing.T) {
- for _, scenario := range []struct {
- name string
- count int
- denyEvery int
- }{{"all 120 records accessible", 120, 0}, {"240 accessible records with 120 denied", 360, 3}} {
- t.Run(scenario.name, func(t *testing.T) {
- fixture := setupAttributeViewContextFilterAPITest(t)
- database, view := fixture.attrView, fixture.attrView.Views[0]
- primary := database.GetBlockKeyValues()
- privateID, boxID := ast.NewNodeID(), ast.NewNodeID()
- privateTree := treenode.NewTree(boxID, "/"+privateID+".sy", "/Private", "Private")
- treenode.UpsertBlockTree(privateTree)
- filterKey := av.NewKey(ast.NewNodeID(), "Keep", "", av.KeyTypeText)
- templateKey := av.NewKey(ast.NewNodeID(), "Rendered", "", av.KeyTypeTemplate)
- templateKey.Template = "Rendered record"
- filterValues := &av.KeyValues{Key: filterKey}
- database.KeyValues = append(database.KeyValues, filterValues, &av.KeyValues{Key: templateKey})
- primary.Values = nil
- view.ItemIDs = nil
- visibleIDs := []string{}
- hiddenID := ""
- for i := 0; i <= scenario.count; i++ {
- id := ast.NewNodeID()
- denied := scenario.denyEvery > 0 && i%scenario.denyEvery == 0
- value := &av.Value{ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: id,
- Type: av.KeyTypeBlock, IsDetached: !denied, Block: &av.ValueBlock{Content: fmt.Sprintf("Record %03d", i)}}
- if denied {
- value.Block.ID = privateID
- if i < scenario.count {
- hiddenID = id
- }
- }
- filterText := "keep"
- if i == scenario.count {
- filterText = "skip"
- } else if !denied {
- visibleIDs = append(visibleIDs, id)
- }
- primary.Values = append(primary.Values, value)
- filterValues.Values = append(filterValues.Values, &av.Value{ID: ast.NewNodeID(), KeyID: filterKey.ID, BlockID: id,
- Type: av.KeyTypeText, Text: &av.ValueText{Content: filterText}})
- view.ItemIDs = append(view.ItemIDs, id)
- }
- view.PageSize = 50
- view.Filters = []*av.ViewFilter{{Column: filterKey.ID, Operator: av.FilterOperatorIsEqual,
- Value: &av.Value{Type: av.KeyTypeText, Text: &av.ValueText{Content: "keep"}}}}
- view.LayoutType = av.LayoutTypeMap
- view.Map = &av.LayoutMap{LayoutTable: view.Table}
- view.Table = nil
- view.Map.Columns = []*av.ViewTableColumn{
- {BaseField: &av.BaseField{ID: primary.Key.ID}, Calc: &av.FieldCalc{Operator: av.CalcOperatorCountAll}},
- {BaseField: &av.BaseField{ID: filterKey.ID}},
- {BaseField: &av.BaseField{ID: templateKey.ID}},
- }
- view.GroupCalc = &av.GroupCalc{Field: primary.Key.ID, FieldCalc: &av.FieldCalc{Operator: av.CalcOperatorCountAll}}
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- path := av.GetAttributeViewDataPath(database.ID)
- before, _ := os.ReadFile(path)
- context, _ := gin.CreateTestContext(httptest.NewRecorder())
- context.Request = httptest.NewRequest(http.MethodPost, "/api/av/renderAttributeView", nil)
- filter := func(viewable av.Viewable) av.Viewable {
- return model.FilterAttributeViewByPublishAccess(context, model.PublishAccess{{ID: privateID, Disable: true}}, database.ID, "", viewable)
- }
- render := func(page int, targetID string) (*av.Table, *model.AttributeViewRenderTarget) {
- t.Helper()
- response := renderAttrView("", database.ID, view.ID, "", page, 50, nil, av.LayoutTypeMap, false, false,
- targetID, "", filter, true)
- body, err := json.Marshal(response)
- if err != nil {
- t.Fatal(err)
- }
- var result struct {
- Code int
- Data struct {
- View *av.Table
- Target *model.AttributeViewRenderTarget
- }
- }
- if err = json.Unmarshal(body, &result); err != nil || result.Code != 0 || result.Data.View == nil {
- t.Fatalf("map render failed: %s, %v", body, err)
- }
- mapped := result.Data.View
- if mapped.RowCount != len(visibleIDs) || mapped.GroupCalc != nil || mapped.Columns[0].Calc != nil {
- t.Fatalf("public count or aggregates include denied rows: %s", body)
- }
- for _, row := range mapped.Rows {
- value := row.GetValue(templateKey.ID)
- if value == nil || value.Template == nil || value.Template.Content != "Rendered record" {
- t.Fatal("re-paginated row lost its deferred template value")
- }
- }
- if bytes.Contains(body, []byte("RowsBeforePagination")) {
- t.Fatal("private full row buffer was serialized")
- }
- return mapped, result.Data.Target
- }
- var returnedIDs []string
- for page := 1; page <= (len(visibleIDs)+49)/50+1; page++ {
- mapped, _ := render(page, "")
- start := min(len(visibleIDs), (page-1)*50)
- end := min(len(visibleIDs), start+50)
- if len(mapped.Rows) != end-start {
- t.Fatalf("page %d returned %d rows, want %d", page, len(mapped.Rows), end-start)
- }
- for _, row := range mapped.Rows {
- returnedIDs = append(returnedIDs, row.ID)
- }
- }
- if !reflect.DeepEqual(returnedIDs, visibleIDs) {
- t.Fatal("public pagination skipped or repeated accessible records")
- }
- mapped, target := render(1, visibleIDs[len(visibleIDs)-1])
- if target == nil || target.Status != "visible" || target.Index != len(visibleIDs)-1 ||
- target.Offset != max(0, len(visibleIDs)-av.ViewDefaultPageSize*4) || len(mapped.Rows) > av.ViewDefaultPageSize*4 {
- t.Fatal("public target window used unauthorized row positions or exceeded the ordinary bound")
- }
- if hiddenID != "" {
- mapped, target = render(1, hiddenID)
- if target == nil || target.Status != "itemNotFound" || target.Index != 0 || target.Offset != 0 || len(mapped.Rows) != 50 {
- t.Fatal("denied target exposed its original position or bypassed paging")
- }
- }
- after, _ := os.ReadFile(path)
- if !bytes.Equal(before, after) {
- t.Fatal("public map re-pagination changed source storage")
- }
- })
- }
-}
-
-func TestAVContractMapPublishFiltersTargetsAndPreservesSource(t *testing.T) {
- fixture := setupAttributeViewContextFilterAPITest(t)
- database := fixture.attrView
- view := database.Views[0]
- primary := database.GetBlockKeyValues()
- visibleID, hiddenID := ast.NewNodeID(), ast.NewNodeID()
- primary.Values = nil
- for _, id := range []string{hiddenID, visibleID} {
- primary.Values = append(primary.Values, &av.Value{ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: id,
- Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: id}})
- }
- view.ItemIDs = []string{hiddenID, visibleID}
- view.LayoutType = av.LayoutTypeMap
- view.Map = &av.LayoutMap{LayoutTable: view.Table, Settings: av.MapSettings{LocationKeyID: ast.NewNodeID(), Height: 800}}
- view.Table = nil
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- path := av.GetAttributeViewDataPath(database.ID)
- before, _ := os.ReadFile(path)
- filter := func(viewable av.Viewable) av.Viewable {
- mapped := viewable.(*av.Map)
- rows := []*av.TableRow{}
- for _, row := range mapped.Rows {
- if row.ID != hiddenID {
- rows = append(rows, row)
- }
- }
- mapped.Rows = rows
- return mapped
- }
- for _, targetID := range []string{hiddenID, visibleID} {
- response := renderAttrView("", database.ID, view.ID, "", 1, 1, nil, av.LayoutTypeMap, false, false,
- targetID, "", filter, true)
- body, err := json.Marshal(response)
- if err != nil {
- t.Fatal(err)
- }
- var result struct {
- Code int
- Data struct {
- View *av.Table
- Target *model.AttributeViewRenderTarget
- }
- }
- if err = json.Unmarshal(body, &result); err != nil {
- t.Fatal(err)
- }
- want := "visible"
- if targetID == hiddenID {
- want = "itemNotFound"
- }
- if result.Code != 0 || result.Data.View.RowCount != 1 || len(result.Data.View.Rows) != 1 ||
- result.Data.Target.Status != want || result.Data.Target.Index != 0 || result.Data.Target.Offset != 0 {
- t.Fatalf("publish leaked map count or target: %s", body)
- }
- if result.Data.View.Map == nil || result.Data.View.Map.Height != 800 {
- t.Fatalf("publish lost map height: %s", body)
- }
- }
- after, _ := os.ReadFile(path)
- if !bytes.Equal(before, after) {
- t.Fatal("read-only map render changed its source")
- }
-}
diff --git a/kernel/api/contract_av_map_unplaced_test.go b/kernel/api/contract_av_map_unplaced_test.go
deleted file mode 100644
index 437768e952..0000000000
--- a/kernel/api/contract_av_map_unplaced_test.go
+++ /dev/null
@@ -1,356 +0,0 @@
-package api
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "net/http"
- "net/http/httptest"
- "os"
- "path/filepath"
- "testing"
-
- "github.com/88250/lute/ast"
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/cache"
- "github.com/siyuan-note/siyuan/kernel/model"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-const mapUnplacedPath = "/api/av/getAttributeViewMapUnplaced"
-
-func setupMapUnplacedContractTest(t *testing.T, count int) (*attributeViewContextFilterAPIFixture, *av.Key, []string) {
- t.Helper()
- fixture := setupAttributeViewContextFilterAPITest(t)
- database, view := fixture.attrView, fixture.attrView.Views[0]
- primary := database.GetBlockKeyValues()
- key := av.NewKey(ast.NewNodeID(), "Location", "", av.KeyTypeLocation)
- locations := &av.KeyValues{Key: key}
- zero, latitude, longitude, polar := 0.0, 25.04, 102.42, 90.0
- for index := 0; index < count+3; index++ {
- id := ast.NewNodeID()
- view.ItemIDs = append(view.ItemIDs, id)
- primary.Values = append(primary.Values, &av.Value{ID: ast.NewNodeID(), KeyID: primary.Key.ID,
- BlockID: id, Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: fmt.Sprintf("Plan %03d", index)}})
- location := &av.ValueLocation{}
- switch index {
- case count:
- location = &av.ValueLocation{Latitude: &zero, Longitude: &zero}
- case count + 1:
- location = &av.ValueLocation{Latitude: &latitude, Longitude: &longitude}
- case count + 2:
- location = &av.ValueLocation{Latitude: &polar, Longitude: &zero}
- default:
- if index%2 == 1 {
- location.Name = "Name without coordinates"
- }
- }
- // 缺省值由渲染补齐,必须也能在返回页中编辑。
- if index != 0 {
- locations.Values = append(locations.Values, &av.Value{ID: ast.NewNodeID(), KeyID: key.ID,
- BlockID: id, Type: av.KeyTypeLocation, Location: location})
- }
- }
- database.KeyValues = append(database.KeyValues, locations)
- view.LayoutType, view.PageSize = av.LayoutTypeMap, 2
- view.Map = &av.LayoutMap{LayoutTable: view.Table, Settings: av.MapSettings{LocationKeyID: key.ID}}
- view.Table = nil
- view.Map.Columns = append(view.Map.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: key.ID, Hidden: true}})
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- return fixture, key, view.ItemIDs[:count]
-}
-
-func callMapUnplacedContractTest(t *testing.T, database *av.AttributeView, options map[string]any) ([]*av.TableRow, int) {
- t.Helper()
- request := map[string]any{"id": database.ID, "viewID": database.Views[0].ID}
- for key, value := range options {
- request[key] = value
- }
- response := callAttributeViewContextFilterAPI(t, mapUnplacedPath, request, getAttributeViewMapUnplaced)
- requireAPIContract(t, http.MethodPost, mapUnplacedPath, response)
- var result struct {
- Code int
- Data struct {
- Rows []*av.TableRow
- Total int
- }
- }
- decodeAttributeViewContextFilterAPIResponse(t, response, &result)
- if result.Code != 0 {
- t.Fatalf("unplaced request failed: %s", response.Body.String())
- }
- return result.Data.Rows, result.Data.Total
-}
-
-func TestAVContractMapUnplacedPagination(t *testing.T) {
- fixture, key, ids := setupMapUnplacedContractTest(t, 105)
- database := fixture.attrView
- file := av.GetAttributeViewDataPath(database.ID)
- before, err := os.ReadFile(file)
- if err != nil {
- t.Fatal(err)
- }
- for _, test := range []struct {
- name string
- options map[string]any
- start int
- count int
- }{
- {"default", nil, 0, 50},
- {"second", map[string]any{"page": 2}, 50, 50},
- {"last", map[string]any{"page": 3}, 100, 5},
- {"beyond", map[string]any{"page": 4}, 0, 0},
- {"large page", map[string]any{"page": 1e9}, 0, 0},
- {"count", map[string]any{"pageSize": 1}, 0, 1},
- {"invalid bounds", map[string]any{"page": -1, "pageSize": 0}, 0, 50},
- {"maximum", map[string]any{"pageSize": 1000}, 0, 100},
- {"fractional", map[string]any{"page": 2.9, "pageSize": 1.9}, 1, 1},
- {"fractional bounds", map[string]any{"page": -0.9, "pageSize": 0.9}, 0, 50},
- {"null", map[string]any{"page": nil, "pageSize": nil}, 0, 50},
- } {
- t.Run(test.name, func(t *testing.T) {
- rows, total := callMapUnplacedContractTest(t, database, test.options)
- if total != len(ids) || rows == nil || len(rows) != test.count {
- t.Fatalf("unexpected page: total %d, rows %d", total, len(rows))
- }
- for index, row := range rows {
- if row.ID != ids[test.start+index] {
- t.Fatalf("page skipped or repeated rows: got %s, want %s", row.ID, ids[test.start+index])
- }
- if value := row.GetValue(key.ID); value == nil || value.Type != av.KeyTypeLocation || value.Location == nil {
- t.Fatalf("hidden location cell is not editable: %+v", row)
- }
- if value := row.GetValue(database.GetBlockKeyValues().Key.ID); value == nil || value.Block == nil {
- t.Fatal("primary cell is missing")
- }
- }
- })
- }
- after, err := os.ReadFile(file)
- if err != nil || !bytes.Equal(before, after) {
- t.Fatalf("unplaced query changed its source: %v", err)
- }
- view, _, _, err := model.RenderAttributeViewWithTargetReadOnly("", database.ID, database.Views[0].ID, "", 1, -1, nil, "", false, false, "", "")
- if err != nil || len(view.(*av.Map).Rows) != 2 || view.(*av.Map).PageSize != 2 {
- t.Fatalf("unplaced query changed map pagination: %v", err)
- }
-}
-
-func TestAVContractMapUnplacedFiltersAndBinding(t *testing.T) {
- fixture, key, ids := setupMapUnplacedContractTest(t, 6)
- database, view := fixture.attrView, fixture.attrView.Views[0]
- for _, test := range []struct {
- options map[string]any
- want []string
- }{
- {map[string]any{"query": "Plan", "search": " PLAN 005 "}, ids[5:6]},
- {map[string]any{"query": "004", "search": "Plan"}, ids[4:5]},
- {map[string]any{"query": "004", "search": "005"}, nil},
- {map[string]any{"blockID": fixture.databaseID}, nil},
- } {
- rows, total := callMapUnplacedContractTest(t, database, test.options)
- if total != len(test.want) || len(rows) != len(test.want) {
- t.Fatalf("filter or search was bypassed: %+v, total %d", test.options, total)
- }
- for index, row := range rows {
- if row.ID != test.want[index] {
- t.Fatalf("wrong filtered row: %s", row.ID)
- }
- }
- }
- view.Sorts = []*av.ViewSort{{Column: database.GetBlockKeyValues().Key.ID, Order: av.SortOrderDesc}}
- view.Filters = []*av.ViewFilter{{Column: database.GetBlockKeyValues().Key.ID, Operator: av.FilterOperatorContains,
- Value: &av.Value{Type: av.KeyTypeBlock, Block: &av.ValueBlock{Content: "Plan 00"}}}}
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- rows, total := callMapUnplacedContractTest(t, database, map[string]any{"pageSize": 1, "page": 2})
- if total != len(ids) || len(rows) != 1 || rows[0].ID != ids[4] {
- t.Fatalf("sort was not applied before unplaced pagination: %+v", rows)
- }
- view.Filters[0].Value.Block.Content = "Plan 004"
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- rows, total = callMapUnplacedContractTest(t, database, nil)
- if total != 1 || len(rows) != 1 || rows[0].ID != ids[4] {
- t.Fatal("saved view filter was bypassed")
- }
- view.Filters = nil
- other := av.NewKey(ast.NewNodeID(), "Second location", "", av.KeyTypeLocation)
- zero := 0.0
- values := &av.KeyValues{Key: other}
- for _, id := range view.ItemIDs {
- values.Values = append(values.Values, &av.Value{ID: ast.NewNodeID(), KeyID: other.ID, BlockID: id,
- Type: av.KeyTypeLocation, Location: &av.ValueLocation{Latitude: &zero, Longitude: &zero}})
- }
- database.KeyValues = append(database.KeyValues, values)
- view.Map.Columns = append(view.Map.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: other.ID}})
- for _, test := range []struct {
- binding string
- total int
- }{
- {"", len(ids)}, {key.ID, len(ids)}, {other.ID, 0}, {ast.NewNodeID(), 0}, {database.GetBlockKeyValues().Key.ID, 0},
- } {
- view.Map.Settings.LocationKeyID = test.binding
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- before, err := os.ReadFile(av.GetAttributeViewDataPath(database.ID))
- if err != nil {
- t.Fatal(err)
- }
- _, total = callMapUnplacedContractTest(t, database, nil)
- if total != test.total {
- t.Fatalf("wrong location binding %q: %d", test.binding, total)
- }
- after, err := os.ReadFile(av.GetAttributeViewDataPath(database.ID))
- if err != nil || !bytes.Equal(before, after) {
- t.Fatal("binding query persisted a derived or repaired location field")
- }
- }
- // 列顺序优先于数据库字段顺序;空绑定不得仍使用旧的首个位置字段。
- view.Map.Settings.LocationKeyID = ""
- columns := view.Map.Columns
- columns[len(columns)-2], columns[len(columns)-1] = columns[len(columns)-1], columns[len(columns)-2]
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- if _, total = callMapUnplacedContractTest(t, database, nil); total != 0 {
- t.Fatal("default binding ignored view column order")
- }
-}
-
-func TestAVContractMapUnplacedRejectsCorruptLocations(t *testing.T) {
- fixture, key, _ := setupMapUnplacedContractTest(t, 2)
- database := fixture.attrView
- for _, location := range []any{
- map[string]any{"latitude": 0}, map[string]any{"latitude": 91, "longitude": 0},
- map[string]any{"latitude": 0, "longitude": 181}, map[string]any{"coordinateSystem": "WGS84"},
- map[string]any{"crs": "gcj02", "name": "invalid"}, []any{},
- } {
- t.Run(fmt.Sprintf("%v", location), func(t *testing.T) {
- data, err := json.Marshal(database)
- if err != nil {
- t.Fatal(err)
- }
- var source map[string]any
- if err = json.Unmarshal(data, &source); err != nil {
- t.Fatal(err)
- }
- for _, entry := range source["keyValues"].([]any) {
- values := entry.(map[string]any)
- if values["key"].(map[string]any)["id"] == key.ID {
- values["values"].([]any)[0].(map[string]any)["location"] = location
- }
- }
- data, err = json.Marshal(source)
- if err != nil {
- t.Fatal(err)
- }
- file := av.GetAttributeViewDataPath(database.ID)
- if err = os.WriteFile(file, data, 0644); err != nil {
- t.Fatal(err)
- }
- cache.ClearAVCache()
- response := callAttributeViewContextFilterAPI(t, mapUnplacedPath, map[string]any{
- "id": database.ID, "viewID": database.Views[0].ID,
- }, getAttributeViewMapUnplaced)
- requireAPIContract(t, http.MethodPost, mapUnplacedPath, response)
- var result struct{ Code int }
- decodeAttributeViewContextFilterAPIResponse(t, response, &result)
- if result.Code != -1 {
- t.Fatalf("corrupt location was silently ignored: %s", response.Body.String())
- }
- after, err := os.ReadFile(file)
- if err != nil || !bytes.Equal(data, after) {
- t.Fatal("corrupt source was changed")
- }
- })
- }
-}
-
-func TestAVContractMapUnplacedAuthorization(t *testing.T) {
- setupAttributeViewContextFilterAPITest(t)
- previousReadonly := util.ReadOnly
- t.Cleanup(func() { util.ReadOnly = previousReadonly })
- for _, test := range []struct {
- role model.Role
- readonly bool
- status int
- }{
- {model.RoleReader, false, http.StatusForbidden},
- {model.RoleEditor, false, http.StatusForbidden},
- {model.RoleAdministrator, true, http.StatusOK},
- } {
- util.ReadOnly = test.readonly
- engine := gin.New()
- engine.Use(func(c *gin.Context) { c.Set(model.RoleContextKey, test.role); c.Next() })
- registerAvRoutes(engine)
- response := httptest.NewRecorder()
- request := httptest.NewRequest(http.MethodPost, mapUnplacedPath, nil)
- request.Body = aiUnreadBody{t: t}
- engine.ServeHTTP(response, request)
- if response.Code != test.status {
- t.Fatalf("unplaced query permission changed: %d %s", response.Code, response.Body.String())
- }
- if test.readonly {
- requireAPIContract(t, http.MethodPost, mapUnplacedPath, response)
- var result struct{ Code int }
- decodeAttributeViewContextFilterAPIResponse(t, response, &result)
- if result.Code != -1 {
- t.Fatalf("read-only request reached handler: %s", response.Body.String())
- }
- }
- }
-}
-
-func TestAVContractMapUnplacedReadBoundaries(t *testing.T) {
- fixture, _, _ := setupMapUnplacedContractTest(t, 1)
- database, view := fixture.attrView, fixture.attrView.Views[0]
- assertFailure := func(id, viewID string) {
- t.Helper()
- response := callAttributeViewContextFilterAPI(t, mapUnplacedPath, map[string]any{
- "id": id, "viewID": viewID,
- }, getAttributeViewMapUnplaced)
- requireAPIContract(t, http.MethodPost, mapUnplacedPath, response)
- var result struct{ Code int }
- decodeAttributeViewContextFilterAPIResponse(t, response, &result)
- if result.Code != -1 {
- t.Fatalf("invalid map read was accepted: %s", response.Body.String())
- }
- }
- view.LayoutType, view.Table, view.Map = av.LayoutTypeTable, view.Map.LayoutTable, nil
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- assertFailure(database.ID, view.ID)
- missingID := ast.NewNodeID()
- assertFailure(missingID, view.ID)
- if _, err := os.Stat(av.GetAttributeViewDataPath(missingID)); !os.IsNotExist(err) {
- t.Fatalf("unplaced query created a missing database: %v", err)
- }
-
- boxID, encryptedID := ast.NewNodeID(), ast.NewNodeID()
- oldEncryptedBoxIDs := av.AVEncryptedBoxIDs
- av.AVEncryptedBoxIDs = func() []string { return []string{boxID} }
- t.Cleanup(func() { av.AVEncryptedBoxIDs = oldEncryptedBoxIDs })
- file := filepath.Join(util.DataDir, boxID, "storage", "av", encryptedID+".json")
- configuration := filepath.Join(util.DataDir, boxID, ".siyuan", "conf.json")
- for target, content := range map[string]string{file: "locked ciphertext", configuration: `{"encrypted":true}`} {
- if err := os.MkdirAll(filepath.Dir(target), 0755); err != nil {
- t.Fatal(err)
- }
- if err := os.WriteFile(target, []byte(content), 0644); err != nil {
- t.Fatal(err)
- }
- }
- assertFailure(encryptedID, view.ID)
- after, err := os.ReadFile(file)
- if err != nil || string(after) != "locked ciphertext" {
- t.Fatalf("locked source was changed: %v", err)
- }
-}
diff --git a/kernel/api/contract_av_retired_map_test.go b/kernel/api/contract_av_retired_map_test.go
new file mode 100644
index 0000000000..fd97fa6290
--- /dev/null
+++ b/kernel/api/contract_av_retired_map_test.go
@@ -0,0 +1,120 @@
+package api
+
+import (
+ "bytes"
+ "encoding/json"
+ "net/http"
+ "os"
+ "reflect"
+ "testing"
+
+ "github.com/88250/lute/ast"
+ "github.com/gin-gonic/gin"
+ "github.com/siyuan-note/siyuan/kernel/av"
+ "github.com/siyuan-note/siyuan/kernel/cache"
+)
+
+func TestAVContractRetiredMapRoutesAbsent(t *testing.T) {
+ engine := gin.New()
+ ServeAPI(engine)
+ for _, route := range engine.Routes() {
+ if route.Path == "/api/map/getRuntime" || route.Path == "/api/av/getAttributeViewMapUnplaced" {
+ t.Fatalf("retired map handler still registered: %s", route.Path)
+ }
+ }
+}
+
+func TestAVContractRetiredMapRendersTableWithLocation(t *testing.T) {
+ fixture := setupAttributeViewContextFilterAPITest(t)
+ database := fixture.attrView
+ view := database.Views[0]
+ itemID := ast.NewNodeID()
+ key := av.NewKey(ast.NewNodeID(), "Location", "", av.KeyTypeLocation)
+ zero, longitude := 0.0, 120.0
+ primary := database.GetBlockKeyValues()
+ primary.Values = []*av.Value{{ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: itemID,
+ Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: "Office"}}}
+ database.KeyValues = append(database.KeyValues, &av.KeyValues{Key: key, Values: []*av.Value{{
+ ID: ast.NewNodeID(), KeyID: key.ID, BlockID: itemID, Type: av.KeyTypeLocation,
+ Location: &av.ValueLocation{Name: "Office", Latitude: &zero, Longitude: &longitude, OriginalInput: "120,0"},
+ }}})
+ view.ItemIDs = []string{itemID}
+ view.Filters = nil
+ view.Table.Columns = []*av.ViewTableColumn{
+ {BaseField: &av.BaseField{ID: primary.Key.ID}}, {BaseField: &av.BaseField{ID: key.ID}},
+ }
+ if err := av.SaveAttributeView(database); err != nil {
+ t.Fatal(err)
+ }
+ legacy, err := json.Marshal(struct {
+ *av.LayoutTable
+ Settings map[string]any `json:"settings"`
+ }{view.Table, map[string]any{"locationKeyID": key.ID, "height": 640, "unknown": "preserve"}})
+ if err != nil {
+ t.Fatal(err)
+ }
+ view.LegacyMap, view.Table, view.LayoutType = legacy, nil, "map"
+ input, err := json.Marshal(database)
+ if err != nil {
+ t.Fatal(err)
+ }
+ file := av.GetAttributeViewDataPath(database.ID)
+ if err = os.WriteFile(file, input, 0644); err != nil {
+ t.Fatal(err)
+ }
+ cache.ClearAVCache()
+ response := renderAttrView("", database.ID, view.ID, "", 1, 50, nil, "", false, false, "", "", func(view av.Viewable) av.Viewable { return view }, false)
+ data, err := json.Marshal(response)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var result struct {
+ Code int
+ Data struct {
+ ViewType string
+ View *av.Table
+ }
+ }
+ if err = json.Unmarshal(data, &result); err != nil {
+ t.Fatal(err)
+ }
+ if result.Code != 0 || result.Data.ViewType != "table" || result.Data.View == nil || len(result.Data.View.Rows) != 1 {
+ t.Fatalf("legacy map did not render records as a table: %s", data)
+ }
+ location := result.Data.View.Rows[0].GetValue(key.ID).Location
+ if location == nil || location.Name != "Office" || *location.Latitude != zero || *location.Longitude != longitude || location.OriginalInput != "120,0" {
+ t.Fatalf("location field changed: %+v", location)
+ }
+ for _, forbidden := range [][]byte{[]byte(`"map":`), []byte(`"mapMarkerScope":`), []byte(`"type":"map"`)} {
+ if bytes.Contains(data, forbidden) {
+ t.Fatalf("retired map configuration leaked into response: %s", data)
+ }
+ }
+ after, err := os.ReadFile(file)
+ if err != nil || !bytes.Equal(after, input) {
+ t.Fatal("read-only rendering rewrote the legacy source")
+ }
+ stored, err := av.ParseAttributeView(database.ID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err = av.SaveAttributeView(stored); err != nil {
+ t.Fatal(err)
+ }
+ cache.ClearAVCache()
+ stored, err = av.ParseAttributeView(database.ID)
+ if err != nil {
+ t.Fatalf("save lost legacy map configuration: %v", err)
+ }
+ var beforeLegacy, afterLegacy any
+ if err = json.Unmarshal(legacy, &beforeLegacy); err != nil {
+ t.Fatal(err)
+ }
+ if err = json.Unmarshal(stored.Views[0].LegacyMap, &afterLegacy); err != nil || !reflect.DeepEqual(beforeLegacy, afterLegacy) {
+ t.Fatalf("save changed legacy map settings: %v", err)
+ }
+ // 除只读渲染外,同时覆盖注册的 HTTP 适配器。
+ path := "/api/av/renderAttributeView"
+ httpResponse := callAttributeViewContextFilterAPI(t, path, map[string]any{"id": database.ID, "viewID": view.ID}, renderAttributeView)
+ requireAPIContract(t, http.MethodPost, path, httpResponse)
+}
diff --git a/kernel/api/map.go b/kernel/api/map.go
deleted file mode 100644
index c4eb5495c2..0000000000
--- a/kernel/api/map.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package api
-
-import (
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/apicontract"
- "github.com/siyuan-note/siyuan/kernel/model"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-var getMapRuntime = contractHandler(apicontract.MapGetRuntime, func(c *gin.Context, request apicontract.EmptyRequest) apicontract.Response[*apicontract.MapRuntime] {
- return apicontract.Success(&apicontract.MapRuntime{Provider: "openfreemap"})
-}, mapRuntimeAdmission)
-
-// 内置底图保留独立准入检查,不向发布页或绕过鉴权的进程开放地图宿主。
-func mapRuntimeAdmission(c *gin.Context) *apicontract.Response[*apicontract.MapRuntime] {
- c.Header("Cache-Control", "no-store")
- c.Header("Pragma", "no-cache")
- if !model.IsAdminRoleContext(c) {
- response := apicontract.Failure[*apicontract.MapRuntime](-1, "administrator access required")
- return &response
- }
- if util.SiYuanAccessAuthCodeBypass {
- response := apicontract.Failure[*apicontract.MapRuntime](-1, "mapAuthenticationBypass")
- return &response
- }
- return nil
-}
diff --git a/kernel/api/map_test.go b/kernel/api/map_test.go
deleted file mode 100644
index 90f51f4784..0000000000
--- a/kernel/api/map_test.go
+++ /dev/null
@@ -1,238 +0,0 @@
-package api
-
-import (
- archivezip "archive/zip"
- "bytes"
- "encoding/json"
- "io"
- "net/http"
- "net/http/httptest"
- "os"
- "path/filepath"
- "strings"
- "testing"
-
- ginSessions "github.com/gin-contrib/sessions"
- "github.com/gin-contrib/sessions/cookie"
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/apicontract"
- "github.com/siyuan-note/siyuan/kernel/conf"
- "github.com/siyuan-note/siyuan/kernel/model"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-func setupMapAPI(t *testing.T, role model.Role, guard bool) *gin.Engine {
- t.Helper()
- oldConf, oldConfDir, oldReadonly, oldTemp := model.Conf, util.ConfDir, util.ReadOnly, util.TempDir
- oldBypass := util.SiYuanAccessAuthCodeBypass
- util.SiYuanAccessAuthCodeBypass = false
- model.Conf = model.NewAppConf()
- model.Conf.AccessAuthCode = "test-password"
- model.Conf.Api = &conf.API{Token: "map-test-api-token"}
- model.Conf.Sync = &conf.Sync{Enabled: true, Provider: 1}
- model.Conf.System = &conf.System{}
- util.ConfDir, util.ReadOnly, util.TempDir = t.TempDir(), false, t.TempDir()
- t.Cleanup(func() {
- model.Conf, util.ConfDir, util.ReadOnly, util.TempDir = oldConf, oldConfDir, oldReadonly, oldTemp
- util.SiYuanAccessAuthCodeBypass = oldBypass
- })
- gin.SetMode(gin.TestMode)
- engine := gin.New()
- engine.Use(ginSessions.Sessions("map-api-test", cookie.NewStore([]byte("map-api-test-session-key"))))
- engine.Use(func(c *gin.Context) { c.Set(model.RoleContextKey, role); c.Next() })
- if guard {
- engine.POST("/api/map/getRuntime", contractRouteHandlers(apicontract.MapGetRuntime, getMapRuntime)...)
- } else {
- engine.POST("/api/map/getRuntime", getMapRuntime)
- }
- engine.POST("/api/system/getConf", getConf)
- engine.POST("/api/system/exportConf", exportConf)
- return engine
-}
-
-func callMapAPI(t *testing.T, engine *gin.Engine, path, body string) *httptest.ResponseRecorder {
- t.Helper()
- request := httptest.NewRequest(http.MethodPost, "https://notes.example.com"+path, strings.NewReader(body))
- request.Header.Set("Content-Type", "application/json")
- request.RemoteAddr = "192.0.2.30:12345"
- response := httptest.NewRecorder()
- engine.ServeHTTP(response, request)
- if response.Code == http.StatusOK {
- requireAPIContract(t, http.MethodPost, path, response)
- }
- return response
-}
-
-func mapResponseCode(t *testing.T, response *httptest.ResponseRecorder) int {
- t.Helper()
- var result struct{ Code int }
- if err := json.Unmarshal(response.Body.Bytes(), &result); err != nil {
- t.Fatal(err)
- }
- return result.Code
-}
-
-func TestAPIContractMapBuiltinRuntimeDoesNotReadOrWriteSettings(t *testing.T) {
- engine := setupMapAPI(t, model.RoleAdministrator, true)
- source := []byte(`{"map":{"services":[{"provider":"amap","apiKey":"obsolete-map-private-key","securityCode":"obsolete-map-private-code"}]}}`)
- path := filepath.Join(util.ConfDir, "conf.json")
- if err := os.WriteFile(path, source, 0600); err != nil {
- t.Fatal(err)
- }
- if err := json.Unmarshal(source, model.Conf); err != nil {
- t.Fatal(err)
- }
- for _, readonly := range []bool{false, true} {
- util.ReadOnly = readonly
- for _, body := range []string{"", `{}`} {
- response := callMapAPI(t, engine, "/api/map/getRuntime", body)
- var result struct{ Data map[string]any }
- if mapResponseCode(t, response) != 0 || json.Unmarshal(response.Body.Bytes(), &result) != nil ||
- len(result.Data) != 1 || result.Data["provider"] != "openfreemap" ||
- response.Header().Get("Cache-Control") != "no-store" || response.Header().Get("Pragma") != "no-cache" {
- t.Fatalf("unexpected built-in runtime: %s", response.Body.String())
- }
- }
- }
- after, err := os.ReadFile(path)
- if err != nil || !bytes.Equal(source, after) {
- t.Fatal("runtime modified the settings file")
- }
- for _, path := range []string{"/api/map/getConf", "/api/map/setConf"} {
- response := callMapAPI(t, engine, path, `{}`)
- if response.Code != http.StatusNotFound {
- t.Fatalf("removed configuration route remained active: %s", path)
- }
- }
- definitions := apicontract.Definitions()
- for _, definition := range definitions {
- if definition.Path == "/api/map/getConf" || definition.Path == "/api/map/setConf" {
- t.Fatal("removed configuration route remained in API declarations")
- }
- }
-}
-
-func TestAPIContractMapDeniesReadersAndPublish(t *testing.T) {
- for _, role := range []model.Role{model.RoleEditor, model.RoleReader, model.RoleVisitor} {
- for _, guard := range []bool{false, true} {
- engine := setupMapAPI(t, role, guard)
- response := callMapAPI(t, engine, "/api/map/getRuntime", `{}`)
- if response.Code == http.StatusOK && mapResponseCode(t, response) == 0 {
- t.Fatal("non-administrator accessed the map runtime")
- }
- if guard && role != model.RoleVisitor && response.Code != http.StatusForbidden {
- t.Fatalf("route did not enforce administrator middleware: %d", response.Code)
- }
- if !guard && response.Header().Get("Cache-Control") != "no-store" {
- t.Fatal("admission response allowed caching")
- }
- }
- }
-}
-
-func TestAPIContractMapGetConfAndExportHaveNoSettings(t *testing.T) {
- for _, role := range []model.Role{model.RoleAdministrator, model.RoleReader} {
- engine := setupMapAPI(t, role, true)
- if err := json.Unmarshal([]byte(`{"map":{"services":[{"apiKey":"obsolete-map-private-key"}]}}`), model.Conf); err != nil {
- t.Fatal(err)
- }
- response := callMapAPI(t, engine, "/api/system/getConf", `{}`)
- var result struct {
- Data struct{ Conf map[string]json.RawMessage }
- }
- if mapResponseCode(t, response) != 0 || json.Unmarshal(response.Body.Bytes(), &result) != nil || result.Data.Conf["map"] != nil ||
- strings.Contains(response.Body.String(), "obsolete-map-private-key") {
- t.Fatal("system configuration exposed removed map settings")
- }
- }
- engine := setupMapAPI(t, model.RoleAdministrator, true)
- model.Conf.UserData = "export-map-private-user"
- model.Conf.CookieKey = "export-map-private-cookie"
- model.Conf.MCPOAuth = "export-map-private-oauth"
- before, _ := json.Marshal(model.Conf)
- response := callMapAPI(t, engine, "/api/system/exportConf", `{}`)
- var result struct {
- Data apicontract.SystemExportConfData
- }
- if mapResponseCode(t, response) != 0 || json.Unmarshal(response.Body.Bytes(), &result) != nil {
- t.Fatal("configuration export failed")
- }
- archive, err := archivezip.OpenReader(filepath.Join(util.TempDir, "export", result.Data.Name+".zip"))
- if err != nil {
- t.Fatal(err)
- }
- defer archive.Close()
- for _, entry := range archive.File {
- file, err := entry.Open()
- if err != nil {
- t.Fatal(err)
- }
- data, err := io.ReadAll(file)
- file.Close()
- if err != nil || bytes.Contains(data, []byte("export-map-private-")) {
- t.Fatal("exported private configuration")
- }
- var exported map[string]json.RawMessage
- if err = json.Unmarshal(data, &exported); err != nil || exported["map"] != nil {
- t.Fatal("exported map settings")
- }
- }
- after, _ := json.Marshal(model.Conf)
- if !bytes.Equal(before, after) {
- t.Fatal("export altered active configuration")
- }
-}
-
-func TestAPIContractMapRuntimeDisabledWithAuthBypass(t *testing.T) {
- for _, guard := range []bool{false, true} {
- engine := setupMapAPI(t, model.RoleAdministrator, guard)
- util.SiYuanAccessAuthCodeBypass = true
- for _, password := range []string{"", "test-password"} {
- model.Conf.AccessAuthCode = password
- response := callMapAPI(t, engine, "/api/map/getRuntime", `{}`)
- if mapResponseCode(t, response) == 0 || !strings.Contains(response.Body.String(), "mapAuthenticationBypass") ||
- response.Header().Get("Cache-Control") != "no-store" {
- t.Fatal("auth bypass mode enabled the map runtime")
- }
- }
- }
-}
-
-func TestAPIContractMapOpaqueOriginCannotReadKernelData(t *testing.T) {
- engine := setupMapAPI(t, model.RoleVisitor, true)
- engine.POST("/test-private-data", model.CheckAuth, func(c *gin.Context) { c.String(200, "private-note-fixture") })
- engine.GET("/test-login", func(c *gin.Context) {
- session := util.GetSession(c)
- util.GetWorkspaceSession(session).AccessAuthCode = "test-password"
- if err := session.Save(c); err != nil {
- t.Error(err)
- }
- c.Status(200)
- })
- login := httptest.NewRecorder()
- engine.ServeHTTP(login, httptest.NewRequest(http.MethodGet, "http://localhost:6806/test-login", nil))
- for _, password := range []string{"", "test-password"} {
- model.Conf.AccessAuthCode = password
- for _, site := range []string{"", "cross-site", "same-site"} {
- for _, path := range []string{"/test-private-data", "/api/map/getRuntime"} {
- request := httptest.NewRequest(http.MethodPost, "http://localhost:6806"+path, strings.NewReader(`{}`))
- request.RemoteAddr = "127.0.0.1:12345"
- request.Header.Set("Content-Type", "application/json")
- request.Header.Set("Origin", "null")
- request.Header.Set("Sec-Fetch-Site", site)
- if util.IsSessionOriginAllowedRequest(request) {
- t.Fatal("WebSocket/session origin validator admitted an opaque origin")
- }
- // 即使浏览器附带已有登录 Cookie,也不能越过 Origin 校验。
- for _, cookie := range login.Result().Cookies() {
- request.AddCookie(cookie)
- }
- response := httptest.NewRecorder()
- engine.ServeHTTP(response, request)
- if response.Code != http.StatusUnauthorized || strings.Contains(response.Body.String(), "private-note-fixture") || strings.Contains(response.Body.String(), "map-api-") {
- t.Fatalf("opaque-origin request read kernel data: passworded=%t, fetch-site=%q, path=%s", password != "", site, path)
- }
- }
- }
- }
-}
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 923d501763..193ecf04a0 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -25,7 +25,6 @@ import (
)
func ServeAPI(ginServer *gin.Engine) {
- ginServer.Handle("POST", "/api/map/getRuntime", contractRouteHandlers(apicontract.MapGetRuntime, getMapRuntime)...)
ginServer.Use(boxLeaseMiddleware)
registerOauthRoutes(ginServer)
registerMcpRoutes(ginServer)
@@ -854,7 +853,6 @@ func registerSnippetRoutes(ginServer *gin.Engine) {
func registerAvRoutes(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/av/renderAttributeView", contractRouteHandlers(apicontract.RenderAttributeView, renderAttributeView)...)
ginServer.Handle("POST", "/api/av/getAttributeViewCalendarUndated", contractRouteHandlers(apicontract.GetAttributeViewCalendarUndated, getAttributeViewCalendarUndated)...)
- ginServer.Handle("POST", "/api/av/getAttributeViewMapUnplaced", contractRouteHandlers(apicontract.GetAttributeViewMapUnplaced, getAttributeViewMapUnplaced)...)
ginServer.Handle("POST", "/api/av/getAttributeViewItemStatuses", contractRouteHandlers(apicontract.GetAttributeViewItemStatuses, getAttributeViewItemStatuses)...)
ginServer.Handle("POST", "/api/av/renderHistoryAttributeView", contractRouteHandlers(apicontract.RenderHistoryAttributeView, renderHistoryAttributeView)...)
ginServer.Handle("POST", "/api/av/renderSnapshotAttributeView", contractRouteHandlers(apicontract.RenderSnapshotAttributeView, renderSnapshotAttributeView)...)
diff --git a/kernel/apicontract/av_map.go b/kernel/apicontract/av_map.go
deleted file mode 100644
index 55e22ed534..0000000000
--- a/kernel/apicontract/av_map.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package apicontract
-
-// AVMapHeight 是按视图保存的地图高度档位,单位为 CSS px。
-type AVMapHeight int
-
-// AVMapSettings 是 setAttrViewMap 事务的完整设置和地图渲染响应中的设置。
-// 地图只显示本次返回行页的标记,沿用普通视图的筛选、排序和分页。
-// 分组设置保留但不参与地图渲染;普通导出和发布展示记录,不加载地图服务。
-// 交互地图固定使用内置 OpenFreeMap,位置值使用 WGS84。
-type AVMapSettings struct {
- // 位置字段 ID;空字符串按视图顺序派生首个位置字段,不写回设置。显式字段缺失或类型变化时保留绑定,记录仍然返回。
- // 隐藏的字段仍包含在 columns 和 rows.cells 中,客户端仅为有效 WGS84 坐标绘制标记。
- LocationKeyID string `json:"locationKeyID"`
- // 可选高度为 320、480、640 或 800px;省略按 480px 展示,不写回旧设置。显式 0 和 null 无效。
- Height AVMapHeight `json:"height,omitempty" api:"optional"`
-}
-
-type AVLayoutMap struct {
- *AVBaseLayout
- Columns []*AVViewTableColumn `json:"columns" api:"optional,nullable"`
- RowIDs []string `json:"rowIds" api:"optional,nullable"`
- Settings AVMapSettings `json:"settings"`
-}
-
-// AVMapUnplacedRequest 读取当前地图视图选定位置字段尚无坐标的条目,不修改视图或数据库。
-// query 沿用当前视图搜索,search 仅匹配未定位条目的标题;页码从 1 开始,页大小默认 50,最大 100。
-// 端点仅供可编辑管理员使用,并按 blockID 保持加密笔记本读取租约。
-type AVMapUnplacedRequest struct {
- ID string `json:"id"`
- BlockID string `json:"blockID" api:"optional,nullable"`
- ViewID string `json:"viewID"`
- Query string `json:"query" api:"optional,nullable"`
- Search string `json:"search" api:"optional,nullable"`
- Page *float64 `json:"page" api:"optional,nullable"`
- PageSize *float64 `json:"pageSize" api:"optional,nullable"`
-}
-
-// AVMapUnplacedData 返回未定位条目的独立分页,包含主键和位置字段单元格。
-// total 在当前视图筛选、上下文筛选、视图搜索及本列表标题搜索之后计算,不受地图行分页影响。
-type AVMapUnplacedData struct {
- Rows []*AVTableRow `json:"rows" api:"optional,nullable"`
- Total int `json:"total"`
-}
diff --git a/kernel/apicontract/av_map_test.go b/kernel/apicontract/av_map_test.go
deleted file mode 100644
index 397c1c97d0..0000000000
--- a/kernel/apicontract/av_map_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package apicontract
-
-import (
- "encoding/json"
- "strings"
- "testing"
-)
-
-func TestAVMapUnplacedContract(t *testing.T) {
- for _, body := range []string{
- `{"id":"av","viewID":"view"}`,
- `{"id":"av","viewID":"view","blockID":null,"query":null,"search":null,"page":null,"pageSize":null}`,
- `{"id":"av","viewID":"view","blockID":"block","query":"all","search":"title","page":2.9,"pageSize":50}`,
- } {
- if _, err := GetAttributeViewMapUnplaced.Decode(strings.NewReader(body)); err != nil {
- t.Fatalf("valid unplaced request rejected: %s: %v", body, err)
- }
- }
- for _, body := range []string{
- `{"id":"av"}`, `{"viewID":"view"}`, `{"id":"av","viewID":null}`,
- `{"id":"av","viewID":"view","page":"2"}`, `{"id":"av","viewID":"view","search":false}`,
- } {
- if _, err := GetAttributeViewMapUnplaced.Decode(strings.NewReader(body)); err == nil {
- t.Fatalf("invalid unplaced request accepted: %s", body)
- }
- }
- for _, definition := range Definitions() {
- if definition.Path == "/api/av/getAttributeViewMapUnplaced" {
- if definition.Authorization != AuthenticatedAccess|AdminAccess|WritableAccess {
- t.Fatal("map unplaced query no longer matches calendar undated permissions")
- }
- return
- }
- }
- t.Fatal("map unplaced endpoint is not registered")
-}
-
-func TestAVMapTransactionContract(t *testing.T) {
- bundle, err := BuildBundle()
- if err != nil {
- t.Fatal(err)
- }
- for _, test := range []struct {
- data string
- valid bool
- }{
- {`{"locationKeyID":"20261009000000-abcdefg"}`, true},
- {`{"locationKeyID":""}`, true},
- {`{"locationKeyID":"","height":320}`, true},
- {`{"locationKeyID":"","height":480}`, true},
- {`{"locationKeyID":"","height":640}`, true},
- {`{"locationKeyID":"","height":800}`, true},
- {`{"locationKeyID":"","height":0}`, false},
- {`{"locationKeyID":"","height":null}`, false},
- {`{"locationKeyID":"","height":400}`, false},
- {`{"locationKeyID":"","height":480.5}`, false},
- {`{"locationKeyID":"","height":"480"}`, false},
- {`{}`, false},
- {`{"locationKeyID":false}`, false},
- {`{"serviceID":"","locationKeyID":""}`, false},
- {`{"locationKeyID":"","showRecordList":true}`, false},
- {`{"locationKeyID":"","showRecordList":false}`, false},
- {`{"serviceID":"","locationKeyID":"","showRecordList":true,"apiKey":"secret"}`, false},
- } {
- var operation TransactionOperation
- if err := json.Unmarshal([]byte(`{"action":"setAttrViewMap","data":`+test.data+`}`), &operation); err != nil {
- t.Fatal(err)
- }
- payload, err := json.Marshal(Success([]*Transaction{{DoOperations: []*TransactionOperation{&operation}}}))
- if err != nil {
- t.Fatal(err)
- }
- if err = bundle.ValidateResponse("POST", "/api/transactions", payload); (err == nil) != test.valid {
- t.Fatalf("map transaction data %s, error %v", test.data, err)
- }
- }
-}
diff --git a/kernel/apicontract/av_response.go b/kernel/apicontract/av_response.go
index 4ee7822a4e..3dbb84c578 100644
--- a/kernel/apicontract/av_response.go
+++ b/kernel/apicontract/av_response.go
@@ -62,7 +62,7 @@ type AVArchiveRenderData struct {
CustomColors []*AVAttributeViewCustomColor `json:"customColors"`
ColorOrder []string `json:"colorOrder"`
UsedCustomColorIndexes []int `json:"usedCustomColorIndexes"`
- ViewType string `json:"viewType" api:"enum=table|list|gallery|kanban|calendar|map"`
+ ViewType string `json:"viewType" api:"enum=table|list|gallery|kanban|calendar"`
ViewID string `json:"viewID"`
Views []*AVViewData `json:"views"`
View AVViewInstance `json:"view"`
diff --git a/kernel/apicontract/av_retired_map_test.go b/kernel/apicontract/av_retired_map_test.go
new file mode 100644
index 0000000000..4b6f75a35b
--- /dev/null
+++ b/kernel/apicontract/av_retired_map_test.go
@@ -0,0 +1,29 @@
+package apicontract
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+)
+
+func TestAVContractRetiredMapRoutesAndLayout(t *testing.T) {
+ for _, definition := range Definitions() {
+ if strings.HasPrefix(definition.Path, "/api/map/") || definition.Path == "/api/av/getAttributeViewMapUnplaced" {
+ t.Fatalf("retired map route is registered: %s", definition.Path)
+ }
+ }
+ field, ok := reflect.TypeFor[AVArchiveRenderData]().FieldByName("ViewType")
+ if !ok || strings.Contains(field.Tag.Get("api"), "|map") {
+ t.Fatal("retired map layout remains in the render response contract")
+ }
+ for _, layout := range []string{"table", "list", "calendar", "gallery", "kanban"} {
+ if _, err := RenderAttributeView.Decode(strings.NewReader(`{"id":"database","initialLayout":"` + layout + `"}`)); err != nil {
+ t.Fatalf("supported layout %s rejected: %v", layout, err)
+ }
+ }
+ for _, operation := range transactionActionPayloads {
+ if operation.action == "setAttrViewMap" {
+ t.Fatal("retired map settings still have a transaction contract")
+ }
+ }
+}
diff --git a/kernel/apicontract/av_types.go b/kernel/apicontract/av_types.go
index 7190803339..9f8c8ce348 100644
--- a/kernel/apicontract/av_types.go
+++ b/kernel/apicontract/av_types.go
@@ -1,10 +1,6 @@
package apicontract
type AVTable struct {
- Map *AVMapSettings `json:"map,omitempty" api:"optional"`
- // 标记仅覆盖本次返回的行页;rowCount 为筛选后总数,不表示标记数量。
- // 发布响应先对完整结果过滤访问权限,再计算可访问总数和分页,不返回过滤前的聚合结果。
- MapMarkerScope string `json:"mapMarkerScope,omitempty" api:"optional,enum=page"`
// 仅日历布局返回字段绑定及一周起始日;创建、更新系统时间作为只读日期源。
Calendar *AVCalendarSettings `json:"calendar,omitempty" api:"optional"`
// 回显本次请求的日期范围,省略范围的请求不返回此字段。
@@ -437,7 +433,7 @@ type AVViewData struct {
Name string `json:"name" api:"optional,nullable"`
Desc string `json:"desc" api:"optional,nullable"`
HideAttrViewName bool `json:"hideAttrViewName" api:"optional,nullable"`
- Type string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban|calendar|map"`
+ Type string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban|calendar"`
PageSize int `json:"pageSize" api:"optional,nullable"`
}
@@ -507,9 +503,8 @@ type AVView struct {
Filters []*AVViewFilter `json:"filters,omitempty" api:"optional,nullable"`
Sorts []*AVViewSort `json:"sorts,omitempty" api:"optional,nullable"`
PageSize int `json:"pageSize" api:"optional,nullable"`
- LayoutType string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban|calendar|map"`
+ LayoutType string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban|calendar"`
Table *AVLayoutTable `json:"table,omitempty" api:"optional,nullable"`
- Map *AVLayoutMap `json:"map,omitempty" api:"optional,nullable"`
Calendar *AVLayoutCalendar `json:"calendar,omitempty" api:"optional,nullable"`
List *AVLayoutTable `json:"list,omitempty" api:"optional,nullable"`
Gallery *AVLayoutGallery `json:"gallery,omitempty" api:"optional,nullable"`
@@ -605,7 +600,7 @@ type AVAttributeViewFieldView struct {
ID string `json:"id" api:"optional,nullable"`
Icon string `json:"icon" api:"optional,nullable"`
Name string `json:"name" api:"optional,nullable"`
- Type string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban|calendar|map"`
+ Type string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban|calendar"`
Hidden bool `json:"hidden" api:"optional,nullable"`
}
@@ -614,7 +609,7 @@ type AVAvSearchResult struct {
AvName string `json:"avName" api:"optional,nullable"`
ViewName string `json:"viewName" api:"optional,nullable"`
ViewID string `json:"viewID" api:"optional,nullable"`
- ViewLayout string `json:"viewLayout" api:"optional,nullable,enum=|table|list|gallery|kanban|calendar|map"`
+ ViewLayout string `json:"viewLayout" api:"optional,nullable,enum=|table|list|gallery|kanban|calendar"`
BlockID string `json:"blockID" api:"optional,nullable"`
HPath string `json:"hPath" api:"optional,nullable"`
Matched bool `json:"matched,omitempty" api:"optional,nullable"`
diff --git a/kernel/apicontract/av_union.go b/kernel/apicontract/av_union.go
index fcff453c2d..8a4a4977ad 100644
--- a/kernel/apicontract/av_union.go
+++ b/kernel/apicontract/av_union.go
@@ -6,7 +6,7 @@ import (
"reflect"
)
-// AVViewInstance 表示各布局及其递归分组实例,列表、日历和地图复用表格的行列结构。
+// AVViewInstance 表示各布局及其递归分组实例,列表和日历复用表格的行列结构。
type AVViewInstance struct {
table *AVTable
gallery *AVGallery
@@ -31,9 +31,6 @@ func (value AVViewInstance) MarshalJSON() ([]byte, error) {
}
func avPayloadSchema(b *schemaBuilder, t reflect.Type, input bool) (*Schema, error) {
- if t == reflect.TypeFor[AVMapHeight]() {
- return &Schema{Type: "integer", Enum: []any{320, 480, 640, 800}}, nil
- }
if t == reflect.TypeFor[*AVValueLocation]() {
schema, err := b.schema(t.Elem(), input)
return nullable(schema), err
@@ -63,7 +60,7 @@ func avPayloadSchema(b *schemaBuilder, t reflect.Type, input bool) (*Schema, err
case reflect.TypeFor[AVTable](), reflect.TypeFor[AVTableColumn](), reflect.TypeFor[AVTableCell](),
reflect.TypeFor[AVGallery](), reflect.TypeFor[AVGalleryField](), reflect.TypeFor[AVGalleryFieldValue](),
reflect.TypeFor[AVKanban](), reflect.TypeFor[AVKanbanField](), reflect.TypeFor[AVKanbanFieldValue](),
- reflect.TypeFor[AVLayoutMap](), reflect.TypeFor[AVLayoutCalendar](), reflect.TypeFor[AVLayoutTable](), reflect.TypeFor[AVViewTableColumn](), reflect.TypeFor[AVLayoutGallery](),
+ reflect.TypeFor[AVLayoutCalendar](), reflect.TypeFor[AVLayoutTable](), reflect.TypeFor[AVViewTableColumn](), reflect.TypeFor[AVLayoutGallery](),
reflect.TypeFor[AVViewGalleryCardField](), reflect.TypeFor[AVLayoutKanban](), reflect.TypeFor[AVViewKanbanField]():
return avEmbeddedPayloadSchema(b, t, input)
}
diff --git a/kernel/apicontract/contracts.go b/kernel/apicontract/contracts.go
index fdf7d76a97..837d9dce4b 100644
--- a/kernel/apicontract/contracts.go
+++ b/kernel/apicontract/contracts.go
@@ -76,10 +76,6 @@ type ResponseOptions struct {
var definitions []Definition
-// MapGetRuntime 返回内置 OpenFreeMap 标识,不读取或返回凭据,无需服务 ID。
-// 仅管理员可用,响应禁止缓存;认证 bypass 模式返回 mapAuthenticationBypass。
-var MapGetRuntime = define[EmptyRequest, *MapRuntime]("getMapRuntime", "/api/map/getRuntime", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
-
// MCP OAuth 协议入口返回标准 OAuth JSON 或授权页面,不使用内核结果信封。
var MCPOAuthResource = define[EmptyRequest, BinaryContent]("mcpOAuthResource", "/.well-known/oauth-protected-resource/mcp", PublicAccess, NoBody, mcpOAuthContentOptions(), "GET")
var MCPOAuthResourceRoot = define[EmptyRequest, BinaryContent]("mcpOAuthResourceRoot", "/.well-known/oauth-protected-resource", PublicAccess, NoBody, mcpOAuthContentOptions(), "GET")
@@ -1196,12 +1192,6 @@ var RenderHistoryAttributeView = define[RenderHistoryAttributeViewRequest, AVArc
var RenderAttributeView = define[RenderAttributeViewRequest, AVRenderResult]("renderAttributeView", "/api/av/renderAttributeView", AuthenticatedAccess, JSONBody, ResponseOptions{DataOnError: true, FastJSON: true}, "POST")
var GetAttributeViewCalendarUndated = define[AVCalendarUndatedRequest, AVCalendarUndatedData]("getAttributeViewCalendarUndated", "/api/av/getAttributeViewCalendarUndated", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{}, "POST")
-// 返回地图选定位置字段尚无坐标的条目,包含合法的仅名称值,不包含零坐标、无效值或超出地图投影范围的已有坐标。
-// 空绑定按视图字段顺序使用首个位置字段;显式绑定失效时返回空列表,不自动改绑或写入配置。
-// 损坏或不支持的位置数据沿用现有读取校验并返回错误,保留源数据,不静默当作未定位条目。
-// 保留当前视图筛选、上下文筛选、query 搜索和排序,search 额外匹配标题;独立分页默认 50 条,上限 100 条。
-// 仅允许非只读管理员访问,保留加密笔记本读取租约;只读取实时数据,不创建、升级或保存数据库。
-var GetAttributeViewMapUnplaced = define[AVMapUnplacedRequest, AVMapUnplacedData]("getAttributeViewMapUnplaced", "/api/av/getAttributeViewMapUnplaced", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{}, "POST")
var GetCurrentAttrViewImages = define[GetCurrentAttrViewImagesRequest, []string]("getCurrentAttrViewImages", "/api/av/getCurrentAttrViewImages", AuthenticatedAccess, JSONBody, ResponseOptions{}, "POST")
var GetAttributeViewKeys = define[GetAttributeViewKeysRequest, []*AVBlockAttributeViewKeys]("getAttributeViewKeys", "/api/av/getAttributeViewKeys", AuthenticatedAccess, JSONBody, ResponseOptions{}, "POST")
var GetAttributeViewSearchTarget = define[GetAttributeViewSearchTargetRequest, *AVAttributeViewSearchTarget]("getAttributeViewSearchTarget", "/api/av/getAttributeViewSearchTarget", AuthenticatedAccess|WritableAccess, JSONBody, ResponseOptions{}, "POST")
diff --git a/kernel/apicontract/map.go b/kernel/apicontract/map.go
deleted file mode 100644
index d4ebf57a14..0000000000
--- a/kernel/apicontract/map.go
+++ /dev/null
@@ -1,6 +0,0 @@
-package apicontract
-
-// MapRuntime 声明内置 OpenFreeMap,不包含服务配置、密钥或安全码。
-type MapRuntime struct {
- Provider string `json:"provider" api:"enum=openfreemap"`
-}
diff --git a/kernel/apicontract/schema.json b/kernel/apicontract/schema.json
index 52e6d9d704..16e8b70b9f 100644
--- a/kernel/apicontract/schema.json
+++ b/kernel/apicontract/schema.json
@@ -5759,8 +5759,7 @@
"list",
"gallery",
"kanban",
- "calendar",
- "map"
+ "calendar"
]
},
"views": {
@@ -6305,8 +6304,7 @@
"list",
"gallery",
"kanban",
- "calendar",
- "map"
+ "calendar"
]
}
},
@@ -6885,8 +6883,7 @@
"list",
"gallery",
"kanban",
- "calendar",
- "map"
+ "calendar"
]
},
"viewName": {
@@ -9715,149 +9712,6 @@
}
]
},
- "AVLayoutMap": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "columns": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVViewTableColumn"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "filters": {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVViewFilter"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "id": {
- "type": "string"
- },
- "pageSize": {
- "type": "integer"
- },
- "rowIds": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "settings": {
- "$ref": "#/$defs/AVMapSettings"
- },
- "showIcon": {
- "type": "boolean"
- },
- "sorts": {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVViewSort"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "spec": {
- "type": "integer"
- },
- "wrapField": {
- "type": "boolean"
- }
- },
- "required": [
- "columns",
- "rowIds",
- "settings",
- "spec",
- "id",
- "showIcon",
- "wrapField"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "columns": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVViewTableColumn"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "rowIds": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "settings": {
- "$ref": "#/$defs/AVMapSettings"
- }
- },
- "required": [
- "columns",
- "rowIds",
- "settings"
- ],
- "additionalProperties": false
- }
- ]
- },
"AVLayoutTable": {
"anyOf": [
{
@@ -9993,147 +9847,6 @@
}
]
},
- "AVMapSettings": {
- "type": "object",
- "properties": {
- "height": {
- "type": "integer",
- "enum": [
- 320,
- 480,
- 640,
- 800
- ]
- },
- "locationKeyID": {
- "type": "string"
- }
- },
- "required": [
- "locationKeyID"
- ],
- "additionalProperties": false
- },
- "AVMapSettingsInput": {
- "type": "object",
- "properties": {
- "height": {
- "type": "integer",
- "enum": [
- 320,
- 480,
- 640,
- 800
- ]
- },
- "locationKeyID": {
- "type": "string"
- }
- },
- "required": [
- "locationKeyID"
- ],
- "additionalProperties": false
- },
- "AVMapUnplacedData": {
- "type": "object",
- "properties": {
- "rows": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVTableRow"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "total": {
- "type": "integer"
- }
- },
- "required": [
- "rows",
- "total"
- ],
- "additionalProperties": false
- },
- "AVMapUnplacedRequestInput": {
- "type": "object",
- "properties": {
- "blockID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "id": {
- "type": "string"
- },
- "page": {
- "anyOf": [
- {
- "type": "number"
- },
- {
- "type": "null"
- }
- ]
- },
- "pageSize": {
- "anyOf": [
- {
- "type": "number"
- },
- {
- "type": "null"
- }
- ]
- },
- "query": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "search": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "viewID": {
- "type": "string"
- }
- },
- "required": [
- "id",
- "viewID"
- ],
- "additionalProperties": false
- },
"AVNewItemFieldValue": {
"type": "object",
"properties": {
@@ -10934,8 +10647,7 @@
"list",
"gallery",
"kanban",
- "calendar",
- "map"
+ "calendar"
]
},
"views": {
@@ -11705,15 +11417,6 @@
"id": {
"type": "string"
},
- "map": {
- "$ref": "#/$defs/AVMapSettings"
- },
- "mapMarkerScope": {
- "type": "string",
- "enum": [
- "page"
- ]
- },
"name": {
"type": "string"
},
@@ -11823,15 +11526,6 @@
}
]
},
- "map": {
- "$ref": "#/$defs/AVMapSettings"
- },
- "mapMarkerScope": {
- "type": "string",
- "enum": [
- "page"
- ]
- },
"rowCount": {
"type": "integer"
},
@@ -13769,9 +13463,6 @@
"list": {
"$ref": "#/$defs/AVLayoutTable"
},
- "map": {
- "$ref": "#/$defs/AVLayoutMap"
- },
"name": {
"type": "string"
},
@@ -13801,8 +13492,7 @@
"list",
"gallery",
"kanban",
- "calendar",
- "map"
+ "calendar"
]
}
},
@@ -13851,8 +13541,7 @@
"list",
"gallery",
"kanban",
- "calendar",
- "map"
+ "calendar"
]
}
},
@@ -31185,21 +30874,6 @@
},
"additionalProperties": false
},
- "MapRuntime": {
- "type": "object",
- "properties": {
- "provider": {
- "type": "string",
- "enum": [
- "openfreemap"
- ]
- }
- },
- "required": [
- "provider"
- ],
- "additionalProperties": false
- },
"MarkdownHTMLRequestInput": {
"type": "object",
"properties": {
@@ -70383,7 +70057,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewMap"
+ "setAttrViewCalendar"
]
},
"avID": {
@@ -70427,7 +70101,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/AVMapSettingsInput"
+ "$ref": "#/$defs/AVCalendarSettingsInput"
},
{
"type": "null"
@@ -70594,7 +70268,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCalendar"
+ "setAttrViewCardLayout"
]
},
"avID": {
@@ -70638,7 +70312,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/AVCalendarSettingsInput"
+ "type": "number"
},
{
"type": "null"
@@ -70805,7 +70479,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCardLayout"
+ "setAttrViewColFullRow"
]
},
"avID": {
@@ -70849,7 +70523,7 @@
"data": {
"anyOf": [
{
- "type": "number"
+ "type": "boolean"
},
{
"type": "null"
@@ -71016,7 +70690,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColFullRow"
+ "setAttrViewFitImage"
]
},
"avID": {
@@ -71227,7 +70901,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewFitImage"
+ "setAttrViewDisplayFieldName"
]
},
"avID": {
@@ -71438,7 +71112,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewDisplayFieldName"
+ "setAttrViewDisplayEmptyFields"
]
},
"avID": {
@@ -71649,7 +71323,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewDisplayEmptyFields"
+ "setAttrViewFillColBackgroundColor"
]
},
"avID": {
@@ -71860,7 +71534,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewFillColBackgroundColor"
+ "setAttrViewShowIcon"
]
},
"avID": {
@@ -72071,7 +71745,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewShowIcon"
+ "setAttrViewWrapField"
]
},
"avID": {
@@ -72282,7 +71956,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewWrapField"
+ "changeAttrViewLayout"
]
},
"avID": {
@@ -72324,15 +71998,212 @@
"$ref": "#/$defs/TransactionContext"
},
"data": {
+ "type": "null"
+ },
+ "deckID": {
+ "type": "string"
+ },
+ "format": {
+ "type": "string"
+ },
+ "groupID": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "ignoreDefaultFill": {
+ "type": "boolean"
+ },
+ "isDetached": {
+ "type": "boolean"
+ },
+ "isTwoWay": {
+ "type": "boolean"
+ },
+ "keyID": {
+ "type": "string"
+ },
+ "layout": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "nextID": {
+ "type": "string"
+ },
+ "parentID": {
+ "type": "string"
+ },
+ "previousID": {
+ "type": "string"
+ },
+ "removeDest": {
+ "type": "boolean"
+ },
+ "retData": {
+ "type": "null"
+ },
+ "rootID": {
+ "type": "string"
+ },
+ "rowID": {
+ "type": "string"
+ },
+ "srcIDs": {
"anyOf": [
{
- "type": "boolean"
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "srcs": {
+ "anyOf": [
+ {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionSourceFieldsInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "targetGroupID": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "",
+ "block",
+ "text",
+ "number",
+ "date",
+ "select",
+ "mSelect",
+ "url",
+ "email",
+ "phone",
+ "location",
+ "mAsset",
+ "template",
+ "created",
+ "updated",
+ "checkbox",
+ "relation",
+ "rollup",
+ "lineNumber"
+ ]
+ },
+ "viewID": {
+ "type": "string"
+ },
+ "viewIDs": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "action",
+ "id",
+ "rootID",
+ "parentID",
+ "previousID",
+ "nextID",
+ "blockIDs",
+ "blockID",
+ "deckID",
+ "avID",
+ "srcIDs",
+ "srcs",
+ "isDetached",
+ "name",
+ "type",
+ "format",
+ "keyID",
+ "rowID",
+ "isTwoWay",
+ "backRelationKeyID",
+ "removeDest",
+ "layout",
+ "groupID",
+ "targetGroupID",
+ "viewID",
+ "ignoreDefaultFill",
+ "context",
+ "data",
+ "retData"
+ ],
+ "additionalProperties": false
+ },
+ {
+ "type": "object",
+ "properties": {
+ "action": {
+ "type": "string",
+ "enum": [
+ "setAttrViewBlockView"
+ ]
+ },
+ "avID": {
+ "type": "string"
+ },
+ "backRelationKeyID": {
+ "type": "string"
+ },
+ "blockID": {
+ "type": "string"
+ },
+ "blockIDs": {
+ "anyOf": [
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
},
{
"type": "null"
}
]
},
+ "cellUpdates": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionCellUpdate"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "context": {
+ "$ref": "#/$defs/TransactionContext"
+ },
+ "data": {
+ "type": "null"
+ },
"deckID": {
"type": "string"
},
@@ -72493,7 +72364,7 @@
"action": {
"type": "string",
"enum": [
- "changeAttrViewLayout"
+ "setAttrViewBlockVisibleViews"
]
},
"avID": {
@@ -72697,7 +72568,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewBlockView"
+ "setAttrViewCardAspectRatio"
]
},
"avID": {
@@ -72739,7 +72610,14 @@
"$ref": "#/$defs/TransactionContext"
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"type": "string"
@@ -72901,7 +72779,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewBlockVisibleViews"
+ "setAttrViewCardAspectRatioValue"
]
},
"avID": {
@@ -72943,7 +72821,14 @@
"$ref": "#/$defs/TransactionContext"
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"type": "string"
@@ -73105,7 +72990,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCardAspectRatio"
+ "setAttrViewGroup"
]
},
"avID": {
@@ -73149,7 +73034,7 @@
"data": {
"anyOf": [
{
- "type": "number"
+ "$ref": "#/$defs/AVViewGroupInput"
},
{
"type": "null"
@@ -73316,7 +73201,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCardAspectRatioValue"
+ "hideAttrViewGroup"
]
},
"avID": {
@@ -73527,7 +73412,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewGroup"
+ "hideAttrViewAllGroups"
]
},
"avID": {
@@ -73571,7 +73456,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/AVViewGroupInput"
+ "type": "boolean"
},
{
"type": "null"
@@ -73738,7 +73623,7 @@
"action": {
"type": "string",
"enum": [
- "hideAttrViewGroup"
+ "foldAttrViewGroup"
]
},
"avID": {
@@ -73782,7 +73667,7 @@
"data": {
"anyOf": [
{
- "type": "number"
+ "type": "boolean"
},
{
"type": "null"
@@ -73949,7 +73834,7 @@
"action": {
"type": "string",
"enum": [
- "hideAttrViewAllGroups"
+ "foldAttrViewGroups"
]
},
"avID": {
@@ -73993,7 +73878,10 @@
"data": {
"anyOf": [
{
- "type": "boolean"
+ "type": "object",
+ "additionalProperties": {
+ "type": "boolean"
+ }
},
{
"type": "null"
@@ -74160,7 +74048,7 @@
"action": {
"type": "string",
"enum": [
- "foldAttrViewGroup"
+ "syncAttrViewTableColWidth"
]
},
"avID": {
@@ -74202,14 +74090,7 @@
"$ref": "#/$defs/TransactionContext"
},
"data": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"type": "string"
@@ -74371,7 +74252,7 @@
"action": {
"type": "string",
"enum": [
- "foldAttrViewGroups"
+ "removeAttrViewGroup"
]
},
"avID": {
@@ -74413,17 +74294,7 @@
"$ref": "#/$defs/TransactionContext"
},
"data": {
- "anyOf": [
- {
- "type": "object",
- "additionalProperties": {
- "type": "boolean"
- }
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"type": "string"
@@ -74585,7 +74456,7 @@
"action": {
"type": "string",
"enum": [
- "syncAttrViewTableColWidth"
+ "sortAttrViewGroup"
]
},
"avID": {
@@ -74787,10 +74658,7 @@
"type": "object",
"properties": {
"action": {
- "type": "string",
- "enum": [
- "removeAttrViewGroup"
- ]
+ "$ref": "#/$defs/UnknownTransactionAction"
},
"avID": {
"type": "string"
@@ -74831,7 +74699,7 @@
"$ref": "#/$defs/TransactionContext"
},
"data": {
- "type": "null"
+ "$ref": "#/$defs/JSONValue"
},
"deckID": {
"type": "string"
@@ -74876,7 +74744,7 @@
"type": "boolean"
},
"retData": {
- "type": "null"
+ "$ref": "#/$defs/JSONValue"
},
"rootID": {
"type": "string"
@@ -74986,24 +74854,49 @@
"retData"
],
"additionalProperties": false
- },
+ }
+ ]
+ },
+ "TransactionOperationRequest": {
+ "anyOf": [
{
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
- "sortAttrViewGroup"
+ "updateAttrs"
]
},
"avID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"backRelationKeyID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"blockID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"blockIDs": {
"anyOf": [
@@ -75019,74 +74912,207 @@
]
},
"cellUpdates": {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionCellUpdate"
- },
- {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionCellUpdateInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
}
- ]
- }
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"context": {
- "$ref": "#/$defs/TransactionContext"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionContext"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionAttributeChangeInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"format": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"groupID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"id": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"ignoreDefaultFill": {
- "type": "boolean"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"isDetached": {
- "type": "boolean"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"isTwoWay": {
- "type": "boolean"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"keyID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"layout": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"name": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"nextID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"parentID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"previousID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"removeDest": {
- "type": "boolean"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"retData": {
"type": "null"
},
"rootID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"rowID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"srcIDs": {
"anyOf": [
@@ -75122,10 +75148,16 @@
]
},
"targetGroupID": {
- "type": "string"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"type": {
- "type": "string",
"enum": [
"",
"block",
@@ -75146,263 +75178,52 @@
"relation",
"rollup",
"lineNumber"
- ]
- },
- "viewID": {
- "type": "string"
- },
- "viewIDs": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- },
- "required": [
- "action",
- "id",
- "rootID",
- "parentID",
- "previousID",
- "nextID",
- "blockIDs",
- "blockID",
- "deckID",
- "avID",
- "srcIDs",
- "srcs",
- "isDetached",
- "name",
- "type",
- "format",
- "keyID",
- "rowID",
- "isTwoWay",
- "backRelationKeyID",
- "removeDest",
- "layout",
- "groupID",
- "targetGroupID",
- "viewID",
- "ignoreDefaultFill",
- "context",
- "data",
- "retData"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "action": {
- "$ref": "#/$defs/UnknownTransactionAction"
- },
- "avID": {
- "type": "string"
- },
- "backRelationKeyID": {
- "type": "string"
- },
- "blockID": {
- "type": "string"
- },
- "blockIDs": {
+ ],
"anyOf": [
{
- "type": "array",
- "items": {
- "type": "string"
- }
+ "type": "string"
},
{
"type": "null"
}
]
},
- "cellUpdates": {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionCellUpdate"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "context": {
- "$ref": "#/$defs/TransactionContext"
- },
- "data": {
- "$ref": "#/$defs/JSONValue"
- },
- "deckID": {
- "type": "string"
- },
- "format": {
- "type": "string"
- },
- "groupID": {
- "type": "string"
- },
- "id": {
- "type": "string"
- },
- "ignoreDefaultFill": {
- "type": "boolean"
- },
- "isDetached": {
- "type": "boolean"
- },
- "isTwoWay": {
- "type": "boolean"
- },
- "keyID": {
- "type": "string"
- },
- "layout": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "nextID": {
- "type": "string"
- },
- "parentID": {
- "type": "string"
- },
- "previousID": {
- "type": "string"
- },
- "removeDest": {
- "type": "boolean"
- },
- "retData": {
- "$ref": "#/$defs/JSONValue"
- },
- "rootID": {
- "type": "string"
- },
- "rowID": {
- "type": "string"
- },
- "srcIDs": {
+ "viewID": {
"anyOf": [
{
- "type": "array",
- "items": {
- "type": "string"
- }
+ "type": "string"
},
{
"type": "null"
}
]
},
- "srcs": {
+ "viewIDs": {
"anyOf": [
{
"type": "array",
"items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionSourceFieldsInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "string"
}
},
{
"type": "null"
}
]
- },
- "targetGroupID": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "enum": [
- "",
- "block",
- "text",
- "number",
- "date",
- "select",
- "mSelect",
- "url",
- "email",
- "phone",
- "location",
- "mAsset",
- "template",
- "created",
- "updated",
- "checkbox",
- "relation",
- "rollup",
- "lineNumber"
- ]
- },
- "viewID": {
- "type": "string"
- },
- "viewIDs": {
- "type": "array",
- "items": {
- "type": "string"
- }
}
},
"required": [
- "action",
- "id",
- "rootID",
- "parentID",
- "previousID",
- "nextID",
- "blockIDs",
- "blockID",
- "deckID",
- "avID",
- "srcIDs",
- "srcs",
- "isDetached",
- "name",
- "type",
- "format",
- "keyID",
- "rowID",
- "isTwoWay",
- "backRelationKeyID",
- "removeDest",
- "layout",
- "groupID",
- "targetGroupID",
- "viewID",
- "ignoreDefaultFill",
- "context",
- "data",
- "retData"
+ "action"
],
"additionalProperties": false
- }
- ]
- },
- "TransactionOperationRequest": {
- "anyOf": [
+ },
{
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
- "updateAttrs"
+ "create"
]
},
"avID": {
@@ -75479,14 +75300,7 @@
]
},
"data": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionAttributeChangeInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -75760,7 +75574,7 @@
"action": {
"type": "string",
"enum": [
- "create"
+ "restoreCreatedDoc"
]
},
"avID": {
@@ -76111,7 +75925,7 @@
"action": {
"type": "string",
"enum": [
- "restoreCreatedDoc"
+ "removeCreatedDoc"
]
},
"avID": {
@@ -76462,7 +76276,7 @@
"action": {
"type": "string",
"enum": [
- "removeCreatedDoc"
+ "update"
]
},
"avID": {
@@ -76539,365 +76353,14 @@
]
},
"data": {
- "type": "null"
- },
- "deckID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "format": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "groupID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "id": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "ignoreDefaultFill": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "isDetached": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "isTwoWay": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "keyID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "layout": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "name": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "nextID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "parentID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "previousID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "removeDest": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "retData": {
- "type": "null"
- },
- "rootID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "rowID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "srcIDs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "srcs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionSourceFieldsInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "targetGroupID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "type": {
- "enum": [
- "",
- "block",
- "text",
- "number",
- "date",
- "select",
- "mSelect",
- "url",
- "email",
- "phone",
- "location",
- "mAsset",
- "template",
- "created",
- "updated",
- "checkbox",
- "relation",
- "rollup",
- "lineNumber"
- ],
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "viewID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "viewIDs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "required": [
- "action"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "action": {
- "type": "string",
- "enum": [
- "update"
- ]
- },
- "avID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "backRelationKeyID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "blockID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "blockIDs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "cellUpdates": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionCellUpdateInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "context": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionContext"
- },
- {
- "type": "null"
- }
- ]
- },
- "data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -79237,378 +78700,20 @@
]
},
"retData": {
- "anyOf": [
- {
- "type": "null"
- },
- {
- "type": "string"
- },
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- ]
- },
- "rootID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "rowID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "srcIDs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "srcs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionSourceFieldsInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "targetGroupID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "type": {
- "enum": [
- "",
- "block",
- "text",
- "number",
- "date",
- "select",
- "mSelect",
- "url",
- "email",
- "phone",
- "location",
- "mAsset",
- "template",
- "created",
- "updated",
- "checkbox",
- "relation",
- "rollup",
- "lineNumber"
- ],
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "viewID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "viewIDs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "required": [
- "action"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "action": {
- "type": "string",
- "enum": [
- "append"
- ]
- },
- "avID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "backRelationKeyID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "blockID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "blockIDs": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "cellUpdates": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionCellUpdateInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- },
- "context": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionContext"
- },
- {
- "type": "null"
- }
- ]
- },
- "data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "deckID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "format": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "groupID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "id": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "ignoreDefaultFill": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "isDetached": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "isTwoWay": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "keyID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "layout": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "name": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "nextID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "parentID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "previousID": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "removeDest": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "null"
- }
- ]
- },
- "retData": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "null"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
},
"rootID": {
"anyOf": [
@@ -79739,7 +78844,7 @@
"action": {
"type": "string",
"enum": [
- "appendInsert"
+ "append"
]
},
"avID": {
@@ -79966,20 +79071,7 @@
]
},
"retData": {
- "anyOf": [
- {
- "type": "null"
- },
- {
- "type": "string"
- },
- {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- ]
+ "type": "null"
},
"rootID": {
"anyOf": [
@@ -80110,7 +79202,7 @@
"action": {
"type": "string",
"enum": [
- "prependInsert"
+ "appendInsert"
]
},
"avID": {
@@ -80481,7 +79573,7 @@
"action": {
"type": "string",
"enum": [
- "foldHeading"
+ "prependInsert"
]
},
"avID": {
@@ -80558,7 +79650,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -80845,7 +79944,7 @@
"action": {
"type": "string",
"enum": [
- "unfoldHeading"
+ "foldHeading"
]
},
"avID": {
@@ -80922,14 +80021,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -81216,7 +80308,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrs"
+ "unfoldHeading"
]
},
"avID": {
@@ -81587,7 +80679,7 @@
"action": {
"type": "string",
"enum": [
- "doUpdateUpdated"
+ "setAttrs"
]
},
"avID": {
@@ -81814,7 +80906,20 @@
]
},
"retData": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "null"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
},
"rootID": {
"anyOf": [
@@ -81945,7 +81050,7 @@
"action": {
"type": "string",
"enum": [
- "addFlashcards"
+ "doUpdateUpdated"
]
},
"avID": {
@@ -82022,7 +81127,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -82296,7 +81408,7 @@
"action": {
"type": "string",
"enum": [
- "removeFlashcards"
+ "addFlashcards"
]
},
"avID": {
@@ -82647,7 +81759,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewName"
+ "removeFlashcards"
]
},
"avID": {
@@ -82724,14 +81836,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -83005,7 +82110,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewNewItemTemplates"
+ "setAttrViewName"
]
},
"avID": {
@@ -83084,7 +82189,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/TransactionNewItemTemplatesInput"
+ "type": "string"
},
{
"type": "null"
@@ -83363,7 +82468,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewAutomations"
+ "setAttrViewNewItemTemplates"
]
},
"avID": {
@@ -83442,7 +82547,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/AVAutomationConfigInput"
+ "$ref": "#/$defs/TransactionNewItemTemplatesInput"
},
{
"type": "null"
@@ -83721,7 +82826,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewConditionalColors"
+ "setAttrViewAutomations"
]
},
"avID": {
@@ -83800,17 +82905,7 @@
"data": {
"anyOf": [
{
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVConditionalColorRuleInput"
- },
- {
- "type": "null"
- }
- ]
- }
+ "$ref": "#/$defs/AVAutomationConfigInput"
},
{
"type": "null"
@@ -84089,7 +83184,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewFilters"
+ "setAttrViewConditionalColors"
]
},
"avID": {
@@ -84172,7 +83267,7 @@
"items": {
"anyOf": [
{
- "$ref": "#/$defs/AVViewFilterInput"
+ "$ref": "#/$defs/AVConditionalColorRuleInput"
},
{
"type": "null"
@@ -84457,7 +83552,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewContextFilter"
+ "setAttrViewFilters"
]
},
"avID": {
@@ -84534,7 +83629,24 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVViewFilterInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -84808,7 +83920,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColRelationFilters"
+ "setAttrViewContextFilter"
]
},
"avID": {
@@ -84885,24 +83997,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVViewFilterInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -85176,7 +84271,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColRollupFilters"
+ "setAttrViewColRelationFilters"
]
},
"avID": {
@@ -85544,7 +84639,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewSorts"
+ "setAttrViewColRollupFilters"
]
},
"avID": {
@@ -85627,7 +84722,7 @@
"items": {
"anyOf": [
{
- "$ref": "#/$defs/AVViewSortInput"
+ "$ref": "#/$defs/AVViewFilterInput"
},
{
"type": "null"
@@ -85912,7 +85007,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewPageSize"
+ "setAttrViewSorts"
]
},
"avID": {
@@ -85991,7 +85086,17 @@
"data": {
"anyOf": [
{
- "type": "number"
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVViewSortInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
},
{
"type": "null"
@@ -86270,7 +85375,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColWidth"
+ "setAttrViewPageSize"
]
},
"avID": {
@@ -86349,7 +85454,7 @@
"data": {
"anyOf": [
{
- "type": "string"
+ "type": "number"
},
{
"type": "null"
@@ -86628,7 +85733,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColsWidth"
+ "setAttrViewColWidth"
]
},
"avID": {
@@ -86707,10 +85812,7 @@
"data": {
"anyOf": [
{
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
+ "type": "string"
},
{
"type": "null"
@@ -86989,7 +86091,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColAlign"
+ "setAttrViewColsWidth"
]
},
"avID": {
@@ -87068,7 +86170,10 @@
"data": {
"anyOf": [
{
- "type": "string"
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
},
{
"type": "null"
@@ -87347,7 +86452,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColWrap"
+ "setAttrViewColAlign"
]
},
"avID": {
@@ -87426,7 +86531,7 @@
"data": {
"anyOf": [
{
- "type": "boolean"
+ "type": "string"
},
{
"type": "null"
@@ -87705,7 +86810,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColHidden"
+ "setAttrViewColWrap"
]
},
"avID": {
@@ -88063,7 +87168,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColPin"
+ "setAttrViewColHidden"
]
},
"avID": {
@@ -88421,7 +87526,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColIcon"
+ "setAttrViewColPin"
]
},
"avID": {
@@ -88500,7 +87605,7 @@
"data": {
"anyOf": [
{
- "type": "string"
+ "type": "boolean"
},
{
"type": "null"
@@ -88779,7 +87884,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColDesc"
+ "setAttrViewColIcon"
]
},
"avID": {
@@ -89137,7 +88242,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColAttributePanelVisibility"
+ "setAttrViewColDesc"
]
},
"avID": {
@@ -89495,7 +88600,7 @@
"action": {
"type": "string",
"enum": [
- "insertAttrViewBlock"
+ "setAttrViewColAttributePanelVisibility"
]
},
"avID": {
@@ -89572,7 +88677,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -89715,14 +88827,7 @@
]
},
"retData": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionInsertedItemsInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"rootID": {
"anyOf": [
@@ -89853,7 +88958,7 @@
"action": {
"type": "string",
"enum": [
- "removeAttrViewBlock"
+ "insertAttrViewBlock"
]
},
"avID": {
@@ -90073,7 +89178,14 @@
]
},
"retData": {
- "type": "null"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionInsertedItemsInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"rootID": {
"anyOf": [
@@ -90204,7 +89316,7 @@
"action": {
"type": "string",
"enum": [
- "addAttrViewCol"
+ "removeAttrViewBlock"
]
},
"avID": {
@@ -90281,14 +89393,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -90562,7 +89667,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewCol"
+ "addAttrViewCol"
]
},
"avID": {
@@ -90639,7 +89744,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -90913,7 +90025,7 @@
"action": {
"type": "string",
"enum": [
- "removeAttrViewCol"
+ "updateAttrViewCol"
]
},
"avID": {
@@ -91264,7 +90376,7 @@
"action": {
"type": "string",
"enum": [
- "sortAttrViewRow"
+ "removeAttrViewCol"
]
},
"avID": {
@@ -91341,14 +90453,7 @@
]
},
"data": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVRowOrderChangeInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -91622,7 +90727,7 @@
"action": {
"type": "string",
"enum": [
- "sortAttrViewCol"
+ "sortAttrViewRow"
]
},
"avID": {
@@ -91699,7 +90804,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVRowOrderChangeInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -91973,7 +91085,7 @@
"action": {
"type": "string",
"enum": [
- "sortAttrViewKey"
+ "sortAttrViewCol"
]
},
"avID": {
@@ -92324,7 +91436,7 @@
"action": {
"type": "string",
"enum": [
- "sortAttrViewBinding"
+ "sortAttrViewKey"
]
},
"avID": {
@@ -92675,7 +91787,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewCell"
+ "sortAttrViewBinding"
]
},
"avID": {
@@ -92752,14 +91864,7 @@
]
},
"data": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVValueInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -93033,7 +92138,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewCells"
+ "updateAttrViewCell"
]
},
"avID": {
@@ -93110,7 +92215,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVValueInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -93384,7 +92496,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewColOptions"
+ "updateAttrViewCells"
]
},
"avID": {
@@ -93461,24 +92573,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVSelectOptionInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -93752,7 +92847,7 @@
"action": {
"type": "string",
"enum": [
- "removeAttrViewColOption"
+ "updateAttrViewColOptions"
]
},
"avID": {
@@ -93831,7 +92926,17 @@
"data": {
"anyOf": [
{
- "type": "string"
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVSelectOptionInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
},
{
"type": "null"
@@ -94110,7 +93215,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewColOption"
+ "removeAttrViewColOption"
]
},
"avID": {
@@ -94189,7 +93294,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/TransactionOptionChangeInput"
+ "type": "string"
},
{
"type": "null"
@@ -94468,7 +93573,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColOptionDesc"
+ "updateAttrViewColOption"
]
},
"avID": {
@@ -94547,7 +93652,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/TransactionOptionDescriptionInput"
+ "$ref": "#/$defs/TransactionOptionChangeInput"
},
{
"type": "null"
@@ -94826,7 +93931,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCustomColors"
+ "setAttrViewColOptionDesc"
]
},
"avID": {
@@ -94905,31 +94010,7 @@
"data": {
"anyOf": [
{
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionCustomColorsInput"
- },
- {
- "anyOf": [
- {
- "type": "array",
- "items": {
- "anyOf": [
- {
- "$ref": "#/$defs/AVAttributeViewCustomColorInput"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- {
- "type": "null"
- }
- ]
- }
- ]
+ "$ref": "#/$defs/TransactionOptionDescriptionInput"
},
{
"type": "null"
@@ -95208,7 +94289,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColCalc"
+ "setAttrViewCustomColors"
]
},
"avID": {
@@ -95287,7 +94368,31 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/AVFieldCalcInput"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionCustomColorsInput"
+ },
+ {
+ "anyOf": [
+ {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVAttributeViewCustomColorInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ ]
},
{
"type": "null"
@@ -95566,7 +94671,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewColNumberFormat"
+ "setAttrViewColCalc"
]
},
"avID": {
@@ -95643,7 +94748,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/AVFieldCalcInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -95917,7 +95029,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColDateFormat"
+ "updateAttrViewColNumberFormat"
]
},
"avID": {
@@ -96268,7 +95380,7 @@
"action": {
"type": "string",
"enum": [
- "replaceAttrViewBlock"
+ "setAttrViewColDateFormat"
]
},
"avID": {
@@ -96488,14 +95600,7 @@
]
},
"retData": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionReplacedItemInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"rootID": {
"anyOf": [
@@ -96626,7 +95731,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewColTemplate"
+ "replaceAttrViewBlock"
]
},
"avID": {
@@ -96703,14 +95808,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -96853,7 +95951,14 @@
]
},
"retData": {
- "type": "null"
+ "anyOf": [
+ {
+ "$ref": "#/$defs/TransactionReplacedItemInput"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"rootID": {
"anyOf": [
@@ -96984,7 +96089,7 @@
"action": {
"type": "string",
"enum": [
- "addAttrViewView"
+ "updateAttrViewColTemplate"
]
},
"avID": {
@@ -97061,7 +96166,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -97335,7 +96447,7 @@
"action": {
"type": "string",
"enum": [
- "removeAttrViewView"
+ "addAttrViewView"
]
},
"avID": {
@@ -97555,14 +96667,7 @@
]
},
"retData": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"rootID": {
"anyOf": [
@@ -97693,7 +96798,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewViewName"
+ "removeAttrViewView"
]
},
"avID": {
@@ -97770,14 +96875,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -97920,7 +97018,14 @@
]
},
"retData": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"rootID": {
"anyOf": [
@@ -98051,7 +97156,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewViewIcon"
+ "setAttrViewViewName"
]
},
"avID": {
@@ -98409,7 +97514,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewViewDesc"
+ "setAttrViewViewIcon"
]
},
"avID": {
@@ -98767,7 +97872,7 @@
"action": {
"type": "string",
"enum": [
- "duplicateAttrViewView"
+ "setAttrViewViewDesc"
]
},
"avID": {
@@ -98844,7 +97949,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -99118,7 +98230,7 @@
"action": {
"type": "string",
"enum": [
- "duplicateAttrViewRow"
+ "duplicateAttrViewView"
]
},
"avID": {
@@ -99469,7 +98581,7 @@
"action": {
"type": "string",
"enum": [
- "sortAttrViewView"
+ "duplicateAttrViewRow"
]
},
"avID": {
@@ -99546,14 +98658,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -99827,7 +98932,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewColRelation"
+ "sortAttrViewView"
]
},
"avID": {
@@ -99904,7 +99009,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -100178,7 +99290,7 @@
"action": {
"type": "string",
"enum": [
- "updateAttrViewColRollup"
+ "updateAttrViewColRelation"
]
},
"avID": {
@@ -100255,14 +99367,7 @@
]
},
"data": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionRollupInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -100536,7 +99641,7 @@
"action": {
"type": "string",
"enum": [
- "hideAttrViewName"
+ "updateAttrViewColRollup"
]
},
"avID": {
@@ -100615,7 +99720,7 @@
"data": {
"anyOf": [
{
- "type": "boolean"
+ "$ref": "#/$defs/TransactionRollupInput"
},
{
"type": "null"
@@ -100894,7 +99999,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColDateFillCreated"
+ "hideAttrViewName"
]
},
"avID": {
@@ -101252,7 +100357,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewColDateFillSpecificTime"
+ "setAttrViewColDateFillCreated"
]
},
"avID": {
@@ -101610,7 +100715,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCreatedIncludeTime"
+ "setAttrViewColDateFillSpecificTime"
]
},
"avID": {
@@ -101968,7 +101073,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewUpdatedIncludeTime"
+ "setAttrViewCreatedIncludeTime"
]
},
"avID": {
@@ -102326,7 +101431,7 @@
"action": {
"type": "string",
"enum": [
- "duplicateAttrViewKey"
+ "setAttrViewUpdatedIncludeTime"
]
},
"avID": {
@@ -102403,7 +101508,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -102677,7 +101789,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCoverFrom"
+ "duplicateAttrViewKey"
]
},
"avID": {
@@ -102754,14 +101866,7 @@
]
},
"data": {
- "anyOf": [
- {
- "type": "number"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -103035,7 +102140,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCoverFromAssetKeyID"
+ "setAttrViewCoverFrom"
]
},
"avID": {
@@ -103112,7 +102217,14 @@
]
},
"data": {
- "type": "null"
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ]
},
"deckID": {
"anyOf": [
@@ -103386,7 +102498,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCardCoverPosition"
+ "setAttrViewCoverFromAssetKeyID"
]
},
"avID": {
@@ -103463,14 +102575,7 @@
]
},
"data": {
- "anyOf": [
- {
- "$ref": "#/$defs/TransactionCardCoverPositionInput"
- },
- {
- "type": "null"
- }
- ]
+ "type": "null"
},
"deckID": {
"anyOf": [
@@ -103744,7 +102849,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCardSize"
+ "setAttrViewCardCoverPosition"
]
},
"avID": {
@@ -103823,7 +102928,7 @@
"data": {
"anyOf": [
{
- "type": "number"
+ "$ref": "#/$defs/TransactionCardCoverPositionInput"
},
{
"type": "null"
@@ -104102,7 +103207,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewCardWidth"
+ "setAttrViewCardSize"
]
},
"avID": {
@@ -104460,7 +103565,7 @@
"action": {
"type": "string",
"enum": [
- "setAttrViewMap"
+ "setAttrViewCardWidth"
]
},
"avID": {
@@ -104539,7 +103644,7 @@
"data": {
"anyOf": [
{
- "$ref": "#/$defs/AVMapSettingsInput"
+ "type": "number"
},
{
"type": "null"
@@ -113604,7 +112709,6 @@
"setAttrViewCardCoverPosition",
"setAttrViewCardSize",
"setAttrViewCardWidth",
- "setAttrViewMap",
"setAttrViewCalendar",
"setAttrViewCardLayout",
"setAttrViewColFullRow",
@@ -127977,86 +127081,6 @@
]
}
},
- {
- "method": "POST",
- "path": "/api/av/getAttributeViewMapUnplaced",
- "handler": "getAttributeViewMapUnplaced",
- "authorization": [
- "authenticated",
- "admin",
- "writable"
- ],
- "body": "json",
- "request": {
- "$ref": "#/$defs/AVMapUnplacedRequestInput"
- },
- "response": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "enum": [
- 0
- ]
- },
- "data": {
- "$ref": "#/$defs/AVMapUnplacedData"
- },
- "msg": {
- "type": "string"
- }
- },
- "required": [
- "code",
- "msg",
- "data"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "enum": [
- -1
- ]
- },
- "data": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "closeTimeout": {
- "type": "number"
- }
- },
- "required": [
- "closeTimeout"
- ],
- "additionalProperties": false
- },
- {
- "type": "null"
- }
- ]
- },
- "msg": {
- "type": "string"
- }
- },
- "required": [
- "code",
- "msg",
- "data"
- ],
- "additionalProperties": true
- }
- ]
- }
- },
{
"method": "POST",
"path": "/api/av/getAttributeViewPasteRows",
@@ -149843,92 +148867,6 @@
]
}
},
- {
- "method": "POST",
- "path": "/api/map/getRuntime",
- "handler": "getMapRuntime",
- "authorization": [
- "authenticated",
- "admin"
- ],
- "body": "none",
- "request": {
- "$ref": "#/$defs/EmptyRequestInput"
- },
- "response": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "enum": [
- 0
- ]
- },
- "data": {
- "anyOf": [
- {
- "$ref": "#/$defs/MapRuntime"
- },
- {
- "type": "null"
- }
- ]
- },
- "msg": {
- "type": "string"
- }
- },
- "required": [
- "code",
- "msg",
- "data"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "code": {
- "type": "integer",
- "enum": [
- -1
- ]
- },
- "data": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "closeTimeout": {
- "type": "number"
- }
- },
- "required": [
- "closeTimeout"
- ],
- "additionalProperties": false
- },
- {
- "type": "null"
- }
- ]
- },
- "msg": {
- "type": "string"
- }
- },
- "required": [
- "code",
- "msg",
- "data"
- ],
- "additionalProperties": true
- }
- ]
- }
- },
{
"method": "POST",
"path": "/api/mcp/addOAuthClient",
diff --git a/kernel/apicontract/transaction_schema.go b/kernel/apicontract/transaction_schema.go
index 07228d5167..c9adac23fe 100644
--- a/kernel/apicontract/transaction_schema.go
+++ b/kernel/apicontract/transaction_schema.go
@@ -90,7 +90,6 @@ var transactionActionPayloads = []transactionActionPayload{
{"setAttrViewCardCoverPosition", reflect.TypeFor[TransactionCardCoverPosition](), reflect.TypeFor[Null]()},
{"setAttrViewCardSize", reflect.TypeFor[float64](), reflect.TypeFor[Null]()},
{"setAttrViewCardWidth", reflect.TypeFor[float64](), reflect.TypeFor[Null]()},
- {"setAttrViewMap", reflect.TypeFor[AVMapSettings](), reflect.TypeFor[Null]()},
{"setAttrViewCalendar", reflect.TypeFor[AVCalendarSettings](), reflect.TypeFor[Null]()},
{"setAttrViewCardLayout", reflect.TypeFor[float64](), reflect.TypeFor[Null]()},
{"setAttrViewColFullRow", reflect.TypeFor[bool](), reflect.TypeFor[Null]()},
diff --git a/kernel/av/av.go b/kernel/av/av.go
index ce4f0c203b..17651f0396 100644
--- a/kernel/av/av.go
+++ b/kernel/av/av.go
@@ -317,7 +317,7 @@ type View struct {
PageSize int `json:"pageSize"` // 每页条目数
LayoutType LayoutType `json:"type"` // 当前布局类型
Table *LayoutTable `json:"table,omitempty"` // 表格布局
- Map *LayoutMap `json:"map,omitempty"` // 地图布局
+ LegacyMap json.RawMessage `json:"map,omitempty"` // 仅保留旧地图配置,不参与渲染或修改
Calendar *LayoutCalendar `json:"calendar,omitempty"`
List *LayoutList `json:"list,omitempty"` // 列表布局
Gallery *LayoutGallery `json:"gallery,omitempty"` // 卡片布局
@@ -334,6 +334,8 @@ type View struct {
GroupFolded bool `json:"groupFolded"` // 分组是否折叠
GroupHidden int `json:"groupHidden"` // 分组是否隐藏,0:显示,1:空白隐藏,2:手动隐藏
GroupSort int `json:"groupSort"` // 分组排序值,用于手动排序
+
+ legacyMapFallback bool
}
// ViewData 用于序列化视图数据到前端。
@@ -348,7 +350,7 @@ type ViewData struct {
}
func (view *View) IsGroupView() bool {
- return LayoutTypeCalendar != view.LayoutType && LayoutTypeMap != view.LayoutType && nil != view.Group && "" != view.Group.Field
+ return LayoutTypeCalendar != view.LayoutType && nil != view.Group && "" != view.Group.Field
}
// GetGroupValue 获取分组视图的分组值。
@@ -425,7 +427,6 @@ type LayoutType string
const (
LayoutTypeTable LayoutType = "table" // 属性视图类型 - 表格
LayoutTypeCalendar LayoutType = "calendar"
- LayoutTypeMap LayoutType = "map"
LayoutTypeList LayoutType = "list" // 属性视图类型 - 列表
LayoutTypeGallery LayoutType = "gallery" // 属性视图类型 - 卡片
LayoutTypeKanban LayoutType = "kanban" // 属性视图类型 - 看板
@@ -619,6 +620,11 @@ func parseAttributeViewSearchInfo(data []byte) (ret *AttributeViewSearchInfo, er
if err = json.Unmarshal(data, ret); err != nil {
return
}
+ for _, view := range ret.Views {
+ if view != nil && view.LayoutType == "map" {
+ view.LayoutType = LayoutTypeTable
+ }
+ }
err = CheckSpec(&AttributeView{Spec: ret.Spec})
return
}
@@ -1388,11 +1394,6 @@ func (av *AttributeView) Clone() (ret *AttributeView) {
column.ID = keyIDMap[column.ID]
}
}
- if nil != view.Map {
- if id := keyIDMap[view.Map.Settings.LocationKeyID]; id != "" {
- view.Map.Settings.LocationKeyID = id
- }
- }
if nil != view.Calendar {
if id := keyIDMap[view.Calendar.Settings.DateKeyID]; id != "" {
view.Calendar.Settings.DateKeyID = id
@@ -1456,7 +1457,6 @@ var (
ErrInvalidColumnAlign = errors.New("invalid column align")
ErrSpecTooNew = errors.New("attribute view spec is too new")
ErrRichTextSpecMismatch = errors.New("attribute view rich text requires storage spec 9")
- ErrMapSpecMismatch = errors.New("attribute view map requires storage spec 13")
ErrLocationSpecMismatch = errors.New("attribute view location requires storage spec 13")
ErrFilterTooDeep = errors.New("filter nesting depth exceeds the maximum allowed")
)
diff --git a/kernel/av/av_fix.go b/kernel/av/av_fix.go
index a19e2130e0..da812ea016 100644
--- a/kernel/av/av_fix.go
+++ b/kernel/av/av_fix.go
@@ -30,9 +30,8 @@ const (
CurrentSpec = 13
PlainTextSpec = 8
RichTextSpec = 9
- // 单一 WGS84 位置和内置底图使用独立版本,防止其他格式的内核重写坐标含义。
+ // 单一 WGS84 位置使用独立版本,防止其他格式的内核重写坐标含义。
LocationSpec = 13
- MapSpec = 13
)
const MaxFilterNestingDepth = 3
@@ -55,9 +54,6 @@ func UpgradeSpec(av *AttributeView) {
if av.Spec < LocationSpec && av.HasLocation() {
av.Spec = LocationSpec
}
- if av.HasMap() {
- av.Spec = MapSpec
- }
}
// upgradeSpec10 仅为包含列表或日历配置的数据库升级,保留其他数据库的旧版兼容性。
@@ -94,9 +90,6 @@ func CheckSpec(av *AttributeView) (err error) {
err = ErrSpecTooNew
return
}
- if av.Spec < MapSpec && av.HasMap() {
- return ErrMapSpecMismatch
- }
if av.Spec < LocationSpec && av.HasLocation() {
return ErrLocationSpecMismatch
}
diff --git a/kernel/av/layout.go b/kernel/av/layout.go
index 5fa1fa9720..bce6dd81a1 100644
--- a/kernel/av/layout.go
+++ b/kernel/av/layout.go
@@ -16,11 +16,9 @@
package av
-// ValidateLayouts 统一校验地图、日历和列表布局,拒绝损坏数据并保留原始文件。
+// ValidateLayouts 统一校验日历和列表布局,拒绝损坏数据并保留原始文件。
func (attrView *AttributeView) ValidateLayouts() error {
- if err := attrView.ValidateMapLayouts(); err != nil {
- return err
- }
+ attrView.restoreLegacyMapColumns()
if err := attrView.ValidateCalendarLayouts(); err != nil {
return err
}
@@ -87,7 +85,7 @@ type BaseInstance struct {
func NewViewBaseInstance(view *View) *BaseInstance {
showIcon, wrapField := true, false
switch view.LayoutType {
- case LayoutTypeTable, LayoutTypeList, LayoutTypeCalendar, LayoutTypeMap:
+ case LayoutTypeTable, LayoutTypeList, LayoutTypeCalendar:
showIcon = view.GetTableLayout().ShowIcon
wrapField = view.GetTableLayout().WrapField
case LayoutTypeGallery:
diff --git a/kernel/av/layout_calendar.go b/kernel/av/layout_calendar.go
index 4f5e66ad9a..0f7c1067a5 100644
--- a/kernel/av/layout_calendar.go
+++ b/kernel/av/layout_calendar.go
@@ -245,9 +245,6 @@ func FilterCalendarRows(calendar *Calendar, dateRange *CalendarRange, targetItem
// TableLayouts 枚举所有暂存的行列布局,确保字段删除、颜色和模板更新覆盖未激活布局。
func (view *View) TableLayouts() []*LayoutTable {
ret := []*LayoutTable{view.Table, view.List}
- if nil != view.Map {
- ret = append(ret, view.Map.LayoutTable)
- }
if nil != view.Calendar {
ret = append(ret, view.Calendar.LayoutTable)
}
diff --git a/kernel/av/layout_legacy_map.go b/kernel/av/layout_legacy_map.go
new file mode 100644
index 0000000000..fd835f1ba0
--- /dev/null
+++ b/kernel/av/layout_legacy_map.go
@@ -0,0 +1,82 @@
+// SiYuan - From thought to insight, with agents
+// Copyright (c) 2020-present, b3log.org
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+package av
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+// UnmarshalJSON 原样保留已撤回的地图配置,并用表格读取记录。
+// 优先保留已有表格设置,否则沿用旧地图的字段顺序;未知地图设置不参与运行时或公开响应。
+func (view *View) UnmarshalJSON(data []byte) error {
+ type plainView View
+ next := plainView(*view)
+ if err := json.Unmarshal(data, &next); err != nil {
+ return err
+ }
+ next.legacyMapFallback = false
+ if next.LayoutType == "map" {
+ next.LayoutType = LayoutTypeTable
+ next.legacyMapFallback = true
+ if next.Table != nil {
+ if next.Table.BaseLayout == nil || next.Table.Spec != 0 {
+ return fmt.Errorf("invalid stored table layout in retired map view [%s]", next.ID)
+ }
+ for _, column := range next.Table.Columns {
+ if column == nil || column.BaseField == nil {
+ return fmt.Errorf("invalid stored table field in retired map view [%s]", next.ID)
+ }
+ }
+ }
+ if next.Table == nil {
+ var layout LayoutTable
+ if err := json.Unmarshal(next.LegacyMap, &layout); err == nil && layout.BaseLayout != nil && layout.Spec == 0 {
+ valid := true
+ for _, column := range layout.Columns {
+ if column == nil || column.BaseField == nil {
+ valid = false
+ break
+ }
+ }
+ if valid {
+ next.Table = &layout
+ }
+ }
+ if next.Table == nil {
+ next.Table = NewLayoutTable()
+ }
+ }
+ }
+ *view = View(next)
+ return nil
+}
+
+// 旧地图或未知地图格式回退后仍须提供数据库中的所有字段。
+func (attrView *AttributeView) restoreLegacyMapColumns() {
+ var restore func(*View)
+ restore = func(view *View) {
+ if view == nil {
+ return
+ }
+ if view.legacyMapFallback {
+ seen := map[string]bool{}
+ for _, column := range view.Table.Columns {
+ seen[column.ID] = true
+ }
+ for _, keyValues := range attrView.KeyValues {
+ if keyValues != nil && keyValues.Key != nil && !seen[keyValues.Key.ID] {
+ view.Table.Columns = append(view.Table.Columns, &ViewTableColumn{BaseField: &BaseField{ID: keyValues.Key.ID}})
+ }
+ }
+ }
+ for _, group := range view.Groups {
+ restore(group)
+ }
+ }
+ for _, view := range attrView.Views {
+ restore(view)
+ }
+}
diff --git a/kernel/av/layout_legacy_map_test.go b/kernel/av/layout_legacy_map_test.go
new file mode 100644
index 0000000000..8aee462aab
--- /dev/null
+++ b/kernel/av/layout_legacy_map_test.go
@@ -0,0 +1,105 @@
+package av
+
+import (
+ "bytes"
+ "encoding/json"
+ "reflect"
+ "testing"
+)
+
+func TestLegacyMapLayoutPreservesStorageAsTable(t *testing.T) {
+ const rawMap = `{"spec":0,"id":"layout","showIcon":true,"columns":[{"id":"location","hidden":false,"width":"180px"}],"rowIds":["item"],"settings":{"locationKeyID":"location","height":640,"future":{"preserve":true}}}`
+ const rawLocation = `{"id":"location","keyID":"location","blockID":"item","type":"location","location":{"name":"Office","latitude":0,"longitude":120,"originalInput":"120,0"}}`
+ input := []byte(`{"id":"database","spec":13,"keyValues":[{"key":{"id":"location","type":"location"},"values":[` + rawLocation + `]}],"views":[{"id":"view","type":"map","map":` + rawMap + `,"itemIds":["item"],"groups":[{"id":"nested","type":"map","map":` + rawMap + `}]}]}`)
+ original := bytes.Clone(input)
+ database, err := ParseAttributeViewData("database", input)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, view := range []*View{database.Views[0], database.Views[0].Groups[0]} {
+ if view.LayoutType != LayoutTypeTable || view.Table == nil || len(view.Table.Columns) != 1 || view.Table.Columns[0].ID != "location" {
+ t.Fatalf("legacy records did not open as a table: %+v", view)
+ }
+ if string(view.LegacyMap) != rawMap {
+ t.Fatalf("legacy map settings changed: %s", view.LegacyMap)
+ }
+ }
+ locationBefore := *database.KeyValues[0].Values[0].Location
+ for i := 0; i < 2; i++ {
+ data, marshalErr := json.Marshal(database)
+ if marshalErr != nil {
+ t.Fatal(marshalErr)
+ }
+ database, err = ParseAttributeViewData("database", data)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(database.Views[0].LegacyMap) != rawMap || string(database.Views[0].Groups[0].LegacyMap) != rawMap ||
+ !reflect.DeepEqual(locationBefore, *database.KeyValues[0].Values[0].Location) || database.Views[0].ItemIDs[0] != "item" {
+ t.Fatal("round trip lost legacy configuration, records, or coordinates")
+ }
+ }
+ if !bytes.Equal(input, original) {
+ t.Fatal("reading modified the input bytes")
+ }
+}
+
+func TestLegacyMapFallbackRetainsUnsupportedSettingsAndOtherLayouts(t *testing.T) {
+ for _, rawMap := range []string{`{"spec":99,"settings":{"provider":"unknown"}}`, `{"columns":[null]}`, `null`, `{}`, `[]`} {
+ for _, layout := range []string{"map", "table", "list", "calendar", "gallery", "kanban"} {
+ var view View
+ data := []byte(`{"type":"` + layout + `","table":{"spec":0,"id":"existing-table","showIcon":true,"columns":[]},"map":` + rawMap + `}`)
+ if err := json.Unmarshal(data, &view); err != nil {
+ t.Fatal(err)
+ }
+ if view.Table.ID != "existing-table" || string(view.LegacyMap) != rawMap {
+ t.Fatal("existing table or unknown map settings changed")
+ }
+ wantLayout := LayoutType(layout)
+ if layout == "map" {
+ wantLayout = LayoutTypeTable
+ }
+ if view.LayoutType != wantLayout {
+ t.Fatalf("unrelated layout changed: %s", view.LayoutType)
+ }
+ }
+ var view View
+ if err := json.Unmarshal([]byte(`{"type":"map","map":`+rawMap+`}`), &view); err != nil || view.Table == nil || view.Table.BaseLayout == nil {
+ t.Fatalf("unsupported map settings prevented a safe table fallback: %v", err)
+ }
+ }
+}
+
+func TestLegacyMapSearchMetadataUsesTable(t *testing.T) {
+ info, err := parseAttributeViewSearchInfo([]byte(`{"spec":13,"views":[null,{"id":"legacy","name":"Places","type":"map"},{"id":"calendar","type":"calendar"}]}`))
+ if err != nil || info.Views[1].LayoutType != LayoutTypeTable || info.Views[2].LayoutType != LayoutTypeCalendar {
+ t.Fatalf("legacy search metadata did not use the table fallback: %+v, %v", info, err)
+ }
+}
+
+func TestLegacyMapRejectsCorruptStoredTableWithoutMutatingSource(t *testing.T) {
+ for _, table := range []string{`{}`, `{"spec":0,"columns":[null]}`, `{"spec":99,"columns":[]}`} {
+ input := []byte(`{"spec":13,"views":[{"id":"legacy","type":"map","map":{"spec":0,"settings":{"height":640}},"table":` + table + `}]}`)
+ before := bytes.Clone(input)
+ if _, err := ParseAttributeViewData("database", input); err == nil {
+ t.Fatalf("corrupt stored table accepted: %s", table)
+ }
+ if !bytes.Equal(input, before) {
+ t.Fatal("rejected read changed source bytes")
+ }
+ }
+}
+
+func TestLegacyMapUnknownLayoutKeepsDatabaseFieldsReadable(t *testing.T) {
+ input := []byte(`{"spec":13,"keyValues":[{"key":{"id":"title","type":"block"},"values":[{"keyID":"title","blockID":"item","type":"block","isDetached":true,"block":{"content":"Office"}}]},{"key":{"id":"location","type":"location"},"values":[{"keyID":"location","blockID":"item","type":"location","location":{"name":"Office","latitude":0,"longitude":120}}]}],"views":[{"type":"map","map":{"spec":99,"settings":{"future":true}},"itemIds":["item"]}]}`)
+ database, err := ParseAttributeViewData("database", input)
+ if err != nil {
+ t.Fatal(err)
+ }
+ view := database.Views[0]
+ if view.LayoutType != LayoutTypeTable || len(view.Table.Columns) != 2 ||
+ view.Table.Columns[0].ID != "title" || view.Table.Columns[1].ID != "location" ||
+ database.GetValue("location", "item").Location.Name != "Office" || len(view.LegacyMap) == 0 {
+ t.Fatal("unknown retired map settings hid records or database fields")
+ }
+}
diff --git a/kernel/av/layout_list.go b/kernel/av/layout_list.go
index 278f942c30..f72e2e32e0 100644
--- a/kernel/av/layout_list.go
+++ b/kernel/av/layout_list.go
@@ -33,9 +33,6 @@ func NewLayoutList() *LayoutList {
// GetTableLayout 返回当前布局使用的行列字段设置。
func (view *View) GetTableLayout() *LayoutTable {
- if LayoutTypeMap == view.LayoutType {
- return view.Map.LayoutTable
- }
if LayoutTypeCalendar == view.LayoutType {
return view.Calendar.LayoutTable
}
@@ -45,7 +42,7 @@ func (view *View) GetTableLayout() *LayoutTable {
return view.Table
}
-// TableFromViewable 获取表格、列表、日历或地图实例的行列数据。
+// TableFromViewable 获取表格、列表或日历实例的行列数据。
func TableFromViewable(viewable Viewable) *Table {
switch instance := viewable.(type) {
case *Table:
@@ -54,8 +51,6 @@ func TableFromViewable(viewable Viewable) *Table {
return instance.Table
case *Calendar:
return instance.Table
- case *Map:
- return instance.Table
}
return nil
}
diff --git a/kernel/av/layout_map.go b/kernel/av/layout_map.go
deleted file mode 100644
index c8d362fc0e..0000000000
--- a/kernel/av/layout_map.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-package av
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
-
- "github.com/88250/lute/ast"
-)
-
-// MapSettings 保存位置字段绑定和视图高度,底图固定为 OpenFreeMap。
-type MapSettings struct {
- LocationKeyID string `json:"locationKeyID"`
- Height int `json:"height,omitempty"` // 缺省为 480px;0 仅表示未保存此选项。
-}
-
-// UnmarshalJSON 拒绝额外设置,避免把不支持的地图结构静默保存为新结构。
-func (settings *MapSettings) UnmarshalJSON(data []byte) error {
- type plainSettings MapSettings
- var next struct {
- plainSettings
- Height json.RawMessage `json:"height"`
- }
- decoder := json.NewDecoder(bytes.NewReader(data))
- decoder.DisallowUnknownFields()
- if err := decoder.Decode(&next); err != nil {
- return err
- }
- if next.Height != nil {
- if err := json.Unmarshal(next.Height, &next.plainSettings.Height); err != nil {
- return err
- }
- if next.plainSettings.Height == 0 {
- return fmt.Errorf("invalid map height")
- }
- }
- parsed := MapSettings(next.plainSettings)
- if err := parsed.Validate(); err != nil {
- return err
- }
- *settings = parsed
- return nil
-}
-
-// Validate 允许缺失的字段引用,保持跨设备、删除和撤销后的原始绑定。
-func (settings MapSettings) Validate() error {
- if settings.LocationKeyID != "" && !ast.IsNodeIDPattern(settings.LocationKeyID) {
- return fmt.Errorf("invalid map location field ID")
- }
- switch settings.Height {
- case 0, 320, 480, 640, 800:
- default:
- return fmt.Errorf("invalid map height")
- }
- return nil
-}
-
-// LayoutMap 复用表格的数据字段、筛选、排序及分页。
-type LayoutMap struct {
- *LayoutTable
- Settings MapSettings `json:"settings"`
-}
-
-type Map struct {
- *Table
- // 保留筛选和排序后的完整行集,供发布权限过滤后重新分页和未定位条目查询;绝不序列化给客户端。
- RowsBeforePagination []*TableRow `json:"-"`
-}
-
-func (*Map) GetType() LayoutType { return LayoutTypeMap }
-
-func NewMapView() *View {
- view := NewTableView()
- view.Name = GetAttributeViewI18n("map")
- view.LayoutType = LayoutTypeMap
- view.Map = &LayoutMap{LayoutTable: view.Table}
- view.Table = nil
- return view
-}
-
-// HasMap 包含未激活和分组内暂存的地图配置,防止旧内核重写后丢失设置。
-func (attrView *AttributeView) HasMap() bool {
- if attrView == nil {
- return false
- }
- var hasMap func(*View) bool
- hasMap = func(view *View) bool {
- if view == nil {
- return false
- }
- if view.Map != nil || view.LayoutType == LayoutTypeMap {
- return true
- }
- for _, group := range view.Groups {
- if hasMap(group) {
- return true
- }
- }
- return false
- }
- for _, view := range attrView.Views {
- if hasMap(view) {
- return true
- }
- }
- return false
-}
-
-// ValidateMapLayouts 拒绝损坏或未知版本的地图配置,不修复、不覆盖源文件。
-func (attrView *AttributeView) ValidateMapLayouts() error {
- var validate func(*View) error
- validate = func(view *View) error {
- if view == nil {
- return nil
- }
- if view.LayoutType == LayoutTypeMap && view.Map == nil {
- return fmt.Errorf("map layout missing in view [%s]", view.ID)
- }
- if layout := view.Map; layout != nil {
- if layout.LayoutTable == nil || layout.BaseLayout == nil || layout.Spec != 0 {
- return fmt.Errorf("invalid map layout in view [%s]", view.ID)
- }
- if err := layout.Settings.Validate(); err != nil {
- return err
- }
- for _, column := range layout.Columns {
- if column == nil || column.BaseField == nil {
- return fmt.Errorf("invalid map field in view [%s]", view.ID)
- }
- }
- }
- for _, group := range view.Groups {
- if err := validate(group); err != nil {
- return err
- }
- }
- return nil
- }
- for _, view := range attrView.Views {
- if err := validate(view); err != nil {
- return err
- }
- }
- return nil
-}
diff --git a/kernel/av/layout_map_test.go b/kernel/av/layout_map_test.go
deleted file mode 100644
index 7dad632596..0000000000
--- a/kernel/av/layout_map_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package av
-
-import (
- "bytes"
- "encoding/json"
- "testing"
-
- "github.com/88250/lute/ast"
-)
-
-func TestMapPrivatePaginationBufferIsNotSerialized(t *testing.T) {
- mapped := &Map{Table: &Table{Rows: []*TableRow{}}, RowsBeforePagination: []*TableRow{{ID: "private-row-buffer"}}}
- data, err := json.Marshal(mapped)
- if err != nil || bytes.Contains(data, []byte("private-row-buffer")) {
- t.Fatalf("private map pagination buffer escaped: %s, %v", data, err)
- }
-}
-
-func TestMapConditionalSpecAndValidation(t *testing.T) {
- for _, spec := range []int{PlainTextSpec, RichTextSpec, 10, 11, 12, CurrentSpec} {
- plain := &AttributeView{Spec: spec}
- UpgradeSpec(plain)
- if plain.Spec != spec {
- t.Fatalf("unrelated database upgraded from %d to %d", spec, plain.Spec)
- }
- }
- for _, nested := range []bool{false, true} {
- view := &View{LayoutType: LayoutTypeTable, Map: &LayoutMap{LayoutTable: NewLayoutTable(),
- Settings: MapSettings{LocationKeyID: ast.NewNodeID()}}}
- attrView := &AttributeView{Spec: 12, Views: []*View{view}}
- if nested {
- attrView.Views = []*View{{Groups: []*View{view}}}
- }
- if CheckSpec(attrView) != ErrMapSpecMismatch {
- t.Fatal("stored map settings bypassed the specification gate")
- }
- UpgradeSpec(attrView)
- if attrView.Spec != MapSpec {
- t.Fatalf("map specification: %d", attrView.Spec)
- }
- data, _ := json.Marshal(attrView)
- if _, err := ParseAttributeViewData("map", data); err != nil {
- t.Fatal(err)
- }
- view.Map.Spec = 1
- data, _ = json.Marshal(attrView)
- if _, err := ParseAttributeViewData("map", data); err == nil {
- t.Fatal("future map layout accepted")
- }
- }
- for _, layout := range []*LayoutMap{nil, {}, {LayoutTable: &LayoutTable{}},
- {LayoutTable: &LayoutTable{BaseLayout: &BaseLayout{}, Columns: []*ViewTableColumn{nil}}}} {
- attrView := &AttributeView{Spec: MapSpec, Views: []*View{{LayoutType: LayoutTypeMap, Map: layout}}}
- if attrView.ValidateMapLayouts() == nil {
- t.Fatal("corrupt map layout accepted")
- }
- }
- if CheckSpec(&AttributeView{Spec: CurrentSpec + 1}) != ErrSpecTooNew {
- t.Fatal("future database accepted")
- }
-}
-
-func TestMapSettingsValidation(t *testing.T) {
- for _, settings := range []MapSettings{{}, {LocationKeyID: ast.NewNodeID()}} {
- if err := settings.Validate(); err != nil {
- t.Fatal(err)
- }
- }
- for _, settings := range []MapSettings{{LocationKeyID: "invalid"}, {LocationKeyID: " key"}} {
- if settings.Validate() == nil {
- t.Fatalf("invalid map settings accepted: %+v", settings)
- }
- }
-}
-
-func TestMapSettingsHeight(t *testing.T) {
- for _, height := range []int{0, 320, 480, 640, 800} {
- settings := MapSettings{Height: height}
- data, err := json.Marshal(settings)
- if err != nil {
- t.Fatal(err)
- }
- var restored MapSettings
- if err = json.Unmarshal(data, &restored); err != nil || restored != settings {
- t.Fatalf("height roundtrip %d: %+v, %v", height, restored, err)
- }
- if height == 0 && bytes.Contains(data, []byte("height")) {
- t.Fatal("omitted height must remain omitted")
- }
- }
- for _, height := range []string{"0", "null", "-1", "400", "480.5", `"480"`, "true", "{}"} {
- settings := MapSettings{Height: 640}
- if err := json.Unmarshal([]byte(`{"locationKeyID":"","height":`+height+`}`), &settings); err == nil {
- t.Fatalf("invalid height accepted: %s", height)
- }
- if settings.Height != 640 {
- t.Fatal("invalid height mutated settings")
- }
- }
-}
-
-func TestMapSettingsJSONRejectsLegacyFieldsWithoutMutation(t *testing.T) {
- for _, payload := range []string{
- `{"locationKeyID":"","serviceID":"openfreemap"}`,
- `{"locationKeyID":"","serviceID":""}`,
- `{"locationKeyID":"","showRecordList":true}`,
- `{"locationKeyID":"","showRecordList":false}`,
- `{"locationKeyID":"","apiKey":"secret"}`,
- } {
- settings := MapSettings{LocationKeyID: ast.NewNodeID()}
- before := settings
- if err := json.Unmarshal([]byte(payload), &settings); err == nil {
- t.Fatalf("legacy map setting accepted: %s", payload)
- }
- if settings != before {
- t.Fatalf("rejected settings changed field binding: %s", payload)
- }
- }
-}
diff --git a/kernel/av/layout_table.go b/kernel/av/layout_table.go
index 7362581917..f5b3ae1245 100644
--- a/kernel/av/layout_table.go
+++ b/kernel/av/layout_table.go
@@ -71,8 +71,6 @@ type ViewTableColumn struct {
type Table struct {
*BaseInstance
- Map *MapSettings `json:"map,omitempty"`
- MapMarkerScope string `json:"mapMarkerScope,omitempty"` // 地图标记与当前返回页保持一致
Calendar *CalendarSettings `json:"calendar,omitempty"`
CalendarRange *CalendarRange `json:"calendarRange,omitempty"`
CalendarTargetDate *int64 `json:"calendarTargetDate,omitempty"`
diff --git a/kernel/av/layout_test.go b/kernel/av/layout_test.go
index fc2281eae2..b6850b5c67 100644
--- a/kernel/av/layout_test.go
+++ b/kernel/av/layout_test.go
@@ -9,18 +9,15 @@ func TestValidateLayoutsPreservesOrderAndNestedValidation(t *testing.T) {
for _, nested := range []bool{false, true} {
list := &View{ID: "list", LayoutType: LayoutTypeList}
calendar := &View{ID: "calendar", LayoutType: LayoutTypeCalendar}
- mapped := &View{ID: "map", LayoutType: LayoutTypeMap}
- database := &AttributeView{Views: []*View{nil, list, calendar, mapped}}
+ database := &AttributeView{Views: []*View{nil, list, calendar}}
if nested {
database.Views = []*View{{Groups: database.Views}}
}
- for _, layout := range []string{"map", "calendar", "list"} {
+ for _, layout := range []string{"calendar", "list"} {
if err := database.ValidateLayouts(); err == nil || !strings.HasPrefix(err.Error(), layout+" layout missing") {
t.Fatalf("nested=%t expected %s validation first, got %v", nested, layout, err)
}
switch layout {
- case "map":
- mapped.Map = &LayoutMap{LayoutTable: NewLayoutTable()}
case "calendar":
calendar.Calendar = &LayoutCalendar{LayoutTable: NewLayoutTable()}
case "list":
diff --git a/kernel/av/location_map_spec_test.go b/kernel/av/location_map_spec_test.go
deleted file mode 100644
index de21a43728..0000000000
--- a/kernel/av/location_map_spec_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package av
-
-import (
- "encoding/json"
- "testing"
-)
-
-func TestLocationAndMapWGS84StorageSpec(t *testing.T) {
- for _, spec := range []int{PlainTextSpec, RichTextSpec, 10, 11, 12} {
- plain := &AttributeView{Spec: spec}
- UpgradeSpec(plain)
- if plain.Spec != spec {
- t.Fatalf("unrelated database changed from spec %d to %d", spec, plain.Spec)
- }
- for _, mapped := range []bool{false, true} {
- view := &AttributeView{Spec: spec, KeyValues: []*KeyValues{{Key: &Key{Type: KeyTypeLocation}}}}
- wantErr := ErrLocationSpecMismatch
- if mapped {
- view.Views = []*View{{LayoutType: LayoutTypeMap, Map: &LayoutMap{LayoutTable: NewLayoutTable()}}}
- wantErr = ErrMapSpecMismatch
- }
- data, err := json.Marshal(view)
- if err != nil {
- t.Fatal(err)
- }
- if _, err = ParseAttributeViewData("location", data); err != wantErr {
- t.Fatalf("spec %d accepted WGS84 data: %v", spec, err)
- }
- UpgradeSpec(view)
- if view.Spec != 13 {
- t.Fatalf("new WGS84 data can be rewritten by a spec-12 kernel: %d", view.Spec)
- }
- data, err = json.Marshal(view)
- if err != nil {
- t.Fatal(err)
- }
- if _, err = ParseAttributeViewData("location", data); err != nil {
- t.Fatalf("new WGS84 storage spec rejected: %v", err)
- }
- }
- }
-}
diff --git a/kernel/av/location_spec_test.go b/kernel/av/location_spec_test.go
new file mode 100644
index 0000000000..cda586b255
--- /dev/null
+++ b/kernel/av/location_spec_test.go
@@ -0,0 +1,36 @@
+package av
+
+import (
+ "encoding/json"
+ "testing"
+)
+
+func TestLocationWGS84StorageSpec(t *testing.T) {
+ for _, spec := range []int{PlainTextSpec, RichTextSpec, 10, 11, 12} {
+ plain := &AttributeView{Spec: spec}
+ UpgradeSpec(plain)
+ if plain.Spec != spec {
+ t.Fatalf("unrelated database changed from spec %d to %d", spec, plain.Spec)
+ }
+ view := &AttributeView{Spec: spec, KeyValues: []*KeyValues{{Key: &Key{Type: KeyTypeLocation}}}}
+ data, err := json.Marshal(view)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err = ParseAttributeViewData("location", data); err != ErrLocationSpecMismatch {
+ t.Fatalf("spec %d accepted WGS84 data: %v", spec, err)
+ }
+ UpgradeSpec(view)
+ if view.Spec != 13 {
+ t.Fatalf("new WGS84 data can be rewritten by a spec-12 kernel: %d", view.Spec)
+ }
+ data, err = json.Marshal(view)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err = ParseAttributeViewData("location", data); err != nil {
+ t.Fatalf("new WGS84 storage spec rejected: %v", err)
+ }
+
+ }
+}
diff --git a/kernel/av/testdata/spec13-retired-map.json b/kernel/av/testdata/spec13-retired-map.json
new file mode 100644
index 0000000000..b148c779c1
--- /dev/null
+++ b/kernel/av/testdata/spec13-retired-map.json
@@ -0,0 +1,149 @@
+{
+ "spec": 13,
+ "id": "20260921000000-layouts",
+ "name": "Layout compatibility",
+ "keyValues": [
+ {
+ "key": {
+ "id": "20260921000001-primary",
+ "name": "Title",
+ "type": "block"
+ },
+ "values": [
+ {
+ "id": "20260921000004-value01",
+ "keyID": "20260921000001-primary",
+ "blockID": "20260921000003-example",
+ "type": "block",
+ "isDetached": true,
+ "block": {
+ "content": "Example",
+ "created": 1789948800000,
+ "updated": 1789948800000
+ }
+ }
+ ]
+ },
+ {
+ "key": {
+ "id": "20260921000002-datekey",
+ "name": "Date",
+ "type": "date"
+ },
+ "values": [
+ {
+ "id": "20260921000005-value02",
+ "keyID": "20260921000002-datekey",
+ "blockID": "20260921000003-example",
+ "type": "date",
+ "date": {
+ "content": 1789948800000,
+ "isNotEmpty": true,
+ "isNotTime": true
+ }
+ }
+ ]
+ },
+ {
+ "key": {
+ "id": "20261009000001-locakey",
+ "name": "Location",
+ "type": "location"
+ },
+ "values": [
+ {
+ "id": "20261009000002-locaval",
+ "keyID": "20261009000001-locakey",
+ "blockID": "20260921000003-example",
+ "type": "location",
+ "location": {
+ "name": "Office",
+ "latitude": 0,
+ "longitude": 120,
+ "originalInput": "120,0"
+ }
+ }
+ ]
+ }
+ ],
+ "views": [
+ {
+ "id": "20260921000010-table00",
+ "name": "Places",
+ "type": "map",
+ "pageSize": 50,
+ "itemIds": [
+ "20260921000003-example"
+ ],
+ "map": {
+ "spec": 0,
+ "id": "20260921000011-table01",
+ "showIcon": true,
+ "columns": [
+ {
+ "id": "20260921000001-primary"
+ },
+ {
+ "id": "20260921000002-datekey"
+ },
+ {
+ "id": "20261009000001-locakey"
+ }
+ ],
+ "settings": {
+ "locationKeyID": "20261009000001-locakey",
+ "height": 640
+ }
+ }
+ },
+ {
+ "id": "20260921000020-list000",
+ "name": "List",
+ "type": "list",
+ "pageSize": 50,
+ "itemIds": [
+ "20260921000003-example"
+ ],
+ "list": {
+ "spec": 0,
+ "id": "20260921000021-list001",
+ "showIcon": true,
+ "columns": [
+ {
+ "id": "20260921000001-primary"
+ },
+ {
+ "id": "20260921000002-datekey",
+ "hidden": true
+ }
+ ]
+ }
+ },
+ {
+ "id": "20260921000030-calendr",
+ "name": "Calendar",
+ "type": "calendar",
+ "pageSize": 50,
+ "itemIds": [
+ "20260921000003-example"
+ ],
+ "calendar": {
+ "spec": 0,
+ "id": "20260921000031-calendr",
+ "showIcon": true,
+ "columns": [
+ {
+ "id": "20260921000001-primary"
+ },
+ {
+ "id": "20260921000002-datekey"
+ }
+ ],
+ "settings": {
+ "dateKeyID": "20260921000002-datekey",
+ "weekStart": 1
+ }
+ }
+ }
+ ]
+}
diff --git a/kernel/cli/cmd/database.go b/kernel/cli/cmd/database.go
index aaf74d4f4e..aefc79da6c 100644
--- a/kernel/cli/cmd/database.go
+++ b/kernel/cli/cmd/database.go
@@ -494,8 +494,6 @@ func databaseViewBase(viewable av.Viewable) (ret *av.BaseInstance) {
ret = view.BaseInstance
case *av.List:
ret = view.BaseInstance
- case *av.Map:
- ret = view.BaseInstance
case *av.Gallery:
ret = view.BaseInstance
case *av.Kanban:
diff --git a/kernel/cli/cmd/database_test.go b/kernel/cli/cmd/database_test.go
index 93a0162789..9836d0286d 100644
--- a/kernel/cli/cmd/database_test.go
+++ b/kernel/cli/cmd/database_test.go
@@ -47,9 +47,6 @@ func TestWriteRenderedDatabaseView(t *testing.T) {
if count := writeRenderedView(&output, attrView, table, false); count != 1 {
t.Fatalf("unexpected rendered item count: %d", count)
}
- if databaseViewBase(&av.Map{Table: table}) != table.BaseInstance {
- t.Fatal("map record metadata is missing")
- }
result := output.String()
if !strings.Contains(result, "ITEM_ID") || !strings.Contains(result, stateKey.Name) ||
!strings.Contains(result, "20260806000000-item001") || !strings.Contains(result, "Todo") {
diff --git a/kernel/mcp/tools/database.go b/kernel/mcp/tools/database.go
index 8e757c8fd5..1efc7b3c57 100644
--- a/kernel/mcp/tools/database.go
+++ b/kernel/mcp/tools/database.go
@@ -45,7 +45,7 @@ type databaseToolOutput struct {
var DatabaseTool = &Tool{
Name: "database",
- Description: "Attribute view (database) operations. Every successful call returns {action, data}. Actions: create(parentID, name?, primaryKeyName?, layout=table, keys?, previousID?, nextID?), search(keyword), get(id), render(id, viewID?, query?, page=1, pageSize=50), keys(id), key_add(id, name, type, icon?, prev?), key_update(id, keyID, config), key_set_template(id, keyID, template), key_remove(id, keyID, removeRelationDest?), item_add(id, blockID?, content?, viewID?, groupID?, previousID?, detached?, ignoreDefaultFill?), item_remove(id, itemIDs), item_update(id, keyID, itemID, value), view_get(id, blockID, viewID), view_add(id, blockID, layout?, name?), view_duplicate(id, blockID, viewID, name?), view_remove(id, blockID, viewID), view_update(id, blockID, viewID, name?, icon?, desc?), view_move(id, blockID, viewID, previousID), view_visibility_set(id, blockID, viewIDs), view_filters_set(id, blockID, viewID, revision, filters), view_sorts_set(id, blockID, viewID, revision, sorts), view_group_set(id, blockID, viewID, revision, group), view_layout_set(id, blockID, viewID, revision, layout), unused(), clean(id?). view_get returns metadata, ordered views and the carrier block's visibleViewIDs. view_update preserves omitted fields; empty icon or desc clears it. View metadata and order affect all mirrors; visibility affects only blockID and requires at least one visible view. Read view_get before replacing filters, sorts or visibleViewIDs, preserving unmodified entries. Pass its revision for filter, sort, group and layout changes. An empty filters or sorts array clears that setting. Supported layouts: table, list, gallery, kanban, calendar, map. Map renders only the requested record page; mapMarkerScope is page and rowCount is the filtered total. Map service credentials are device-local and never part of database data. The layout string is validated by the kernel. clean only removes unused databases returned by unused(); referenced databases are rejected.",
+ Description: "Attribute view (database) operations. Every successful call returns {action, data}. Actions: create(parentID, name?, primaryKeyName?, layout=table, keys?, previousID?, nextID?), search(keyword), get(id), render(id, viewID?, query?, page=1, pageSize=50), keys(id), key_add(id, name, type, icon?, prev?), key_update(id, keyID, config), key_set_template(id, keyID, template), key_remove(id, keyID, removeRelationDest?), item_add(id, blockID?, content?, viewID?, groupID?, previousID?, detached?, ignoreDefaultFill?), item_remove(id, itemIDs), item_update(id, keyID, itemID, value), view_get(id, blockID, viewID), view_add(id, blockID, layout?, name?), view_duplicate(id, blockID, viewID, name?), view_remove(id, blockID, viewID), view_update(id, blockID, viewID, name?, icon?, desc?), view_move(id, blockID, viewID, previousID), view_visibility_set(id, blockID, viewIDs), view_filters_set(id, blockID, viewID, revision, filters), view_sorts_set(id, blockID, viewID, revision, sorts), view_group_set(id, blockID, viewID, revision, group), view_layout_set(id, blockID, viewID, revision, layout), unused(), clean(id?). view_get returns metadata, ordered views and the carrier block's visibleViewIDs. view_update preserves omitted fields; empty icon or desc clears it. View metadata and order affect all mirrors; visibility affects only blockID and requires at least one visible view. Read view_get before replacing filters, sorts or visibleViewIDs, preserving unmodified entries. Pass its revision for filter, sort, group and layout changes. An empty filters or sorts array clears that setting. Supported layouts: table, list, gallery, kanban, calendar. The layout string is validated by the kernel. clean only removes unused databases returned by unused(); referenced databases are rejected.",
EffectScope: EffectScopeLocal,
ActionEffects: map[string]ToolEffects{
"create": {LocalWrite: true},
@@ -402,7 +402,7 @@ func databaseViewFieldIDs(view *av.View) (ret []string) {
return
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
if layout := view.GetTableLayout(); nil != layout {
for _, column := range layout.Columns {
if nil != column && "" != column.ID {
diff --git a/kernel/mcp/tools/database_test.go b/kernel/mcp/tools/database_test.go
index e991295eda..1b50de5ef0 100644
--- a/kernel/mcp/tools/database_test.go
+++ b/kernel/mcp/tools/database_test.go
@@ -200,9 +200,6 @@ func TestDatabasePreviousKeyIDDefaultsToViewEnd(t *testing.T) {
func TestDatabaseViewFieldIDsSupportsLayouts(t *testing.T) {
tests := []*av.View{
- {LayoutType: av.LayoutTypeMap, Map: &av.LayoutMap{LayoutTable: &av.LayoutTable{Columns: []*av.ViewTableColumn{
- {BaseField: &av.BaseField{ID: "map-1"}}, {BaseField: &av.BaseField{ID: "map-2", Hidden: true}},
- }}}},
{
LayoutType: av.LayoutTypeList,
List: &av.LayoutList{Columns: []*av.ViewTableColumn{
diff --git a/kernel/mcp/tools/database_view.go b/kernel/mcp/tools/database_view.go
index 427aa473f5..7565fb2fa8 100644
--- a/kernel/mcp/tools/database_view.go
+++ b/kernel/mcp/tools/database_view.go
@@ -348,7 +348,7 @@ func databaseValidateViewGroup(attrView *av.AttributeView, view *av.View, group
}
return nil
}
- if view.LayoutType == av.LayoutTypeCalendar || view.LayoutType == av.LayoutTypeMap {
+ if view.LayoutType == av.LayoutTypeCalendar {
return fmt.Errorf("%s views do not support grouping", view.LayoutType)
}
key, err := attrView.GetKey(group.Field)
diff --git a/kernel/mcp/tools/database_view_test.go b/kernel/mcp/tools/database_view_test.go
index 9c003462ea..70a5673cc2 100644
--- a/kernel/mcp/tools/database_view_test.go
+++ b/kernel/mcp/tools/database_view_test.go
@@ -117,9 +117,6 @@ func TestDatabaseViewConfigurationValidation(t *testing.T) {
if err := databaseValidateViewGroup(attrView, &av.View{LayoutType: av.LayoutTypeCalendar}, &av.ViewGroup{Field: "text"}); nil == err {
t.Fatal("calendar grouping accepted")
}
- if err := databaseValidateViewGroup(attrView, &av.View{LayoutType: av.LayoutTypeMap}, &av.ViewGroup{Field: "text"}); nil == err {
- t.Fatal("map grouping accepted")
- }
if err := databaseValidateViewGroup(attrView, &av.View{LayoutType: av.LayoutTypeKanban}, &av.ViewGroup{}); nil == err {
t.Fatal("kanban grouping cleared")
}
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 3ea21a0b67..890b3f8a77 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -985,7 +985,7 @@ func syncAttrViewTableColWidth(operation *Operation) (err error) {
var width string
switch view.LayoutType {
- case av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeTable:
for _, column := range view.Table.Columns {
@@ -1339,7 +1339,7 @@ func setAttrViewCardAspectRatio(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.CardAspectRatio = ratio
@@ -1380,7 +1380,7 @@ func setAttrViewCardAspectRatioValue(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.CardAspectRatioValue = ratio
@@ -1545,7 +1545,7 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a
}
switch newLayout {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap, av.LayoutTypeGallery, av.LayoutTypeKanban:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeGallery, av.LayoutTypeKanban:
default:
return av.ErrWrongLayoutType
}
@@ -1553,18 +1553,11 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a
oldLayout := view.LayoutType
oldFields := attributeViewFieldIDs(view)
view.LayoutType = newLayout
- if (oldLayout == av.LayoutTypeCalendar || oldLayout == av.LayoutTypeMap) && view.Name == av.GetAttributeViewI18n(string(oldLayout)) {
+ if oldLayout == av.LayoutTypeCalendar && view.Name == av.GetAttributeViewI18n(string(oldLayout)) {
view.Name = av.GetAttributeViewI18n(string(newLayout))
}
switch newLayout {
- case av.LayoutTypeMap:
- if view.Name == av.GetAttributeViewI18n(string(oldLayout)) {
- view.Name = av.GetAttributeViewI18n("map")
- }
- if nil == view.Map {
- view.Map = newAttributeViewMapLayout(attrView, oldFields)
- }
case av.LayoutTypeCalendar:
if view.Name == av.GetAttributeViewI18n(string(oldLayout)) {
view.Name = av.GetAttributeViewI18n("calendar")
@@ -1590,7 +1583,7 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a
view.Table = av.NewLayoutTable()
switch oldLayout {
- case av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeList, av.LayoutTypeCalendar:
for _, id := range oldFields {
view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: id}})
}
@@ -1614,7 +1607,7 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a
view.Gallery = av.NewLayoutGallery()
switch oldLayout {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, id := range oldFields {
view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: &av.BaseField{ID: id}})
}
@@ -1634,7 +1627,7 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a
view.Kanban = av.NewLayoutKanban()
switch oldLayout {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, id := range oldFields {
view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: &av.BaseField{ID: id}})
}
@@ -1674,7 +1667,7 @@ func setAttrViewWrapField(operation *Operation) (err error) {
allFieldWrap := operation.Data.(bool)
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
view.GetTableLayout().WrapField = allFieldWrap
for _, col := range view.GetTableLayout().Columns {
col.Wrap = allFieldWrap
@@ -1715,7 +1708,7 @@ func setAttrViewShowIcon(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
view.GetTableLayout().ShowIcon = operation.Data.(bool)
case av.LayoutTypeGallery:
view.Gallery.ShowIcon = operation.Data.(bool)
@@ -1747,7 +1740,7 @@ func setAttrViewFitImage(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.FitImage = operation.Data.(bool)
@@ -1795,7 +1788,7 @@ func setAttrViewDisplayFieldName(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.DisplayFieldName = operation.Data.(bool)
@@ -1819,7 +1812,7 @@ func setAttrViewDisplayEmptyFields(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.DisplayEmptyFields = operation.Data.(bool)
@@ -1843,7 +1836,7 @@ func setAttrViewFillColBackgroundColor(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
return
@@ -1884,7 +1877,7 @@ func setAttrViewCardSize(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.CardSize = size
@@ -1926,7 +1919,7 @@ func setAttrViewCardWidth(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.CardWidth = width
@@ -2067,7 +2060,7 @@ func setAttrViewCoverFromAssetKeyID(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.CoverFromAssetKeyID = operation.KeyID
@@ -2099,7 +2092,7 @@ func setAttrViewCoverFrom(operation *Operation) (err error) {
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
return
case av.LayoutTypeGallery:
view.Gallery.CoverFrom = av.CoverFrom(operation.Data.(float64))
@@ -5091,8 +5084,6 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErr
var view *av.View
switch masterView.LayoutType {
- case av.LayoutTypeMap:
- view = av.NewMapView()
case av.LayoutTypeCalendar:
view = av.NewCalendarView()
case av.LayoutTypeList:
@@ -5190,9 +5181,6 @@ func addAttrViewViewNamed(avID, viewID, blockID, name string, layout av.LayoutTy
var view *av.View
switch layout {
- case av.LayoutTypeMap:
- view = av.NewMapView()
- view.Map = newAttributeViewMapLayout(attrView, attributeViewFieldIDs(firstView))
case av.LayoutTypeCalendar:
view = av.NewCalendarView()
view.Calendar = newAttributeViewCalendarLayout(attrView, attributeViewFieldIDs(firstView))
@@ -5202,7 +5190,7 @@ func addAttrViewViewNamed(avID, viewID, blockID, name string, layout av.LayoutTy
case av.LayoutTypeTable:
view = av.NewTableView()
switch firstView.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, col := range firstView.GetTableLayout().Columns {
view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{
BaseField: &av.BaseField{ID: col.ID}, Width: col.Width, Align: col.Align,
@@ -5220,7 +5208,7 @@ func addAttrViewViewNamed(avID, viewID, blockID, name string, layout av.LayoutTy
case av.LayoutTypeGallery:
view = av.NewGalleryView()
switch firstView.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, col := range firstView.GetTableLayout().Columns {
view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: &av.BaseField{ID: col.ID}})
}
@@ -5236,7 +5224,7 @@ func addAttrViewViewNamed(avID, viewID, blockID, name string, layout av.LayoutTy
case av.LayoutTypeKanban:
view = av.NewKanbanView()
switch firstView.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, col := range firstView.GetTableLayout().Columns {
view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: &av.BaseField{ID: col.ID}})
}
@@ -6112,7 +6100,7 @@ func setAttributeViewColumnCalc(operation *Operation) (err error) {
calc := &av.FieldCalc{}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
if err = gulu.JSON.UnmarshalJSON(data, calc); err != nil {
return
}
@@ -6846,8 +6834,7 @@ func duplicateAttributeViewKey(operation *Operation) (err error) {
}
cloned.ID = copyKey.ID
if layout == view.List && av.LayoutTypeList != view.LayoutType ||
- view.Calendar != nil && layout == view.Calendar.LayoutTable && av.LayoutTypeCalendar != view.LayoutType ||
- view.Map != nil && layout == view.Map.LayoutTable && av.LayoutTypeMap != view.LayoutType {
+ view.Calendar != nil && layout == view.Calendar.LayoutTable && av.LayoutTypeCalendar != view.LayoutType {
cloned.Hidden = true
}
layout.Columns = slices.Insert(layout.Columns, i+1, cloned)
@@ -7025,7 +7012,7 @@ func setAttributeViewColWrap(operation *Operation) (err error) {
newWrap := operation.Data.(bool)
allFieldWrap := true
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, column := range view.GetTableLayout().Columns {
if column.ID == operation.ID {
column.Wrap = newWrap
@@ -7104,7 +7091,7 @@ func setAttributeViewFieldsHidden(attrView *av.AttributeView, keyID string, view
if nil == view {
return fmt.Errorf("view [%s] not found", viewID)
}
- if hidden && (av.LayoutTypeList == view.LayoutType || av.LayoutTypeCalendar == view.LayoutType || av.LayoutTypeMap == view.LayoutType) {
+ if hidden && (av.LayoutTypeList == view.LayoutType || av.LayoutTypeCalendar == view.LayoutType) {
key, keyErr := attrView.GetKey(keyID)
if nil != keyErr {
return keyErr
@@ -7131,7 +7118,7 @@ func setAttributeViewFieldsHidden(attrView *av.AttributeView, keyID string, view
func getAttributeViewField(view *av.View, keyID string) (ret *av.BaseField) {
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
if nil == view.GetTableLayout() {
return
}
@@ -7410,7 +7397,7 @@ func SortAttributeViewViewKey(avID, blockID, keyID, previousKeyID string) (err e
var curIndex, previousIndex int
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
var col *av.ViewTableColumn
for i, column := range view.GetTableLayout().Columns {
if column.ID == keyID {
@@ -7623,18 +7610,6 @@ func addAttributeViewKey(attrView *av.AttributeView, currentView *av.View, key *
attrView.KeyValues = append(attrView.KeyValues, &av.KeyValues{Key: key})
for _, view := range attrView.Views {
- if nil != view.Map {
- hidden := nil == currentView || currentView.ID != view.ID || av.LayoutTypeMap != currentView.LayoutType
- column := &av.ViewTableColumn{BaseField: &av.BaseField{ID: key.ID, Hidden: hidden, Wrap: view.Map.WrapField}}
- index := len(view.Map.Columns)
- for i, field := range view.Map.Columns {
- if field.ID == previousKeyID {
- index = i + 1
- break
- }
- }
- view.Map.Columns = slices.Insert(view.Map.Columns, index, column)
- }
if nil != view.Calendar {
hidden := nil == currentView || currentView.ID != view.ID || av.LayoutTypeCalendar != currentView.LayoutType
column := &av.ViewTableColumn{BaseField: &av.BaseField{ID: key.ID, Hidden: hidden, Wrap: view.Calendar.WrapField}}
diff --git a/kernel/model/attribute_view_create.go b/kernel/model/attribute_view_create.go
index caa3ebab24..9c09c79825 100644
--- a/kernel/model/attribute_view_create.go
+++ b/kernel/model/attribute_view_create.go
@@ -63,7 +63,7 @@ func CreateAttributeViewDatabase(parentID, previousID, nextID, name, primaryKeyN
layout = av.LayoutTypeTable
}
switch layout {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap, av.LayoutTypeGallery, av.LayoutTypeKanban:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeGallery, av.LayoutTypeKanban:
default:
return nil, av.ErrWrongLayoutType
}
diff --git a/kernel/model/attribute_view_legacy_map_test.go b/kernel/model/attribute_view_legacy_map_test.go
new file mode 100644
index 0000000000..97925760d2
--- /dev/null
+++ b/kernel/model/attribute_view_legacy_map_test.go
@@ -0,0 +1,132 @@
+package model
+
+import (
+ "bytes"
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "reflect"
+ "testing"
+
+ "github.com/siyuan-note/siyuan/kernel/av"
+ "github.com/siyuan-note/siyuan/kernel/cache"
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+func TestLegacyMapCannotBeSelectedAsNewLayout(t *testing.T) {
+ setupAttributeViewValidationTest(t)
+ setAttributeViewListTestLangs()
+ database := newAttributeViewWithLayout("20260921000000-layouts", "map")
+ view := database.Views[0]
+ if view.LayoutType != av.LayoutTypeTable || len(view.LegacyMap) != 0 {
+ t.Fatal("a new map layout was created")
+ }
+ if err := changeAttrViewLayout(database, view, "map"); err != av.ErrWrongLayoutType || view.LayoutType != av.LayoutTypeTable {
+ t.Fatalf("the retired map layout was selected: %v", err)
+ }
+}
+
+func TestLegacyMapAuthenticatedRecoveryAndExport(t *testing.T) {
+ fixture, err := os.ReadFile("../av/testdata/spec13-retired-map.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+ const avID, keyID, itemID = "20260921000000-layouts", "20261009000001-locakey", "20260921000003-example"
+ for _, encrypted := range []bool{false, true} {
+ name := "ordinary"
+ if encrypted {
+ name = "encrypted"
+ }
+ t.Run(name, func(t *testing.T) {
+ setupAttributeViewValidationTest(t)
+ boxID := ""
+ source := bytes.Clone(fixture)
+ if encrypted {
+ boxID = "20261009000000-cryptob"
+ t.Cleanup(prepareEncryptedBoxLifecycleTest(t, boxID))
+ av.SetAVBoxID(avID, boxID)
+ t.Cleanup(func() { av.SetAVBoxID(avID, "") })
+ source, err = av.EncryptAVData(boxID, avID, fixture)
+ if err != nil {
+ t.Fatal(err)
+ }
+ }
+ path := filepath.Join(util.DataDir, boxID, "storage", "av", avID+".json")
+ if err = os.MkdirAll(filepath.Dir(path), 0755); err != nil {
+ t.Fatal(err)
+ }
+ if err = os.WriteFile(path, source, 0600); err != nil {
+ t.Fatal(err)
+ }
+ cache.ClearAVCache()
+ info, err := av.GetAttributeViewSearchInfoInBox(avID, boxID)
+ if err != nil || info == nil || info.Views[0].LayoutType != av.LayoutTypeTable {
+ t.Fatalf("cold-cache search exposed a retired map layout: %+v, %v", info, err)
+ }
+ original, err := av.ParseAttributeViewForIndexInBox(avID, boxID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ legacy := bytes.Clone(original.Views[0].LegacyMap)
+ location := *original.GetValue(keyID, itemID).Location
+ if original.Views[0].LayoutType != av.LayoutTypeTable || len(legacy) == 0 || len(original.Views) != 3 {
+ t.Fatal("legacy map or other views were lost")
+ }
+ for _, view := range original.Views {
+ if table := getAttrViewTable(original, view, ""); table == nil || len(table.Rows) != 1 {
+ t.Fatalf("legacy record export failed: %s", view.LayoutType)
+ }
+ }
+ before, err := os.ReadFile(path)
+ if err != nil || !bytes.Equal(before, source) {
+ t.Fatal("read or export changed the original file")
+ }
+ if err = av.SaveAttributeView(original); err != nil {
+ t.Fatal(err)
+ }
+ cache.ClearAVCache()
+ stored, err := av.ParseAttributeViewForIndexInBox(avID, boxID)
+ if err != nil || !equalLegacyMapJSON(t, stored.Views[0].LegacyMap, legacy) || !reflect.DeepEqual(location, *stored.GetValue(keyID, itemID).Location) {
+ t.Fatalf("saving lost legacy configuration or coordinates: %v", err)
+ }
+ plain, err := decryptHistoricalAttributeView(boxID, avID, source)
+ if err != nil {
+ t.Fatal(err)
+ }
+ historical, err := parseHistoricalAttributeViewData(avID, plain)
+ if err != nil || historical.Views[0].LayoutType != av.LayoutTypeTable || !equalLegacyMapJSON(t, historical.Views[0].LegacyMap, legacy) {
+ t.Fatalf("history or backup recovery lost the legacy layout: %v", err)
+ }
+ if err = av.SaveAttributeView(historical); err != nil {
+ t.Fatal(err)
+ }
+ if encrypted {
+ storedBytes, err := os.ReadFile(path)
+ if err != nil || !util.IsCiphertext(storedBytes) {
+ t.Fatal("legacy map recovery removed encryption")
+ }
+ corrupt := bytes.Clone(source)
+ corrupt[len(corrupt)-1] ^= 1
+ if _, err = decryptHistoricalAttributeView(boxID, avID, corrupt); err == nil {
+ t.Fatal("unauthenticated history was accepted")
+ }
+ after, _ := os.ReadFile(path)
+ if !bytes.Equal(after, storedBytes) {
+ t.Fatal("authentication failure changed the saved database")
+ }
+ }
+ })
+ }
+}
+
+func equalLegacyMapJSON(t *testing.T, first, second []byte) bool {
+ t.Helper()
+ var left, right any
+ if err := json.Unmarshal(first, &left); err != nil {
+ t.Fatal(err)
+ }
+ if err := json.Unmarshal(second, &right); err != nil {
+ t.Fatal(err)
+ }
+ return reflect.DeepEqual(left, right)
+}
diff --git a/kernel/model/attribute_view_list.go b/kernel/model/attribute_view_list.go
index 6e41086bb3..967ef9b74f 100644
--- a/kernel/model/attribute_view_list.go
+++ b/kernel/model/attribute_view_list.go
@@ -26,13 +26,7 @@ func cloneAttributeViewLayouts(target, source *av.View) (err error) {
}
target.List.ID = ast.NewNodeID()
}
- if nil != source.Map {
- target.Map = &av.LayoutMap{}
- if err = copier.CopyWithOption(target.Map, source.Map, copier.Option{DeepCopy: true}); nil != err {
- return
- }
- target.Map.ID = ast.NewNodeID()
- }
+ target.LegacyMap = append(target.LegacyMap[:0:0], source.LegacyMap...)
if nil != source.Calendar {
target.Calendar = &av.LayoutCalendar{}
if err = copier.CopyWithOption(target.Calendar, source.Calendar, copier.Option{DeepCopy: true}); nil != err {
@@ -60,7 +54,7 @@ func cloneAttributeViewLayouts(target, source *av.View) (err error) {
// attributeViewFieldIDs 按当前布局的字段顺序返回字段 ID。
func attributeViewFieldIDs(view *av.View) (ret []string) {
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
if layout := view.GetTableLayout(); nil != layout {
for _, column := range layout.Columns {
ret = append(ret, column.ID)
diff --git a/kernel/model/attribute_view_location_import_test.go b/kernel/model/attribute_view_location_import_test.go
new file mode 100644
index 0000000000..f755db58ad
--- /dev/null
+++ b/kernel/model/attribute_view_location_import_test.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "github.com/88250/lute/ast"
+ "github.com/siyuan-note/siyuan/kernel/av"
+ "github.com/siyuan-note/siyuan/kernel/util"
+ "testing"
+)
+
+func TestAttributeViewLocationImportOmittedValues(t *testing.T) {
+ setupAttributeViewValidationTest(t)
+ setAttributeViewListTestLangs()
+ util.AttrViewLangs["en"]["calendar"] = "Calendar"
+ for _, scenario := range []struct {
+ name string
+ layout av.LayoutType
+ loc bool
+ }{
+ {"location", av.LayoutTypeTable, true},
+ {"legacy table", av.LayoutTypeTable, false},
+ {"legacy calendar", av.LayoutTypeCalendar, false},
+ } {
+ t.Run(scenario.name, func(t *testing.T) {
+ database := newAttributeViewWithLayout(ast.NewNodeID(), scenario.layout)
+ if scenario.loc {
+ database.KeyValues = append(database.KeyValues, &av.KeyValues{Key: av.NewKey(ast.NewNodeID(), "Location", "", av.KeyTypeLocation)})
+ }
+ if err := av.SaveAttributeView(database); err != nil {
+ t.Fatal(err)
+ }
+ data, err := json.Marshal(database)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var root map[string]json.RawMessage
+ if err = json.Unmarshal(data, &root); err != nil {
+ t.Fatal(err)
+ }
+ var keyValues []map[string]json.RawMessage
+ if err = json.Unmarshal(root["keyValues"], &keyValues); err != nil {
+ t.Fatal(err)
+ }
+ for _, values := range []string{"", "null", "[]", "{}", `"invalid"`} {
+ delete(keyValues[0], "values")
+ if values != "" {
+ keyValues[0]["values"] = json.RawMessage(values)
+ }
+ root["keyValues"], err = json.Marshal(keyValues)
+ if err != nil {
+ t.Fatal(err)
+ }
+ input, err := json.Marshal(root)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, encrypted := range []bool{false, true} {
+ t.Run(fmt.Sprintf("values=%q/encrypted=%t", values, encrypted), func(t *testing.T) {
+ before := bytes.Clone(input)
+ got, importErr := isolateImportedAttributeViewBindings(input, nil, encrypted)
+ if !bytes.Equal(input, before) {
+ t.Fatal("import changed the source JSON")
+ }
+ wantSuccess := values == "null" || values == "[]" || values == ""
+ if wantSuccess && (importErr != nil || !bytes.Equal(got, input)) {
+ t.Fatalf("rejected or rewrote valid empty data: %v", importErr)
+ }
+ if !wantSuccess && importErr == nil {
+ t.Fatal("accepted malformed data")
+ }
+ })
+ }
+ }
+ })
+ }
+}
diff --git a/kernel/model/attribute_view_map.go b/kernel/model/attribute_view_map.go
deleted file mode 100644
index 2fd9a64ca1..0000000000
--- a/kernel/model/attribute_view_map.go
+++ /dev/null
@@ -1,271 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-package model
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "text/template"
- "text/template/parse"
-
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/filesys"
- "github.com/siyuan-note/siyuan/kernel/sql"
-)
-
-func newAttributeViewMapLayout(attrView *av.AttributeView, fieldIDs []string) *av.LayoutMap {
- return &av.LayoutMap{
- LayoutTable: newAttributeViewListLayout(attrView, fieldIDs),
- }
-}
-
-func (filter *attributeViewPublishAccessFilter) filterMapTemplateValue(attrView *av.AttributeView, itemID string, baseValue *av.BaseValue) {
- if nil == baseValue || nil == baseValue.Value {
- return
- }
- var key *av.Key
- if nil != attrView {
- key, _ = attrView.GetKey(baseValue.Value.KeyID)
- }
- value := baseValue.Value
- if av.KeyTypeTemplate == value.Type && nil != value.Template &&
- (!filter.checkKeyDependencies(attrView, key, itemID, map[string]bool{}) ||
- !filter.checkMapTemplateDependencySyntax(attrView, key, itemID, map[string]bool{})) {
- // 地图模板在发布权限过滤前生成,私有依赖的结果只能在响应副本中清空。
- value = cloneAttributeViewSensitiveValue(value)
- value.Template = &av.ValueTemplate{}
- value.RenderedContent = ""
- }
- if "" != value.RenderedContent {
- var displayKey *av.Key
- if nil != key {
- clonedKey := *key
- clonedKey.Type = av.KeyTypeText // 显示结果必须按 RenderTemplate 而非模板字段的 Template 分析。
- displayKey = &clonedKey
- }
- if !filter.checkRenderTemplateDependencies(attrView, displayKey, itemID) ||
- !filter.checkMapTemplateDependencySyntax(attrView, displayKey, itemID, map[string]bool{}) {
- // 显示模板使用相同的证明边界,但不得清空原始标量、坐标或其他字段值。
- value = cloneAttributeViewSensitiveValue(value)
- value.RenderedContent = ""
- }
- }
- baseValue.Value = value
-}
-
-func (filter *attributeViewPublishAccessFilter) checkMapTemplateDependencySyntax(attrView *av.AttributeView, key *av.Key,
- itemID string, visited map[string]bool) bool {
- if nil == attrView || nil == key {
- return false
- }
- visitKey := attrView.ID + "\x00" + key.ID + "\x00" + itemID
- if visited[visitKey] {
- return true
- }
- visited[visitKey] = true
- templateContent := key.RenderTemplate
- if av.KeyTypeTemplate == key.Type {
- templateContent = key.Template
- }
- if "" != templateContent {
- if !mapTemplateDependencySyntaxIsSupported(templateContent) {
- return false
- }
- for _, dependency := range sql.GetTemplateKeyRelevantKeys(attrView, key) {
- if dependency.ID != key.ID &&
- (!filter.checkKeyDependencies(attrView, dependency, itemID, map[string]bool{}) ||
- !filter.checkMapTemplateDependencySyntax(attrView, dependency, itemID, visited)) {
- return false
- }
- }
- }
- if av.KeyTypeRollup == key.Type {
- targetAttrView, targetKey, targetItemIDs, ok := filter.getRollupTarget(attrView, key, itemID)
- if ok {
- for _, targetItemID := range targetItemIDs {
- if !filter.checkMapTemplateDependencySyntax(targetAttrView, targetKey, targetItemID, visited) {
- return false
- }
- }
- }
- }
- return true
-}
-
-// 仅地图响应采用保守检查;共享依赖提取器尚未覆盖的语法不能用于证明模板可公开。
-func mapTemplateDependencySyntaxIsSupported(content string) bool {
- funcs := filesys.BuiltInTemplateFuncs()
- sql.SQLTemplateFuncs(&funcs)
- tpl, err := template.New("").Delims(".action{", "}").Funcs(funcs).Parse(content)
- if nil != err {
- return false
- }
- var supported func(parse.Node) bool
- supported = func(node parse.Node) bool {
- switch n := node.(type) {
- case *parse.ListNode:
- for _, child := range n.Nodes {
- if !supported(child) {
- return false
- }
- }
- case *parse.ActionNode:
- return supported(n.Pipe)
- case *parse.PipeNode:
- if 0 < len(n.Decl) {
- return false
- }
- for _, command := range n.Cmds {
- if !supported(command) {
- return false
- }
- }
- case *parse.CommandNode:
- staticIndex := false
- if 3 <= len(n.Args) && "index" == n.Args[0].String() {
- _, staticIndex = n.Args[2].(*parse.StringNode)
- }
- if 2 <= len(n.Args) && "index" == n.Args[0].String() {
- if field, ok := n.Args[1].(*parse.FieldNode); ok && 0 < len(field.Ident) &&
- ("id_mod" == field.Ident[0] || "id_mod_raw" == field.Ident[0]) &&
- (1 != len(field.Ident) || !staticIndex) {
- return false
- }
- }
- for i, arg := range n.Args {
- if 1 == i && staticIndex && (".id_mod" == arg.String() || ".id_mod_raw" == arg.String()) {
- continue
- }
- if !supported(arg) {
- return false
- }
- }
- case *parse.FieldNode:
- if 1 == len(n.Ident) && ("id_mod" == n.Ident[0] || "id_mod_raw" == n.Ident[0]) {
- return false
- }
- case *parse.IdentifierNode:
- switch n.Ident {
- case "index", "len", "printf", "print", "println", "eq", "ne", "lt", "le", "gt", "ge", "and", "or", "not", "html", "js", "urlquery":
- default:
- return false
- }
- case *parse.TextNode, *parse.StringNode, *parse.NumberNode, *parse.BoolNode, *parse.NilNode:
- default:
- // 分支、链式表达式、变量别名和整行访问均可能隐藏共享提取器未识别的依赖。
- return false
- }
- return true
- }
- return supported(tpl.Tree.Root)
-}
-
-func shouldPushAttributeViewTemplateErrors(layout av.LayoutType, writable bool) bool {
- // 公开地图的模板先于权限过滤执行,不广播其中可能包含私有条目内容的错误。
- return layout != av.LayoutTypeMap || writable
-}
-
-func (tx *Transaction) doSetAttrViewMap(operation *Operation) *TxErr {
- if err := setAttrViewMap(operation); err != nil {
- return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
- }
- return nil
-}
-
-func setAttrViewMap(operation *Operation) error {
- if operation.Data == nil {
- return fmt.Errorf("map settings are required")
- }
- data, err := json.Marshal(operation.Data)
- if err != nil {
- return err
- }
- // 设置只包含位置字段和高度,拒绝其他内容进入数据库事务。
- var settings struct {
- LocationKeyID *string `json:"locationKeyID"`
- Height json.RawMessage `json:"height"`
- }
- decoder := json.NewDecoder(bytes.NewReader(data))
- decoder.DisallowUnknownFields()
- if err = decoder.Decode(&settings); err != nil {
- return err
- }
- if settings.LocationKeyID == nil {
- return fmt.Errorf("complete map settings are required")
- }
- next := av.MapSettings{LocationKeyID: *settings.LocationKeyID}
- if settings.Height != nil {
- if err = json.Unmarshal(settings.Height, &next.Height); err != nil {
- return err
- }
- if next.Height == 0 {
- return fmt.Errorf("invalid map height")
- }
- }
- if err = next.Validate(); err != nil {
- return err
- }
- attrView, err := av.ParseAttributeView(operation.AvID)
- if err != nil {
- return err
- }
- view, err := getAttrViewOperationView(attrView, operation)
- if err != nil {
- return err
- }
- if view.LayoutType != av.LayoutTypeMap || view.Map == nil {
- return av.ErrWrongLayoutType
- }
- view.Map.Settings = next
- return av.SaveAttributeView(attrView)
-}
-
-// FilterAttributeViewMapForPublish 在完整结果上过滤访问权限,再计算可访问总数和分页定位。
-// filter 同时负责行权限和关联字段脱敏,不把未授权条目的数量、位置或统计结果带入响应。
-func FilterAttributeViewMapForPublish(mapped *av.Map, page, pageSize int, target *AttributeViewRenderTarget,
- filter func(av.Viewable) av.Viewable) (av.Viewable, *AttributeViewRenderTarget) {
- if mapped.RowsBeforePagination != nil {
- mapped.Rows = mapped.RowsBeforePagination
- }
- mapped.RowsBeforePagination = nil
- filtered := filter(mapped)
- mapped, ok := filtered.(*av.Map)
- if !ok {
- return filtered, nil
- }
- clearPublishedAttributeViewMapCalculations(mapped)
- mapped.RowCount = len(mapped.Rows)
- index := findAttributeViewTargetIndex(targetItemID(target), len(mapped.Rows), func(index int) string {
- return mapped.Rows[index].ID
- })
- start, end := getAttributeViewRenderRange(page, pageSize, index, mapped.PageSize, len(mapped.Rows))
- mapped.Rows = mapped.Rows[start:end]
- if target == nil {
- return mapped, nil
- }
- visibleTarget := &AttributeViewRenderTarget{Status: "itemNotFound", ItemID: target.ItemID}
- if index >= 0 {
- setAttributeViewRenderTarget(visibleTarget, "", index, start, mapped.PageSize)
- }
- return mapped, visibleTarget
-}
-
-// 发布地图不返回权限过滤前生成的聚合和条件颜色,避免泄露受限行或其关联内容。
-func clearPublishedAttributeViewMapCalculations(mapped *av.Map) {
- for _, column := range mapped.Columns {
- if column != nil && column.BaseInstanceField != nil {
- column.Calc = nil
- }
- }
- if mapped.BaseInstance != nil {
- mapped.GroupCalc = nil
- }
- for _, row := range mapped.Rows {
- if row != nil {
- row.ConditionalColors = nil
- }
- }
-}
diff --git a/kernel/model/attribute_view_map_fts5_test.go b/kernel/model/attribute_view_map_fts5_test.go
deleted file mode 100644
index 17f0b441b1..0000000000
--- a/kernel/model/attribute_view_map_fts5_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-//go:build fts5
-
-package model
-
-import (
- "bytes"
- "os"
- "path/filepath"
- "testing"
-
- "github.com/88250/lute/ast"
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/cache"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-func TestAttributeViewMapSettingsUndoAndEncryptedReplay(t *testing.T) {
- for _, encrypted := range []bool{false, true} {
- name := "ordinary"
- if encrypted {
- name = "encrypted"
- }
- t.Run(name, func(t *testing.T) {
- _, database, _, _ := setupAttributeViewItemsTest(t, false)
- util.AttrViewLangs["en"]["map"] = "Map"
- view := database.Views[0]
- if err := changeAttrViewLayout(database, view, av.LayoutTypeMap); err != nil {
- t.Fatal(err)
- }
- boxID := ""
- plainPath := filepath.Join(util.DataDir, "storage", "av", database.ID+".json")
- if encrypted {
- boxID = ast.NewNodeID()
- markRuntimeEncryptedBox(boxID)
- setDEKForTest(boxID, bytes.Repeat([]byte{0x61}, 32))
- av.SetAVBoxID(database.ID, boxID)
- t.Cleanup(func() {
- av.SetAVBoxID(database.ID, "")
- forgetRuntimeEncryptedBox(boxID)
- encryptedBoxLifecycles.Delete(boxID)
- cachedDEKsLock.Lock()
- delete(cachedDEKs, boxID)
- cachedDEKsLock.Unlock()
- })
- }
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- if encrypted {
- if err := os.Remove(plainPath); err != nil {
- t.Fatal(err)
- }
- }
- before := view.Map.Settings
- after := av.MapSettings{LocationKeyID: ast.NewNodeID(), Height: 800}
- operation := func(settings av.MapSettings) *Operation {
- return &Operation{Action: "setAttrViewMap", AvID: database.ID, ViewID: view.ID, Data: settings}
- }
- tx := &Transaction{DoOperations: []*Operation{operation(after)}, UndoOperations: []*Operation{operation(before)}, fromAPI: true}
- if err := PerformTxSync(tx); err != nil {
- t.Fatal(err)
- }
- for _, replay := range []struct {
- operations []*Operation
- settings av.MapSettings
- }{{tx.DoOperations, after}, {tx.UndoOperations, before}, {tx.DoOperations, after}} {
- if err := PerformTxSync(&Transaction{DoOperations: cloneOperations(replay.operations), isReplay: true}); err != nil {
- t.Fatal(err)
- }
- cache.ClearAVCache()
- stored, err := av.ParseAttributeViewForIndexInBox(database.ID, boxID)
- if err != nil || stored.Spec != av.MapSpec || stored.Views[0].Map.Settings != replay.settings {
- t.Fatalf("map settings replay: %v", err)
- }
- }
- if encrypted {
- path := filepath.Join(util.DataDir, boxID, "storage", "av", database.ID+".json")
- ciphertext, err := os.ReadFile(path)
- if err != nil || !util.IsCiphertext(ciphertext) {
- t.Fatal("map settings did not retain encrypted storage")
- }
- if _, err = os.Stat(plainPath); !os.IsNotExist(err) {
- t.Fatal("map settings recreated plaintext storage")
- }
- ciphertext[len(ciphertext)-1] ^= 1
- if err = os.WriteFile(path, ciphertext, 0644); err != nil {
- t.Fatal(err)
- }
- cache.ClearAVCache()
- if err = PerformTxSync(&Transaction{DoOperations: cloneOperations(tx.UndoOperations), isReplay: true}); err == nil {
- t.Fatal("map replay accepted unauthenticated data")
- }
- preserved, err := os.ReadFile(path)
- if err != nil || !bytes.Equal(ciphertext, preserved) {
- t.Fatal("failed map replay modified ciphertext")
- }
- }
- })
- }
-}
diff --git a/kernel/model/attribute_view_map_publish_test.go b/kernel/model/attribute_view_map_publish_test.go
deleted file mode 100644
index e617827f3a..0000000000
--- a/kernel/model/attribute_view_map_publish_test.go
+++ /dev/null
@@ -1,173 +0,0 @@
-package model
-
-import (
- "net/http"
- "net/http/httptest"
- "path/filepath"
- "testing"
-
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/treenode"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-func TestAttributeViewMapPublishExcludesDeniedBoundRows(t *testing.T) {
- const boxID, documentID = "20261009000000-box0001", "20261009000001-doc0001"
- oldDataDir, oldBlockTreePath := util.DataDir, util.BlockTreeDBPath
- util.DataDir = t.TempDir()
- util.BlockTreeDBPath = filepath.Join(util.DataDir, "blocktree.db")
- treenode.InitBlockTree(true)
- invalidateEncryptedPublishAccessCache()
- t.Cleanup(func() {
- treenode.CloseDatabase()
- util.DataDir, util.BlockTreeDBPath = oldDataDir, oldBlockTreePath
- invalidateEncryptedPublishAccessCache()
- if oldBlockTreePath != "" {
- treenode.InitBlockTree(false)
- }
- })
- tree := treenode.NewTree(boxID, "/"+documentID+".sy", "/Private", "Private")
- treenode.UpsertBlockTree(tree)
- row := func(id string, detached bool) *av.TableRow {
- return &av.TableRow{ID: id, Cells: []*av.TableCell{{BaseValue: &av.BaseValue{
- ValueType: av.KeyTypeBlock, Value: &av.Value{Type: av.KeyTypeBlock, IsDetached: detached,
- Block: &av.ValueBlock{ID: documentID, Content: id}},
- }}}}
- }
- mapped := &av.Map{Table: &av.Table{BaseInstance: &av.BaseInstance{},
- Rows: []*av.TableRow{row("private", false), row("public", true)}, RowCount: 120}}
- originalCalc := &av.FieldCalc{Operator: av.CalcOperatorCountAll, Result: &av.Value{Number: &av.ValueNumber{Content: 120, IsNotEmpty: true}}}
- mapped.Columns = []*av.TableColumn{{BaseInstanceField: &av.BaseInstanceField{Calc: originalCalc}}}
- mapped.GroupCalc = &av.GroupCalc{FieldCalc: originalCalc}
- mapped.Rows[1].ConditionalColors = &av.ItemConditionalColors{Background: &av.ValueSelect{Color: "1"}}
- context, _ := gin.CreateTestContext(httptest.NewRecorder())
- context.Request = httptest.NewRequest(http.MethodGet, "/", nil)
- filtered := FilterViewByPublishAccess(context, PublishAccess{{ID: documentID, Disable: true}}, mapped).(*av.Map)
- if filtered.RowCount != 1 || len(filtered.Rows) != 1 || filtered.Rows[0].ID != "public" {
- t.Fatal("map publish returned a denied row or its original count")
- }
- if filtered.Columns[0].Calc != nil || filtered.GroupCalc != nil || filtered.Rows[0].ConditionalColors != nil || originalCalc.Result.Number.Content != 120 {
- t.Fatal("public map retained pre-filter derived data or changed the source calculation")
- }
-}
-
-func TestAttributeViewMapPublishTemplateSyntax(t *testing.T) {
- for _, test := range []struct {
- content string
- want bool
- }{
- {"constant result", true},
- {".action{.Label}", true},
- {".action{index .Secret_raw.Relation.BlockIDs 0}", true},
- {`.action{index .id_mod "key"}`, true},
- {`.action{index .id_mod_raw "key"}`, true},
- {`.action{index . "Label"}`, false},
- {`.action{index . "id_mod_raw"}`, false},
- {`.action{printf "%s" .Label}`, true},
- {".action{range .Secret_raw.Relation.BlockIDs}.action{.}.action{end}", false},
- {".action{if .Secret}.action{.Secret}.action{end}", false},
- {".action{with .Secret_raw}.action{.Relation}.action{end}", false},
- {`.action{(index .id_mod_raw "key").Relation.BlockIDs}`, false},
- {`.action{index .id_mod_raw.secret.Relation.Contents "other"}`, false},
- {`.action{index .id_mod.secret "other"}`, false},
- {".action{index .id_mod .Selector}", false},
- {".action{.}", false},
- {".action{$.Secret}", false},
- {".action{.id_mod_raw}", false},
- {`.action{sql "SELECT content FROM blocks"}`, false},
- {`.action{getHPathByID "private-block"}`, false},
- } {
- if got := mapTemplateDependencySyntaxIsSupported(test.content); got != test.want {
- t.Errorf("template %q supported=%t, want %t", test.content, got, test.want)
- }
- }
-}
-
-func TestAttributeViewMapPublishSuppressesTemplateErrors(t *testing.T) {
- for _, layout := range []av.LayoutType{av.LayoutTypeMap, av.LayoutTypeTable, av.LayoutTypeList,
- av.LayoutTypeCalendar, av.LayoutTypeGallery, av.LayoutTypeKanban} {
- for _, writable := range []bool{false, true} {
- want := layout != av.LayoutTypeMap || writable
- if got := shouldPushAttributeViewTemplateErrors(layout, writable); got != want {
- t.Errorf("layout=%s writable=%t push=%t, want %t", layout, writable, got, want)
- }
- }
- }
-}
-
-func TestAttributeViewMapPublishTemplateRedactionClonesOnlyMapResponse(t *testing.T) {
- key := &av.Key{ID: "template", Type: av.KeyTypeTemplate, Template: ".action{.}"}
- source := &av.Value{KeyID: key.ID, BlockID: "item", Type: av.KeyTypeTemplate,
- Template: &av.ValueTemplate{Content: "private derived value"}}
- database := &av.AttributeView{ID: "database", KeyValues: []*av.KeyValues{{Key: key, Values: []*av.Value{source}}}}
- filter := &attributeViewPublishAccessFilter{}
- for _, layout := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeCalendar, av.LayoutTypeMap} {
- table := &av.Table{BaseInstance: &av.BaseInstance{}, Rows: []*av.TableRow{{ID: "item", Cells: []*av.TableCell{{BaseValue: &av.BaseValue{Value: source}}}}}}
- var viewable av.Viewable = table
- if layout == av.LayoutTypeCalendar {
- viewable = &av.Calendar{Table: table}
- } else if layout == av.LayoutTypeMap {
- viewable = &av.Map{Table: table}
- }
- filter.filterViewable(database, viewable)
- got := table.Rows[0].Cells[0].Value
- if layout == av.LayoutTypeMap {
- if got == source || got.Template.Content != "" {
- t.Fatal("map redaction did not use a cleared response-only clone")
- }
- } else if got != source || got.Template.Content != "private derived value" {
- t.Fatal("map-only redaction changed a pre-existing layout")
- }
- }
- if source.Template.Content != "private derived value" {
- t.Fatal("map template redaction mutated source value")
- }
-}
-
-func TestAttributeViewMapPublishDisplayTemplatePreservesStoredValues(t *testing.T) {
- latitude, longitude := 0.0, 120.0
- for _, typ := range []av.KeyType{av.KeyTypeText, av.KeyTypeLocation, av.KeyTypeTemplate} {
- key := &av.Key{ID: "display", Type: typ, Template: "public computed", RenderTemplate: `.action{getHPathByID "private-block"}`}
- source := &av.Value{KeyID: key.ID, BlockID: "item", Type: typ, RenderedContent: "private path", HasRenderTemplate: true}
- if typ == av.KeyTypeText {
- source.Text = &av.ValueText{Content: "public scalar"}
- } else if typ == av.KeyTypeLocation {
- source.Location = &av.ValueLocation{Name: "public location", Latitude: &latitude, Longitude: &longitude}
- } else {
- source.Template = &av.ValueTemplate{Content: "public computed"}
- }
- database := &av.AttributeView{ID: "database", KeyValues: []*av.KeyValues{{Key: key, Values: []*av.Value{source}}}}
- filter := &attributeViewPublishAccessFilter{}
- for _, mapped := range []bool{false, true} {
- table := &av.Table{BaseInstance: &av.BaseInstance{}, Rows: []*av.TableRow{{ID: "item", Cells: []*av.TableCell{{BaseValue: &av.BaseValue{Value: source}}}}}}
- var viewable av.Viewable = table
- if mapped {
- viewable = &av.Map{Table: table}
- }
- filter.filterViewable(database, viewable)
- got := table.Rows[0].Cells[0].Value
- if mapped {
- if got == source || got.RenderedContent != "" || !got.HasRenderTemplate {
- t.Fatal("display template did not use a cleared response clone")
- }
- if typ == av.KeyTypeText && got.Text.Content != "public scalar" || typ == av.KeyTypeLocation &&
- (got.Location.Name != "public location" || *got.Location.Latitude != latitude || *got.Location.Longitude != longitude) ||
- typ == av.KeyTypeTemplate && got.Template.Content != "public computed" {
- t.Fatal("display-template redaction changed the stored scalar or coordinates")
- }
- } else if got != source || got.RenderedContent != "private path" {
- t.Fatal("map display-template policy changed the ordinary table")
- }
- }
- if source.RenderedContent != "private path" {
- t.Fatal("display-template redaction mutated the original value")
- }
- key.RenderTemplate = "public constant"
- value := &av.BaseValue{Value: source}
- filter.filterMapTemplateValue(database, "item", value)
- if value.Value != source {
- t.Fatal("a provably public display template was unnecessarily cloned or cleared")
- }
- }
-}
diff --git a/kernel/model/attribute_view_map_test.go b/kernel/model/attribute_view_map_test.go
deleted file mode 100644
index 7921be14dc..0000000000
--- a/kernel/model/attribute_view_map_test.go
+++ /dev/null
@@ -1,358 +0,0 @@
-package model
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "os"
- "path/filepath"
- "reflect"
- "strconv"
- "testing"
- "time"
-
- "github.com/88250/lute/ast"
- "github.com/siyuan-note/siyuan/kernel/av"
- "github.com/siyuan-note/siyuan/kernel/cache"
- "github.com/siyuan-note/siyuan/kernel/sql"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-func setupMapTest(t *testing.T) (*av.AttributeView, *av.View) {
- setupAttributeViewValidationTest(t)
- setAttributeViewListTestLangs()
- util.AttrViewLangs["en"]["map"] = "Map"
- util.AttrViewLangs["en"]["calendar"] = "Calendar"
- attrView := newAttributeViewWithLayout(ast.NewNodeID(), av.LayoutTypeMap)
- return attrView, attrView.Views[0]
-}
-
-func TestAttributeViewMapSettingsFieldsAndClone(t *testing.T) {
- attrView, view := setupMapTest(t)
- if view.Map.Settings.LocationKeyID != "" {
- t.Fatal("new map must retain an explicit unbound state")
- }
- key := av.NewKey(ast.NewNodeID(), "Place", "", av.KeyTypeLocation)
- addAttributeViewKey(attrView, view, key, "")
- view.Map.Settings.LocationKeyID = key.ID
- view.Map.Settings.Height = 800
- view.Group = &av.ViewGroup{Field: attrView.KeyValues[1].Key.ID}
- if getAttributeViewField(view, key.ID) == nil || view.IsGroupView() {
- t.Fatal("map field or grouping state is incorrect")
- }
- layout := view.Map
- for _, typ := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeGallery, av.LayoutTypeKanban} {
- if err := changeAttrViewLayout(attrView, view, typ); err != nil {
- t.Fatal(err)
- }
- if err := changeAttrViewLayout(attrView, view, av.LayoutTypeMap); err != nil {
- t.Fatal(err)
- }
- if layout != view.Map || view.Map.Settings.LocationKeyID != key.ID || view.Group == nil {
- t.Fatal("layout switch lost map settings or stored grouping")
- }
- }
- cloned := av.NewMapView()
- if err := cloneAttributeViewLayouts(cloned, view); err != nil {
- t.Fatal(err)
- }
- cloned.Map.Columns[0].Hidden = true
- if view.Map.Columns[0].Hidden || view.Map.ID == cloned.Map.ID {
- t.Fatal("map layout clone is not independent")
- }
- copy := attrView.Clone()
- if copy == nil {
- t.Fatal("map database clone failed")
- }
- copySettings := copy.Views[0].Map.Settings
- if cloned.Map.Settings.Height != 800 || copySettings.Height != 800 {
- t.Fatal("cloning lost map height")
- }
- copyKey, err := copy.GetKey(copySettings.LocationKeyID)
- if err != nil || copyKey.Type != av.KeyTypeLocation || copyKey.ID == key.ID {
- t.Fatal("clone did not remap its own location field")
- }
- if err = av.SaveAttributeView(attrView); err != nil {
- t.Fatal(err)
- }
- cache.ClearAVCache()
- stored, err := av.ParseAttributeView(attrView.ID)
- if err != nil || stored.Spec != av.MapSpec || !reflect.DeepEqual(stored.Views[0].Map, view.Map) {
- t.Fatalf("map roundtrip: %v", err)
- }
- removeAttributeViewFieldDefinition(attrView, key.ID)
- if view.Map.Settings.LocationKeyID != key.ID || getAttributeViewField(view, key.ID) != nil {
- t.Fatal("deleting field changed the saved binding")
- }
- if err = setAttributeViewFieldsHidden(attrView, attrView.GetBlockKeyValues().Key.ID, []string{view.ID}, true); err == nil {
- t.Fatal("map primary field must remain visible")
- }
-}
-
-func TestAttributeViewMapFilterSortPageTargetAndExport(t *testing.T) {
- attrView, view := setupMapTest(t)
- key := av.NewKey(ast.NewNodeID(), "Place", "", av.KeyTypeLocation)
- addAttributeViewKey(attrView, view, key, "")
- view.Map.Settings.LocationKeyID = key.ID
- view.Map.Settings.Height = 320
- view.PageSize = 10
- for _, column := range view.Map.Columns {
- if column.ID == key.ID {
- column.Hidden = true
- }
- }
- values, _ := attrView.GetKeyValues(key.ID)
- primary := attrView.GetBlockKeyValues()
- for i := 0; i < 125; i++ {
- id := ast.NewNodeID()
- view.ItemIDs = append(view.ItemIDs, id)
- primary.Values = append(primary.Values, &av.Value{ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: id,
- Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: fmt.Sprintf("Record %03d", i)}})
- value := &av.Value{ID: ast.NewNodeID(), KeyID: key.ID, BlockID: id, Type: av.KeyTypeLocation}
- if i < 120 {
- zero := 0.0
- value.Location = &av.ValueLocation{Name: fmt.Sprintf("Place %03d", i), Latitude: &zero, Longitude: &zero}
- }
- values.Values = append(values.Values, value)
- }
- view.Sorts = []*av.ViewSort{{Column: key.ID, Order: av.SortOrderDesc}}
- view.Filters = []*av.ViewFilter{{Column: key.ID, Operator: av.FilterOperatorIsNotEmpty, Value: &av.Value{Type: av.KeyTypeLocation}}}
- for _, page := range []int{1, 2, 12} {
- mapped := sql.RenderView(attrView, view, "", false).(*av.Map)
- if _, _, err := renderViewableInstance(mapped, view, attrView, page, 10, false, "", sql.NewAttributeViewRenderContext()); err != nil {
- t.Fatal(err)
- }
- if len(mapped.Rows) != 10 || mapped.RowCount != 120 || mapped.Rows[0].ID != view.ItemIDs[129-page*10] ||
- mapped.MapMarkerScope != "page" || mapped.Map.LocationKeyID != key.ID || mapped.Map.Height != 320 {
- t.Fatalf("page %d did not follow ordinary filtered/sorted rows: %+v", page, mapped.Table)
- }
- if value := mapped.Rows[0].GetValue(key.ID); value == nil || value.Location == nil || *value.Location.Latitude != 0 {
- t.Fatal("hidden location value or zero coordinate was lost")
- }
- }
- mapped := sql.RenderView(attrView, view, "", false).(*av.Map)
- index, offset, err := renderViewableInstance(mapped, view, attrView, 1, 10, false, view.ItemIDs[24], sql.NewAttributeViewRenderContext())
- if err != nil || index != 95 || offset != 0 || len(mapped.Rows) != 120 {
- t.Fatalf("map target did not locate its page: %d %d %v", index, offset, err)
- }
- before, _ := json.Marshal(view.Map)
- exported := getAttrViewTable(attrView, view, "")
- after, _ := json.Marshal(view.Map)
- if len(exported.Rows) != 125 || exported.Map != nil || !bytes.Equal(before, after) {
- t.Fatal("map export must contain all ordinary records without map layout data or layout mutations")
- }
-}
-
-func TestAttributeViewMapInvalidSavePreservesSource(t *testing.T) {
- attrView, view := setupMapTest(t)
- if err := av.SaveAttributeView(attrView); err != nil {
- t.Fatal(err)
- }
- path := av.GetAttributeViewDataPath(attrView.ID)
- before, _ := os.ReadFile(path)
- for _, malformed := range []any{nil, map[string]any{}, map[string]any{"serviceID": "", "locationKeyID": "", "showRecordList": true, "apiKey": "not-allowed"},
- map[string]any{"locationKeyID": "", "height": 0}, map[string]any{"locationKeyID": "", "height": nil},
- map[string]any{"locationKeyID": "", "height": 400}, map[string]any{"locationKeyID": "", "height": 480.5},
- map[string]any{"locationKeyID": "", "height": "480"},
- map[string]any{"locationKeyID": "", "serviceID": "openfreemap"}, map[string]any{"locationKeyID": "", "showRecordList": false}, av.MapSettings{LocationKeyID: "invalid"}} {
- if err := setAttrViewMap(&Operation{AvID: attrView.ID, ViewID: view.ID, Data: malformed}); err == nil {
- t.Fatalf("invalid settings accepted: %#v", malformed)
- }
- after, _ := os.ReadFile(path)
- if !bytes.Equal(before, after) {
- t.Fatal("invalid settings changed source")
- }
- }
- view.Map = nil
- if err := av.SaveAttributeView(attrView); err == nil {
- t.Fatal("missing map layout accepted")
- }
- after, _ := os.ReadFile(path)
- if !bytes.Equal(before, after) {
- t.Fatal("invalid layout changed source")
- }
- if _, err := isolateImportedAttributeViewBindings([]byte(`{"spec":13,"views":[{"type":"map"}]}`), nil, false); err == nil {
- t.Fatal("import accepted a damaged map layout")
- }
-}
-
-func TestAttributeViewMapHeightIsPerView(t *testing.T) {
- attrView, view := setupMapTest(t)
- other := av.NewMapView()
- attrView.Views = append(attrView.Views, other)
- if err := av.SaveAttributeView(attrView); err != nil {
- t.Fatal(err)
- }
- for _, height := range []int{320, 480, 640, 800, 0} {
- settings := av.MapSettings{Height: height}
- if err := setAttrViewMap(&Operation{AvID: attrView.ID, ViewID: view.ID, Data: settings}); err != nil {
- t.Fatal(err)
- }
- cache.ClearAVCache()
- stored, err := av.ParseAttributeView(attrView.ID)
- if err != nil {
- t.Fatal(err)
- }
- if stored.Views[0].Map.Settings.Height != height || stored.Views[1].Map.Settings.Height != 0 {
- t.Fatal("height change did not stay within its view")
- }
- }
-}
-
-func TestAttributeViewMapImportAndHistoryPreserveBindings(t *testing.T) {
- t.Run("empty", func(t *testing.T) { testAttributeViewMapImportAndHistoryPreserveBindings(t, false) })
- t.Run("populated", func(t *testing.T) { testAttributeViewMapImportAndHistoryPreserveBindings(t, true) })
-}
-
-func testAttributeViewMapImportAndHistoryPreserveBindings(t *testing.T, populated bool) {
- attrView, view := setupMapTest(t)
- oldHistory := util.HistoryDir
- util.HistoryDir = t.TempDir()
- t.Cleanup(func() { util.HistoryDir = oldHistory })
- view.Map.Settings = av.MapSettings{LocationKeyID: ast.NewNodeID(), Height: 640}
- if populated {
- primary := attrView.GetBlockKeyValues()
- itemID := ast.NewNodeID()
- primary.Values = []*av.Value{{ID: ast.NewNodeID(), KeyID: primary.Key.ID, BlockID: itemID,
- Type: av.KeyTypeBlock, IsDetached: true, Block: &av.ValueBlock{Content: "Map import record"}}}
- view.ItemIDs = []string{itemID}
- }
- if err := av.SaveAttributeView(attrView); err != nil {
- t.Fatal(err)
- }
- data, err := json.Marshal(attrView)
- if err != nil {
- t.Fatal(err)
- }
- for _, encrypted := range []bool{false, true} {
- imported, err := isolateImportedAttributeViewBindings(data, nil, encrypted)
- if err != nil || !bytes.Equal(data, imported) {
- t.Fatalf("import changed valid missing map bindings: %v", err)
- }
- }
- created := time.Unix(1791514800, 0)
- path := filepath.Join(util.HistoryDir, created.Format("2006-01-02-150405")+"-update", "storage", "av", attrView.ID+".json")
- if err = os.MkdirAll(filepath.Dir(path), 0755); err != nil {
- t.Fatal(err)
- }
- if err = os.WriteFile(path, data, 0600); err != nil {
- t.Fatal(err)
- }
- rendered, _, err := RenderHistoryAttributeView(attrView.ID, view.ID, "", "", 1, 10, nil, strconv.FormatInt(created.Unix(), 10))
- if err != nil {
- t.Fatal(err)
- }
- mapped, ok := rendered.(*av.Map)
- if !ok || mapped.Map == nil || *mapped.Map != view.Map.Settings || mapped.MapMarkerScope != "page" {
- t.Fatal("history lost map bindings")
- }
- after, _ := os.ReadFile(path)
- if !bytes.Equal(data, after) {
- t.Fatal("history rendering changed its source")
- }
- settingsData, err := json.Marshal(view.Map.Settings)
- if err != nil {
- t.Fatal(err)
- }
- var invalidInputs [][]byte
- for _, extra := range []string{`"serviceID":"openfreemap"`, `"serviceID":""`, `"showRecordList":true`, `"showRecordList":false`} {
- legacySettings := []byte(`{"locationKeyID":"` + view.Map.Settings.LocationKeyID + `",` + extra + `}`)
- invalid := bytes.Replace(data, settingsData, legacySettings, 1)
- if bytes.Equal(invalid, data) {
- t.Fatal("legacy map settings fixture did not replace settings")
- }
- invalidInputs = append(invalidInputs, invalid)
- }
- for _, spec := range []int{11, 12, av.MapSpec, av.CurrentSpec + 1} {
- attrView.Spec = spec
- view.Map.Spec = 1
- invalid, _ := json.Marshal(attrView)
- invalidInputs = append(invalidInputs, invalid)
- }
- for _, invalid := range invalidInputs {
- if _, err = parseHistoricalAttributeViewData(attrView.ID, invalid); err == nil {
- t.Fatal("history accepted malformed or unknown map format")
- }
- for _, encrypted := range []bool{false, true} {
- if _, err = isolateImportedAttributeViewBindings(invalid, nil, encrypted); err == nil {
- t.Fatal("import accepted malformed or unknown map format")
- }
- }
- if err = os.WriteFile(path, invalid, 0600); err != nil {
- t.Fatal(err)
- }
- if _, _, err = RenderHistoryAttributeView(attrView.ID, view.ID, "", "", 1, 10, nil, strconv.FormatInt(created.Unix(), 10)); err == nil {
- t.Fatal("history rendering accepted malformed or unknown map format")
- }
- after, readErr := os.ReadFile(path)
- if readErr != nil || !bytes.Equal(invalid, after) {
- t.Fatal("rejected history rendering changed its source")
- }
- }
-}
-
-func TestAttributeViewMapAndLocationImportOmittedValues(t *testing.T) {
- setupMapTest(t)
- for _, scenario := range []struct {
- name string
- layout av.LayoutType
- loc bool
- }{
- {"map", av.LayoutTypeMap, false},
- {"location", av.LayoutTypeTable, true},
- {"legacy table", av.LayoutTypeTable, false},
- {"legacy calendar", av.LayoutTypeCalendar, false},
- } {
- t.Run(scenario.name, func(t *testing.T) {
- database := newAttributeViewWithLayout(ast.NewNodeID(), scenario.layout)
- if scenario.loc {
- database.KeyValues = append(database.KeyValues, &av.KeyValues{Key: av.NewKey(ast.NewNodeID(), "Location", "", av.KeyTypeLocation)})
- }
- if err := av.SaveAttributeView(database); err != nil {
- t.Fatal(err)
- }
- data, err := json.Marshal(database)
- if err != nil {
- t.Fatal(err)
- }
- var root map[string]json.RawMessage
- if err = json.Unmarshal(data, &root); err != nil {
- t.Fatal(err)
- }
- var keyValues []map[string]json.RawMessage
- if err = json.Unmarshal(root["keyValues"], &keyValues); err != nil {
- t.Fatal(err)
- }
- for _, values := range []string{"", "null", "[]", "{}", `"invalid"`} {
- delete(keyValues[0], "values")
- if values != "" {
- keyValues[0]["values"] = json.RawMessage(values)
- }
- root["keyValues"], err = json.Marshal(keyValues)
- if err != nil {
- t.Fatal(err)
- }
- input, err := json.Marshal(root)
- if err != nil {
- t.Fatal(err)
- }
- for _, encrypted := range []bool{false, true} {
- t.Run(fmt.Sprintf("values=%q/encrypted=%t", values, encrypted), func(t *testing.T) {
- before := bytes.Clone(input)
- got, importErr := isolateImportedAttributeViewBindings(input, nil, encrypted)
- if !bytes.Equal(input, before) {
- t.Fatal("import changed the source JSON")
- }
- wantSuccess := values == "null" || values == "[]" || values == ""
- if wantSuccess && (importErr != nil || !bytes.Equal(got, input)) {
- t.Fatalf("rejected or rewrote valid empty data: %v", importErr)
- }
- if !wantSuccess && importErr == nil {
- t.Fatal("accepted malformed data")
- }
- })
- }
- }
- })
- }
-}
diff --git a/kernel/model/attribute_view_render.go b/kernel/model/attribute_view_render.go
index 3b40b1be7c..f6aab1e1ba 100644
--- a/kernel/model/attribute_view_render.go
+++ b/kernel/model/attribute_view_render.go
@@ -267,8 +267,6 @@ func getAttributeViewBaseInstance(viewable av.Viewable) (ret *av.BaseInstance) {
ret = instance.BaseInstance
case *av.Calendar:
ret = instance.BaseInstance
- case *av.Map:
- ret = instance.BaseInstance
case *av.List:
ret = instance.BaseInstance
case *av.Gallery:
@@ -498,7 +496,7 @@ func renderAttributeViewWithTarget(blockID, avID, viewID, query string, page, pa
func newAttributeViewWithLayout(avID string, initialLayout av.LayoutType) (ret *av.AttributeView) {
ret = av.NewAttributeView(avID)
switch initialLayout {
- case av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap, av.LayoutTypeGallery, av.LayoutTypeKanban:
+ case av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeGallery, av.LayoutTypeKanban:
default:
return
}
@@ -549,14 +547,8 @@ func renderAttributeView(attrView *av.AttributeView, nodeID, viewID, carrierView
// 渲染视图
renderContext := sql.NewAttributeViewRenderContext()
renderContext.ReadOnly = !writable
- if shouldPushAttributeViewTemplateErrors(view.LayoutType, writable) {
- defer renderContext.PushTemplateErrors()
- }
+ defer renderContext.PushTemplateErrors()
deferTemplateValues := shouldDeferAttributeViewTemplateValues(attrView, view, query, ignoreRows)
- if view.LayoutType == av.LayoutTypeMap && !writable {
- // 发布权限过滤可能改变分页边界,完整行集的模板值必须在重新分页前准备好。
- deferTemplateValues = false
- }
if deferTemplateValues {
viewable = sql.RenderViewWithDeferredTemplatesContext(attrView, view, query, ignoreRows, renderContext)
} else {
@@ -588,7 +580,7 @@ func renderAttributeView(attrView *av.AttributeView, nodeID, viewID, carrierView
}
// 渲染分组视图。当 ignoreRows 时若有已生成的分组则渲染元数据供面板使用,无分组则跳过(生成分组需要行数据)
- if view.LayoutType != av.LayoutTypeCalendar && view.LayoutType != av.LayoutTypeMap && (!ignoreRows || len(view.Groups) > 0) {
+ if view.LayoutType != av.LayoutTypeCalendar && (!ignoreRows || len(view.Groups) > 0) {
err = renderAttributeViewGroups(viewable, attrView, view, query, page, pageSize, groupPaging, groupRenderSource,
ignoreRows, writable, target, targetGroupID, renderContext, filterContext)
}
@@ -742,7 +734,7 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
// 将分组视图的分组字段清空,减少冗余(字段信息可以在总的视图 view 对象上获取到)
switch groupView.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
groupView.GetTableLayout().Columns = nil
case av.LayoutTypeGallery:
groupView.Gallery.CardFields = nil
@@ -789,7 +781,7 @@ func hideEmptyGroupViews(view *av.View, viewable av.Viewable) {
itemCount := 0
switch viewable.GetType() {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
itemCount = av.TableFromViewable(viewable).RowCount
case av.LayoutTypeGallery:
itemCount = viewable.(*av.Gallery).CardCount
@@ -1035,7 +1027,7 @@ func shouldDeferAttributeViewTemplateValues(attrView *av.AttributeView, view *av
return templateKeyIDs[fieldID] && nil != calc && av.CalcOperatorNone != calc.Operator
}
switch view.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
for _, column := range view.GetTableLayout().Columns {
if nil != column && nil != column.BaseField && checkField(column.ID, column.Calc) {
return false
@@ -1102,7 +1094,7 @@ func renderViewableInstance(viewable av.Viewable, view *av.View, attrView *av.At
return
}
targetIndex = findAttributeViewTargetIndex(targetItemID, len(calendar.Rows), func(index int) string { return calendar.Rows[index].ID })
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList:
table := av.TableFromViewable(viewable)
targetIndex = findAttributeViewTargetIndex(targetItemID, len(table.Rows), func(index int) string { return table.Rows[index].ID })
table.RowCount = len(table.Rows)
@@ -1114,9 +1106,6 @@ func renderViewableInstance(viewable av.Viewable, view *av.View, attrView *av.At
if targetIndex >= 0 {
targetOffset = start
}
- if mapped, ok := viewable.(*av.Map); ok {
- mapped.RowsBeforePagination = table.Rows
- }
table.Rows = table.Rows[start:end]
case av.LayoutTypeGallery:
gallery := viewable.(*av.Gallery)
@@ -1534,7 +1523,7 @@ func parseHistoricalAttributeViewData(avID string, data []byte) (*av.AttributeVi
if err := av.CheckSpec(view); nil != err {
return nil, err
}
- if err := view.ValidateMapLayouts(); nil != err {
+ if err := view.ValidateLayouts(); nil != err {
return nil, err
}
if err := view.NormalizeLocations(); nil != err {
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 9a9307566a..86263b8677 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -5002,8 +5002,8 @@ func exportRefTreesWithConfig(tree *parse.Tree, defBlockIDs *[]string, retTrees
func getAttrViewTable(attrView *av.AttributeView, view *av.View, query string) (ret *av.Table) {
switch view.LayoutType {
- case av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
- // 复用行列导出,读取各布局的字段顺序和显隐设置,不加载地图服务。
+ case av.LayoutTypeList, av.LayoutTypeCalendar:
+ // 复用行列导出,读取各布局的字段顺序和显隐设置。
case av.LayoutTypeGallery:
view.Table = av.NewLayoutTable()
for _, field := range view.Gallery.CardFields {
diff --git a/kernel/model/publish_access.go b/kernel/model/publish_access.go
index 1fdda1c000..db68cc33fe 100644
--- a/kernel/model/publish_access.go
+++ b/kernel/model/publish_access.go
@@ -578,7 +578,7 @@ func FilterViewByPublishAccess(c *gin.Context, publishAccess PublishAccess, view
ret = viewable
switch ret.GetType() {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
table := av.TableFromViewable(ret)
filteredRows := []*av.TableRow{}
for _, row := range table.Rows {
@@ -587,10 +587,6 @@ func FilterViewByPublishAccess(c *gin.Context, publishAccess PublishAccess, view
}
}
table.Rows = filteredRows
- if ret.GetType() == av.LayoutTypeMap {
- table.RowCount = len(filteredRows)
- clearPublishedAttributeViewMapCalculations(ret.(*av.Map))
- }
if ret.GetType() == av.LayoutTypeCalendar {
table.RowCount = len(filteredRows)
table.CalendarTargetDate = nil
@@ -743,7 +739,7 @@ func (filter *attributeViewPublishAccessFilter) filterViewable(attrView *av.Attr
}
switch viewable.GetType() {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
table := av.TableFromViewable(viewable)
filter.filterGroupValue(attrView, table.BaseInstance)
for _, row := range table.Rows {
@@ -755,9 +751,6 @@ func (filter *attributeViewPublishAccessFilter) filterViewable(attrView *av.Attr
continue
}
filter.filterBaseValue(attrView, row.ID, cell.BaseValue)
- if av.LayoutTypeMap == viewable.GetType() {
- filter.filterMapTemplateValue(attrView, row.ID, cell.BaseValue)
- }
}
}
for _, group := range table.Groups {
diff --git a/kernel/model/publish_access_test.go b/kernel/model/publish_access_test.go
index 70809b7aeb..4157e414e9 100644
--- a/kernel/model/publish_access_test.go
+++ b/kernel/model/publish_access_test.go
@@ -1087,11 +1087,10 @@ func TestCheckAttributeViewBlockTreesAccessableByPublishAccess(t *testing.T) {
}
func TestFilterAttributeViewRelatedValuesByPublishAccess(t *testing.T) {
- t.Run("table", func(t *testing.T) { testFilterAttributeViewRelatedValuesByPublishAccess(t, false) })
- t.Run("map", func(t *testing.T) { testFilterAttributeViewRelatedValuesByPublishAccess(t, true) })
+ t.Run("table", func(t *testing.T) { testFilterAttributeViewRelatedValuesByPublishAccess(t) })
}
-func testFilterAttributeViewRelatedValuesByPublishAccess(t *testing.T, mapped bool) {
+func testFilterAttributeViewRelatedValuesByPublishAccess(t *testing.T) {
const (
sourceAvID = "20260726000100-source1"
targetAvID = "20260726000101-target1"
@@ -1196,11 +1195,7 @@ func testFilterAttributeViewRelatedValuesByPublishAccess(t *testing.T, mapped bo
},
}
- var instance av.Viewable = table
- if mapped {
- instance = &av.Map{Table: table}
- }
- filter.filterViewable(sourceAttrView, instance)
+ filter.filterViewable(sourceAttrView, table)
filteredRelation := table.Rows[0].Cells[0].Value
if filteredRelation == relationValue {
diff --git a/kernel/model/template.go b/kernel/model/template.go
index a048d6d3c2..0d547a1fa3 100644
--- a/kernel/model/template.go
+++ b/kernel/model/template.go
@@ -887,13 +887,6 @@ func applyTemplateAttributeViewPlan(node *ast.Node, plan *templateAttributeViewP
func templateAttributeViewPreviewTable(node *ast.Node, plan *templateAttributeViewPlan) *ast.Node {
view := *plan.selectedView
- if nil != plan.selectedView.Map {
- mapLayout := *plan.selectedView.Map
- table := *mapLayout.LayoutTable
- table.Columns = append([]*av.ViewTableColumn(nil), table.Columns...)
- mapLayout.LayoutTable = &table
- view.Map = &mapLayout
- }
if nil != plan.selectedView.Calendar {
calendar := *plan.selectedView.Calendar
table := *calendar.LayoutTable
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 20736a273f..2663a13ab9 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -500,8 +500,6 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewCardWidth(op)
case "setAttrViewConditionalColors":
ret = tx.doSetAttrViewConditionalColors(op)
- case "setAttrViewMap":
- ret = tx.doSetAttrViewMap(op)
case "setAttrViewCalendar":
ret = tx.doSetAttrViewCalendar(op)
case "setAttrViewCardLayout":
diff --git a/kernel/server/map_host.go b/kernel/server/map_host.go
deleted file mode 100644
index bce7a4bc2c..0000000000
--- a/kernel/server/map_host.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-package server
-
-import (
- "net/http"
- "net/url"
- "os"
- "path"
- "path/filepath"
- "strings"
-
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-// 地图静态资源没有用户数据;允许不携带 Cookie 的 opaque-origin 子框架读取。
-// 精确白名单独立于通用 stage 路由,防止沙箱策略被路径别名绕过。
-var mapHostFiles = map[string]string{
- "/stage/map/index.html": "stage/map/index.html",
- "/stage/map/wrapper.html": "stage/map/wrapper.html",
- "/stage/map/host.css": "stage/map/host.css",
- "/stage/build/map/host.js": "stage/build/map/host.js",
- "/stage/build/map/wrapper.js": "stage/build/map/wrapper.js",
- "/stage/build/map/maplibre-gl.js": "stage/build/map/maplibre-gl.js",
- "/stage/build/map/maplibre-gl.css": "stage/build/map/maplibre-gl.css",
- "/stage/build/map/maplibre-gl-csp-worker.js": "stage/build/map/maplibre-gl-csp-worker.js",
- "/stage/build/map/maplibre-LICENSE.txt": "stage/build/map/maplibre-LICENSE.txt",
-}
-
-func mapWrapperPolicy(host, provider string) (string, bool) {
- if _, valid := mapHostPolicy(host, provider); !valid {
- return "", false
- }
- // 外层只运行固定本地代码;其 frame-src 持续约束内层框架自己的导航。
- return "default-src 'none'; sandbox allow-scripts allow-same-origin; script-src " +
- host + "/stage/build/map/wrapper.js; style-src 'unsafe-inline' " + host + "/stage/map/host.css; connect-src 'none'; " +
- "frame-src " + host + "/stage/map/index.html; worker-src 'none'; object-src 'none'; " +
- "base-uri 'none'; form-action 'none'; frame-ancestors 'self'", true
-}
-
-func mapHostPolicy(host, provider string) (string, bool) {
- // CSP 的本地来源仅允许固定资源路径,不授权整个同源内核 API。
- u, err := url.Parse("http://" + host)
- if err != nil || u.Host != host || u.Hostname() == "" || u.User != nil ||
- strings.ContainsAny(host, " \t\r\n;'\"\\/?#") {
- return "", false
- }
- local := host + "/stage/build/map/"
- scripts := local + "host.js"
- connect, images, fonts, styles, workers := "'none'", "data: blob:", "'none'", "'unsafe-inline' "+host+"/stage/map/host.css", "'none'"
- switch provider {
- case "openfreemap":
- scripts += " " + local + "maplibre-gl.js"
- connect = "https://tiles.openfreemap.org " + local + "maplibre-gl-csp-worker.js"
- images += " https://tiles.openfreemap.org"
- styles += " " + local + "maplibre-gl.css"
- workers = "blob:"
- default:
- return "", false
- }
- return "default-src 'none'; sandbox allow-scripts; script-src " + scripts +
- "; connect-src " + connect + "; img-src " + images + "; style-src " + styles +
- "; font-src " + fonts + "; worker-src " + workers +
- "; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'", true
-}
-
-func mapHostMiddleware() gin.HandlerFunc {
- return func(c *gin.Context) {
- requestPath := c.Request.URL.Path
- // 通用静态文件服务会清理路径;必须先识别别名再拒绝,不能让别名绕过 CSP。
- cleanPath := path.Clean(strings.ReplaceAll(requestPath, "\\", "/"))
- isMapPath := func(value string) bool {
- // 默认不区分大小写的文件系统,以及 Windows 末尾点/空格,也不能形成别名。
- parts := strings.Split(strings.ReplaceAll(value, "\\", "/"), "/")
- for i, part := range parts {
- part = strings.TrimRight(part, " ")
- if part != "." && part != ".." {
- part = strings.TrimRight(part, ". ")
- }
- parts[i] = part
- }
- value = strings.ToLower(path.Clean(strings.Join(parts, "/")))
- return value == "/stage/map" || value == "/stage/build/map" ||
- strings.HasPrefix(value, "/stage/map/") || strings.HasPrefix(value, "/stage/build/map/")
- }
- if !isMapPath(requestPath) && !isMapPath(cleanPath) {
- c.Next()
- return
- }
- c.Abort()
- file, ok := mapHostFiles[requestPath]
- if !ok || requestPath != cleanPath || c.Request.URL.RawPath != "" || (c.Request.Method != http.MethodGet && c.Request.Method != http.MethodHead) {
- c.Status(http.StatusNotFound)
- return
- }
- c.Header("Cache-Control", "no-store")
- c.Header("X-Content-Type-Options", "nosniff")
- c.Header("Access-Control-Allow-Origin", "*")
- c.Header("Access-Control-Allow-Credentials", "")
- c.Header("Referrer-Policy", "strict-origin-when-cross-origin")
- c.Header("Permissions-Policy", "geolocation=(), camera=(), microphone=(), payment=(), usb=(), serial=(), bluetooth=()")
- if requestPath == "/stage/map/index.html" || requestPath == "/stage/map/wrapper.html" {
- // BYPASS 模式跳过 opaque-origin 鉴权,子框架自身导航后的请求无法安全隔离。
- if util.SiYuanAccessAuthCodeBypass {
- c.Status(http.StatusForbidden)
- return
- }
- policy, valid := mapHostPolicy(c.Request.Host, c.Query("provider"))
- if requestPath == "/stage/map/wrapper.html" {
- policy, valid = mapWrapperPolicy(c.Request.Host, c.Query("provider"))
- }
- if !valid {
- c.Status(http.StatusBadRequest)
- return
- }
- c.Header("Content-Security-Policy", policy)
- }
- resource, err := os.Open(filepath.Join(util.WorkingDir, filepath.FromSlash(file)))
- if err != nil {
- c.Status(http.StatusNotFound)
- return
- }
- defer resource.Close()
- info, err := resource.Stat()
- if err != nil || !info.Mode().IsRegular() {
- c.Status(http.StatusNotFound)
- return
- }
- // ServeFile 会将 index.html 重定向到目录;宿主必须保持精确的受保护 URL。
- http.ServeContent(c.Writer, c.Request, info.Name(), info.ModTime(), resource)
- }
-}
diff --git a/kernel/server/map_host_test.go b/kernel/server/map_host_test.go
deleted file mode 100644
index ae0ffab091..0000000000
--- a/kernel/server/map_host_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-package server
-
-import (
- "net/http"
- "net/http/httptest"
- "os"
- "path/filepath"
- "strings"
- "testing"
-
- "github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/util"
-)
-
-func TestMapHostPolicy(t *testing.T) {
- for _, provider := range []string{"openfreemap"} {
- policy, ok := mapHostPolicy("localhost:6806", provider)
- if !ok || !strings.Contains(policy, "sandbox allow-scripts;") ||
- strings.Contains(policy, "allow-same-origin") || strings.Contains(policy, "'unsafe-eval'") ||
- strings.Contains(policy, "connect-src 'self'") || !strings.Contains(policy, "form-action 'none'") {
- t.Fatalf("unsafe policy for %s: %s", provider, policy)
- }
- wrapper, valid := mapWrapperPolicy("localhost:6806", provider)
- if !valid || !strings.Contains(wrapper, "frame-src localhost:6806/stage/map/index.html;") ||
- !strings.Contains(wrapper, "script-src localhost:6806/stage/build/map/wrapper.js;") ||
- !strings.Contains(wrapper, "style-src 'unsafe-inline' localhost:6806/stage/map/host.css;") ||
- !strings.Contains(wrapper, "connect-src 'none'") || strings.Contains(wrapper, "https://") ||
- strings.Contains(wrapper, "script-src 'self'") {
- t.Fatalf("unsafe wrapper policy for %s: %s", provider, wrapper)
- }
- }
- for _, host := range []string{"", "localhost; script-src *", "a.example/path", "user@host", "host\nvalue", "host?x=1", "host'"} {
- if _, ok := mapHostPolicy(host, "openfreemap"); ok {
- t.Fatalf("accepted host %q", host)
- }
- if _, ok := mapWrapperPolicy(host, "openfreemap"); ok {
- t.Fatalf("accepted wrapper host %q", host)
- }
- }
- if _, ok := mapHostPolicy("localhost:6806", "custom"); ok {
- t.Fatal("accepted arbitrary provider")
- }
- if _, ok := mapWrapperPolicy("localhost:6806", "custom"); ok {
- t.Fatal("accepted arbitrary wrapper provider")
- }
-}
-
-func TestMapHostRejectsRemovedProviders(t *testing.T) {
- for _, provider := range []string{"amap", "tencent", "baidu", "custom", ""} {
- if _, ok := mapHostPolicy("localhost:6806", provider); ok {
- t.Fatalf("accepted provider %q", provider)
- }
- if _, ok := mapWrapperPolicy("localhost:6806", provider); ok {
- t.Fatalf("accepted wrapper provider %q", provider)
- }
- }
- policy, ok := mapHostPolicy("localhost:6806", "openfreemap")
- if !ok || !strings.Contains(policy, "https://tiles.openfreemap.org") {
- t.Fatal("missing built-in tile source")
- }
- for _, host := range []string{"amap.com", "autonavi.com", "qq.com", "baidu.com", "bdimg.com"} {
- if strings.Contains(policy, host) {
- t.Fatalf("retained removed host %s", host)
- }
- }
-}
-
-func TestMapHostStaticIsolationHeaders(t *testing.T) {
- old := util.WorkingDir
- oldBypass := util.SiYuanAccessAuthCodeBypass
- util.SiYuanAccessAuthCodeBypass = false
- util.WorkingDir = t.TempDir()
- t.Cleanup(func() { util.WorkingDir = old; util.SiYuanAccessAuthCodeBypass = oldBypass })
- for _, file := range mapHostFiles {
- full := filepath.Join(util.WorkingDir, file)
- if err := os.MkdirAll(filepath.Dir(full), 0700); err != nil {
- t.Fatal(err)
- }
- if err := os.WriteFile(full, []byte("fixture"), 0600); err != nil {
- t.Fatal(err)
- }
- }
- router := gin.New()
- router.Use(mapHostMiddleware())
- router.Static("/stage", filepath.Join(util.WorkingDir, "stage"))
- router.GET("/api/conf", func(c *gin.Context) { c.String(200, "ordinary route") })
- for _, path := range []string{"/stage/map/index.html?provider=openfreemap", "/stage/build/map/host.js",
- "/stage/map/wrapper.html?provider=openfreemap", "/stage/build/map/wrapper.js"} {
- response := httptest.NewRecorder()
- router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, path, nil))
- if response.Code != 200 || response.Body.String() != "fixture" ||
- response.Header().Get("Cache-Control") != "no-store" ||
- response.Header().Get("Access-Control-Allow-Origin") != "*" ||
- response.Header().Get("Access-Control-Allow-Credentials") != "" ||
- response.Header().Get("X-Content-Type-Options") != "nosniff" {
- t.Fatalf("unexpected resource response %s: %d %v", path, response.Code, response.Header())
- }
- if strings.Contains(path, "index.html") && !strings.Contains(response.Header().Get("Content-Security-Policy"), "sandbox allow-scripts") {
- t.Fatal("missing enforced sandbox")
- }
- if strings.Contains(path, "wrapper.html") && !strings.Contains(response.Header().Get("Content-Security-Policy"), "frame-src example.com/stage/map/index.html;") {
- t.Fatal("missing wrapper navigation boundary")
- }
- }
- for _, path := range []string{"/stage/map/index.html", "/stage/map/index.html?provider=custom", "/stage/map/index.html?provider=amap", "/stage/map/wrapper.html?provider=tencent", "/stage/map/index.html?provider=baidu", "/stage/map/wrapper.html", "/stage/map/wrapper.html?provider=custom",
- "/stage/map/private.json", "/stage/build/map/host.js.map", "/stage/map%2findex.html?provider=openfreemap", "/stage/Map/wrapper.html?provider=openfreemap",
- "/stage/.%2fmap/index.html?provider=openfreemap", "/stage/%2fmap/index.html?provider=openfreemap",
- "/stage/anything/..%2fmap/index.html?provider=openfreemap", "/stage/build/.%2fmap/host.js",
- "/stage/%5cmap%5cindex.html?provider=openfreemap", "/stage/Map/index.html?provider=openfreemap",
- "/stage/build/MAP/host.js", "/stage/map./index.html?provider=openfreemap", "/stage/map%20/index.html?provider=openfreemap"} {
- response := httptest.NewRecorder()
- router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, path, nil))
- if response.Code == http.StatusOK {
- t.Fatalf("unexpected allowed resource %s", path)
- }
- }
- response := httptest.NewRecorder()
- router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/api/conf", nil))
- if response.Code != 200 || response.Body.String() != "ordinary route" || response.Header().Get("Content-Security-Policy") != "" {
- t.Fatal("map middleware changed unrelated route")
- }
- util.SiYuanAccessAuthCodeBypass = true
- for _, page := range []string{"index.html", "wrapper.html"} {
- response = httptest.NewRecorder()
- router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/stage/map/"+page+"?provider=openfreemap", nil))
- if response.Code != http.StatusForbidden || strings.Contains(response.Body.String(), "fixture") {
- t.Fatal("map host available in authentication bypass mode")
- }
- }
-}
diff --git a/kernel/server/retired_static_resources.go b/kernel/server/retired_static_resources.go
new file mode 100644
index 0000000000..45268de8a2
--- /dev/null
+++ b/kernel/server/retired_static_resources.go
@@ -0,0 +1,34 @@
+// SiYuan - From thought to insight, with agents
+// Copyright (c) 2020-present, b3log.org
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+package server
+
+import (
+ "net/http"
+ "path"
+ "strings"
+
+ "github.com/gin-gonic/gin"
+)
+
+func retiredStaticResourcesMiddleware() gin.HandlerFunc {
+ return func(c *gin.Context) {
+ // 升级后磁盘上可能仍有旧地图产物,禁止通过通用静态路由及文件系统路径别名访问。
+ parts := strings.Split(strings.ReplaceAll(c.Request.URL.Path, "\\", "/"), "/")
+ for i, part := range parts {
+ part = strings.TrimRight(part, " ")
+ if part != "." && part != ".." {
+ part = strings.TrimRight(part, ". ")
+ }
+ parts[i] = part
+ }
+ requestPath := strings.ToLower(path.Clean(strings.Join(parts, "/")))
+ if requestPath == "/stage/map" || strings.HasPrefix(requestPath, "/stage/map/") ||
+ requestPath == "/stage/build/map" || strings.HasPrefix(requestPath, "/stage/build/map/") {
+ c.AbortWithStatus(http.StatusNotFound)
+ return
+ }
+ c.Next()
+ }
+}
diff --git a/kernel/server/retired_static_resources_test.go b/kernel/server/retired_static_resources_test.go
new file mode 100644
index 0000000000..c5c6257e62
--- /dev/null
+++ b/kernel/server/retired_static_resources_test.go
@@ -0,0 +1,72 @@
+// SiYuan - From thought to insight, with agents
+// Copyright (c) 2020-present, b3log.org
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+package server
+
+import (
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/gin-gonic/gin"
+)
+
+func TestRetiredMapResourcesUnavailableWithOldFilesOnDisk(t *testing.T) {
+ root := t.TempDir()
+ for _, name := range []string{"map/index.html", "map/wrapper.html", "map/host.css",
+ "build/map/host.js", "build/map/wrapper.js", "build/map/maplibre-gl.js",
+ "build/map/maplibre-gl.css", "build/map/maplibre-gl-csp-worker.js",
+ "build/desktop/index.js", "map-icons/pin.svg", "build/mapping.js", "plugins/example/asset.js"} {
+ full := filepath.Join(root, filepath.FromSlash(name))
+ if err := os.MkdirAll(filepath.Dir(full), 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(full, []byte("fixture:"+name), 0600); err != nil {
+ t.Fatal(err)
+ }
+ }
+ router := gin.New()
+ router.Use(retiredStaticResourcesMiddleware())
+ router.Static("/stage", root)
+ router.Static("/plugins", filepath.Join(root, "plugins"))
+ router.GET("/api/conf", func(c *gin.Context) { c.String(http.StatusOK, "ordinary route") })
+ for _, target := range []string{"/stage/map", "/stage/map/", "/stage/build/map", "/stage/build/map/",
+ "/stage/map/index.html", "/stage/map/index.html?provider=openfreemap", "/stage/map/wrapper.html",
+ "/stage/map/host.css", "/stage/build/map/host.js", "/stage/build/map/wrapper.js",
+ "/stage/build/map/maplibre-gl.js", "/stage/build/map/maplibre-gl.css",
+ "/stage/build/map/maplibre-gl-csp-worker.js", "/stage/map/private.json",
+ "/stage/map%2findex.html", "/stage/Map/wrapper.html", "/stage/.%2fmap/index.html",
+ "/stage/%2fmap/index.html", "/stage/anything/..%2fmap/index.html", "/stage/build/.%2fmap/host.js",
+ "/stage/%5cmap%5cindex.html", "/stage/build/MAP/host.js", "/stage/map./index.html",
+ "/stage/map%20/index.html", "/stage/build/map.%20/host.js", "/stage/%6dap/index.html"} {
+ for _, method := range []string{http.MethodGet, http.MethodHead, http.MethodPost} {
+ t.Run(method+" "+target, func(t *testing.T) {
+ response := httptest.NewRecorder()
+ router.ServeHTTP(response, httptest.NewRequest(method, target, nil))
+ if response.Code != http.StatusNotFound || response.Body.Len() != 0 {
+ t.Fatalf("retired resource served: status=%d body=%q", response.Code, response.Body.String())
+ }
+ })
+ }
+ }
+ for _, target := range []string{"build/desktop/index.js", "map-icons/pin.svg", "build/mapping.js"} {
+ response := httptest.NewRecorder()
+ router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/stage/"+target, nil))
+ if response.Code != http.StatusOK || response.Body.String() != "fixture:"+target {
+ t.Fatalf("ordinary static resource changed: %s status=%d", target, response.Code)
+ }
+ }
+ response := httptest.NewRecorder()
+ router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/plugins/example/asset.js", nil))
+ if response.Code != http.StatusOK || response.Body.String() != "fixture:plugins/example/asset.js" {
+ t.Fatal("ordinary plugin resource changed")
+ }
+ response = httptest.NewRecorder()
+ router.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/api/conf", nil))
+ if response.Code != http.StatusOK || response.Body.String() != "ordinary route" {
+ t.Fatal("ordinary API route changed")
+ }
+}
diff --git a/kernel/server/serve.go b/kernel/server/serve.go
index dd7a6c1608..38072cd1e9 100644
--- a/kernel/server/serve.go
+++ b/kernel/server/serve.go
@@ -168,7 +168,7 @@ func Serve(fastMode bool, cookieKey string) {
// https://github.com/siyuan-note/siyuan/security/advisories/GHSA-hpj5-f7cj-vvwr
ginServer.Use(tlsEnforceMiddleware())
ginServer.Use(sessions.Sessions("siyuan", sessionStore))
- ginServer.Use(mapHostMiddleware())
+ ginServer.Use(retiredStaticResourcesMiddleware())
serveDebug(ginServer)
serveAssets(ginServer)
diff --git a/kernel/sql/av.go b/kernel/sql/av.go
index bdf89e61b2..cbe6fb0000 100644
--- a/kernel/sql/av.go
+++ b/kernel/sql/av.go
@@ -178,7 +178,7 @@ func RenderGroupViewWithSourceContext(attrView *av.AttributeView, view, groupVie
source *GroupViewRenderSource, ignoreRows bool, context *AttributeViewRenderContext) (ret av.Viewable) {
var err error
switch groupView.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
// 这里需要使用深拷贝,因为字段上可能会带有计算(FieldCalc),每个分组视图的计算结果都需要分别存储在不同的字段实例上
err = copier.CopyWithOption(&groupView.GetTableLayout().Columns, &view.GetTableLayout().Columns, copier.Option{DeepCopy: true})
groupView.GetTableLayout().ShowIcon = view.GetTableLayout().ShowIcon
@@ -218,7 +218,7 @@ func RenderGroupViewWithSourceContext(attrView *av.AttributeView, view, groupVie
if nil != err {
logging.LogErrorf("copy view fields [%s] to group [%s] failed: %s", view.ID, groupView.ID, err)
switch groupView.LayoutType {
- case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar, av.LayoutTypeMap:
+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeCalendar:
groupView.GetTableLayout().Columns = view.GetTableLayout().Columns
case av.LayoutTypeGallery:
groupView.Gallery.CardFields = view.Gallery.CardFields
@@ -289,8 +289,8 @@ func renderViewWithContext(attrView *av.AttributeView, view *av.View, query stri
renderedAttrViews[attrView.ID] = attrView
ret = renderView(attrView, view, query, &depth, renderedAttrViews, ignoreRows, deferTemplateValues, renderContext)
- // 元数据、延迟模板、日历和地图渲染不写入缓存,避免后续渲染读取已裁剪的条目。
- if !ignoreRows && !deferTemplateValues && view.LayoutType != av.LayoutTypeCalendar && view.LayoutType != av.LayoutTypeMap {
+ // 元数据、延迟模板和日历渲染不写入缓存,避免后续渲染读取已裁剪的条目。
+ if !ignoreRows && !deferTemplateValues && view.LayoutType != av.LayoutTypeCalendar {
attrView.RenderedViewables[ret.GetID()] = ret
}
renderedAttrViews[attrView.ID] = attrView
@@ -309,13 +309,6 @@ func renderView(attrView *av.AttributeView, view *av.View, query string, depth *
case av.LayoutTypeTable:
ret = renderAttributeViewTable(attrView, view, query, depth, cachedAttrViews, ignoreRows, deferTemplateValues,
renderContext)
- case av.LayoutTypeMap:
- table := renderAttributeViewTable(attrView, view, query, depth, cachedAttrViews, ignoreRows, deferTemplateValues, renderContext)
- settings := view.Map.Settings
- table.Map = &settings
- table.MapMarkerScope = "page"
- table.Group = nil
- ret = &av.Map{Table: table}
case av.LayoutTypeCalendar:
table := renderAttributeViewTable(attrView, view, query, depth, cachedAttrViews, ignoreRows, deferTemplateValues, renderContext)
settings := view.Calendar.Settings
diff --git a/kernel/sql/av_table.go b/kernel/sql/av_table.go
index 77847a142c..1abdcc4511 100644
--- a/kernel/sql/av_table.go
+++ b/kernel/sql/av_table.go
@@ -29,7 +29,7 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, query string, depth *int,
cachedAttrViews map[string]*av.AttributeView, ignoreRows, deferTemplateValues bool,
renderContext *AttributeViewRenderContext) (ret *av.Table) {
- if !ignoreRows && !deferTemplateValues && view.LayoutType != av.LayoutTypeCalendar && view.LayoutType != av.LayoutTypeMap {
+ if !ignoreRows && !deferTemplateValues && view.LayoutType != av.LayoutTypeCalendar {
viewable := attrView.RenderedViewables[view.ID]
if nil != viewable {
if ret = av.TableFromViewable(viewable); nil != ret {
@@ -62,7 +62,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
Type: key.Type,
Icon: key.Icon,
Wrap: col.Wrap,
- Hidden: col.Hidden && !((av.LayoutTypeList == view.LayoutType || av.LayoutTypeCalendar == view.LayoutType || av.LayoutTypeMap == view.LayoutType) && av.KeyTypeBlock == key.Type),
+ Hidden: col.Hidden && !((av.LayoutTypeList == view.LayoutType || av.LayoutTypeCalendar == view.LayoutType) && av.KeyTypeBlock == key.Type),
Desc: key.Desc,
Calc: col.Calc,
Options: key.Options,
diff --git a/scripts/android-dev-run.mjs b/scripts/android-dev-run.mjs
index 053392a8da..13f3fec379 100644
--- a/scripts/android-dev-run.mjs
+++ b/scripts/android-dev-run.mjs
@@ -236,7 +236,8 @@ const zipPath = path.join(os.tmpdir(), "siyuan-android-app.zip");
if (existsSync(zipPath)) {
unlinkSync(zipPath);
}
-const tarArgs = ["-a", "-cf", zipPath, "-C", appDir, "appearance", "guide", "stage"];
+const tarArgs = ["-a", "-cf", zipPath, "--exclude=stage/map", "--exclude=stage/build/map",
+ "-C", appDir, "appearance", "guide", "stage"];
const changelogsDir = path.join(appDir, "changelogs");
if (existsSync(changelogsDir)) {
tarArgs.push("changelogs");
diff --git a/scripts/build-release.py b/scripts/build-release.py
index 3e5c456197..3b34f9cb68 100644
--- a/scripts/build-release.py
+++ b/scripts/build-release.py
@@ -343,6 +343,8 @@ def create_mobile_assets(destination, version):
continue
if relative.parts[:3] == ("stage", "ocr", "runtime"):
continue
+ if relative.parts[:2] == ("stage", "map") or relative.parts[:3] == ("stage", "build", "map"):
+ continue
archive.write(path, relative.as_posix())
for filename in ("LICENSE", "THIRD_PARTY_NOTICES.md"):
archive.write(ROOT / filename, filename)
diff --git a/scripts/menu-owner-exceptions.json b/scripts/menu-owner-exceptions.json
index 54e4cdd084..a43217fc5e 100644
--- a/scripts/menu-owner-exceptions.json
+++ b/scripts/menu-owner-exceptions.json
@@ -275,14 +275,6 @@
"count": 1,
"reason": "AV 菜单保持既有构造和交互"
},
- "app/src/protyle/render/av/map/settings.ts | bindMapSettings/event:\"click\" | menu | open": {
- "count": 1,
- "reason": "AV 菜单保持既有构造和交互"
- },
- "app/src/protyle/render/av/map/unplaced.ts | bindMapUnplaced/event:\"click\" | menu | open": {
- "count": 1,
- "reason": "AV 菜单保持既有构造和交互"
- },
"app/src/protyle/render/av/newItemTemplate.ts | openContentTemplateMenu | menu | open": {
"count": 1,
"reason": "AV 菜单保持既有构造和交互"
diff --git a/scripts/test_build_release.py b/scripts/test_build_release.py
index e43f6713c1..6d961f5c7a 100644
--- a/scripts/test_build_release.py
+++ b/scripts/test_build_release.py
@@ -53,6 +53,19 @@ class BuildTests(unittest.TestCase):
build.copy_verified(source, self.root / "outside", self.root / "allowed")
self.assertFalse((self.root / "outside").exists())
+ def test_mobile_assets_exclude_retired_map_files(self):
+ kept = {"stage/build/mobile/index.html", "stage/map-icons/pin.svg", "appearance/theme.css",
+ "guide/document.sy", "LICENSE", "THIRD_PARTY_NOTICES.md"}
+ removed = {"stage/map/index.html", "stage/map/wrapper.html", "stage/build/map/host.js",
+ "stage/build/map/maplibre-gl.js", "stage/ocr/runtime/library"}
+ for name in kept | removed:
+ self.write(self.root / (name if name in {"LICENSE", "THIRD_PARTY_NOTICES.md"} else "app/" + name))
+ destination = self.root / "mobile/app.zip"
+ with patch.object(build, "ROOT", self.root), patch.object(build, "run"):
+ build.create_mobile_assets(destination, "3.8.7-alpha.8")
+ with zipfile.ZipFile(destination) as archive:
+ self.assertEqual(set(archive.namelist()), kept)
+
def test_wsl_sync_skips_matching_commit(self):
with patch.object(self.builder, "wsl", return_value="target") as wsl, patch.object(build, "run") as run:
self.builder.sync_wsl("target")