signalk-questdb 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.coderabbit.yaml +19 -15
- package/.release-please-manifest.json +1 -1
- package/CLAUDE.md +4 -3
- package/README.md +94 -5
- package/dist/api-contract.d.ts +46 -0
- package/dist/archive.d.ts +44 -0
- package/dist/archive.js +117 -0
- package/dist/archive.js.map +1 -0
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.js +27 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/gpx-import-session.d.ts +69 -0
- package/dist/gpx-import-session.js +218 -0
- package/dist/gpx-import-session.js.map +1 -0
- package/dist/gpx-import.d.ts +135 -0
- package/dist/gpx-import.js +452 -0
- package/dist/gpx-import.js.map +1 -0
- package/dist/history-v1.d.ts +2 -1
- package/dist/history-v1.js +77 -19
- package/dist/history-v1.js.map +1 -1
- package/dist/history-v2.d.ts +2 -1
- package/dist/history-v2.js +54 -26
- package/dist/history-v2.js.map +1 -1
- package/dist/ilp-writer.d.ts +1 -1
- package/dist/ilp-writer.js +4 -2
- package/dist/ilp-writer.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +239 -10
- package/dist/index.js.map +1 -1
- package/dist/query-client.js +27 -0
- package/dist/query-client.js.map +1 -1
- package/dist/retention.d.ts +28 -1
- package/dist/retention.js +152 -12
- package/dist/retention.js.map +1 -1
- package/package.json +2 -1
- package/public/assets/PluginConfigurationPanel-DR-y5e3d.js +11 -0
- package/public/assets/{_virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-D-Le-Wxu.js → _virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-BUtmcsA-.js} +1 -1
- package/public/assets/{dist-BI-Ygd_Z.js → dist-C5M3fhBw.js} +1 -1
- package/public/assets/helpers-oIxDNnZJ.js +1 -0
- package/public/assets/{hostInit-CdqUOHAJ.js → hostInit-B3lIJd9C.js} +1 -1
- package/public/assets/{index-mvK71Kw7.js → index-eAjx9ZuX.js} +2 -2
- package/public/assets/{pendingShares-BI6kviiM.js → pendingShares-PvyVL1Z8.js} +2 -2
- package/public/assets/utils-v9GZlbdk.js +4 -0
- package/public/remoteEntry.js +2 -2
- package/public/assets/PluginConfigurationPanel-JR1rvS7f.js +0 -9
- package/public/assets/helpers-CsBAxMau.js +0 -1
- package/public/assets/utils-BRGuweMc.js +0 -4
package/dist/retention.js
CHANGED
|
@@ -1,20 +1,160 @@
|
|
|
1
|
+
import { isSafeIdentifier, validateTimestamp, } from "./query-client.js";
|
|
2
|
+
import { ARCHIVE_TABLES, waitForApply } from "./archive.js";
|
|
1
3
|
const TABLES = ["signalk", "signalk_str", "signalk_position"];
|
|
2
4
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
// A partition is named by its day ("2026-08-01"); the name goes into the DROP
|
|
6
|
+
// statement as a literal, so anything else is refused rather than quoted.
|
|
7
|
+
const PARTITION_NAME = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
|
|
8
|
+
// The copy into the archive reads a whole day of a base table, which on a
|
|
9
|
+
// busy install is millions of rows and runs on QuestDB's single worker.
|
|
10
|
+
const COPY_TIMEOUT_MS = 120_000;
|
|
11
|
+
const APPLY_TIMEOUT_MS = 120_000;
|
|
12
|
+
/**
|
|
13
|
+
* Drop every daily partition that lies wholly before the retention cutoff,
|
|
14
|
+
* once a day. A partition still holding a row inside the window is kept
|
|
15
|
+
* whole until it ages out completely, so retention keeps at least the
|
|
16
|
+
* configured number of days, never fewer.
|
|
17
|
+
*
|
|
18
|
+
* Before a partition of `signalk_position` or `signalk` is dropped, the own
|
|
19
|
+
* vessel's rows that the options ask to keep are copied, thinned, into the
|
|
20
|
+
* archive, and the drop waits until QuestDB has applied that copy and reads
|
|
21
|
+
* know the archive covers it. A copy or a refresh that fails leaves the
|
|
22
|
+
* partition in place for the next run; a run stopped
|
|
23
|
+
* between the copy and the drop repeats the copy, which the archive's dedup
|
|
24
|
+
* keys absorb.
|
|
25
|
+
*/
|
|
26
|
+
export function startRetention(queryClient, options, debug,
|
|
27
|
+
// Awaited after each copy, before its drop: reads pick the archive by its
|
|
28
|
+
// cached span, so the span must reach a day before the base rows go.
|
|
29
|
+
onArchived = async () => { }) {
|
|
30
|
+
if (options.retentionDays <= 0)
|
|
5
31
|
return null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
32
|
+
let stopped = false;
|
|
33
|
+
// A first run over an install that recorded for years can take longer than
|
|
34
|
+
// the interval; a second run must not start on the same partitions.
|
|
35
|
+
let running = false;
|
|
36
|
+
async function expiredPartitions(table, cutoff) {
|
|
37
|
+
const result = await queryClient.exec(`SELECT name, maxTimestamp FROM table_partitions('${table}') ` +
|
|
38
|
+
`WHERE maxTimestamp < '${cutoff}' ORDER BY name`);
|
|
39
|
+
return result.dataset.flatMap((row) => {
|
|
40
|
+
const [name, to] = row;
|
|
41
|
+
if (typeof name !== "string" || !PARTITION_NAME.test(name))
|
|
42
|
+
return [];
|
|
43
|
+
if (typeof to !== "string")
|
|
44
|
+
return [];
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
name,
|
|
48
|
+
day: validateTimestamp(`${name}T00:00:00.000Z`),
|
|
49
|
+
to: validateTimestamp(to),
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async function count(table, where) {
|
|
55
|
+
const result = await queryClient.exec(`SELECT count() FROM ${table} WHERE ${where}`, COPY_TIMEOUT_MS);
|
|
56
|
+
const n = result.dataset[0]?.[0];
|
|
57
|
+
return typeof n === "number" ? n : 0;
|
|
58
|
+
}
|
|
59
|
+
/** The own-vessel rows of `partition` that the options keep, or null. */
|
|
60
|
+
async function keptWhere(table, partition) {
|
|
61
|
+
const where = `ts >= '${partition.day}' AND ts <= '${partition.to}' ` +
|
|
62
|
+
`AND context = 'self'`;
|
|
63
|
+
if (table === "signalk_position") {
|
|
64
|
+
return options.archiveOwnTrack ? where : null;
|
|
65
|
+
}
|
|
66
|
+
const matcher = options.archivePaths;
|
|
67
|
+
if (!matcher || matcher.isEmpty)
|
|
68
|
+
return null;
|
|
69
|
+
const result = await queryClient.exec(`SELECT DISTINCT path FROM signalk WHERE ${where}`, COPY_TIMEOUT_MS);
|
|
70
|
+
// A stored path the identifier guard rejects cannot be named in the
|
|
71
|
+
// filter; it is left out of the copy rather than failing every run.
|
|
72
|
+
const paths = result.dataset
|
|
73
|
+
.map((row) => row[0])
|
|
74
|
+
.filter((path) => typeof path === "string")
|
|
75
|
+
.filter((path) => matcher.matches(path))
|
|
76
|
+
.filter((path) => {
|
|
77
|
+
if (isSafeIdentifier(path))
|
|
78
|
+
return true;
|
|
79
|
+
debug(`Retention: ${path} cannot be archived, its name is not a safe identifier`);
|
|
80
|
+
return false;
|
|
81
|
+
})
|
|
82
|
+
.map((path) => `'${path}'`);
|
|
83
|
+
return paths.length > 0
|
|
84
|
+
? `${where} AND path IN (${paths.join(", ")})`
|
|
85
|
+
: null;
|
|
86
|
+
}
|
|
87
|
+
// first() rather than an average: the archive keeps samples the vessel
|
|
88
|
+
// actually recorded, so a position is one it was at and an angle is never
|
|
89
|
+
// averaged across north.
|
|
90
|
+
function thinnedSelect(table, where) {
|
|
91
|
+
const resolution = Math.floor(options.archiveResolutionSeconds);
|
|
92
|
+
const values = table === "signalk_position" ? ["lat", "lon"] : ["value"];
|
|
93
|
+
const keys = table === "signalk_position"
|
|
94
|
+
? "context, source"
|
|
95
|
+
: "path, context, source";
|
|
96
|
+
if (resolution <= 0) {
|
|
97
|
+
return `SELECT ts, ${keys}, ${values.join(", ")} FROM ${table} WHERE ${where}`;
|
|
98
|
+
}
|
|
99
|
+
const firsts = values.map((v) => `first(${v}) ${v}`).join(", ");
|
|
100
|
+
return (`SELECT ts, ${keys}, ${firsts} FROM ${table} WHERE ${where} ` +
|
|
101
|
+
`SAMPLE BY ${resolution}s ALIGN TO CALENDAR`);
|
|
102
|
+
}
|
|
103
|
+
/** Copy what is kept of `partition` to the archive; true if anything was. */
|
|
104
|
+
async function archive(table, partition) {
|
|
105
|
+
if (table === "signalk_str")
|
|
106
|
+
return false;
|
|
107
|
+
const where = await keptWhere(table, partition);
|
|
108
|
+
if (where === null)
|
|
109
|
+
return false;
|
|
110
|
+
if ((await count(table, where)) === 0)
|
|
111
|
+
return false;
|
|
112
|
+
const target = ARCHIVE_TABLES[table];
|
|
113
|
+
await queryClient.exec(`INSERT INTO ${target} ${thinnedSelect(table, where)}`, COPY_TIMEOUT_MS);
|
|
114
|
+
await waitForApply(queryClient, target, APPLY_TIMEOUT_MS);
|
|
115
|
+
if ((await count(target, where)) === 0) {
|
|
116
|
+
throw new Error(`the copy of ${table} ${partition.name} is missing`);
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
async function run() {
|
|
121
|
+
if (running || stopped)
|
|
122
|
+
return;
|
|
123
|
+
running = true;
|
|
124
|
+
try {
|
|
125
|
+
const cutoff = new Date(Date.now() - Math.floor(options.retentionDays) * DAY_MS).toISOString();
|
|
126
|
+
for (const table of TABLES) {
|
|
127
|
+
// One table failing leaves the others to run. Within a table, the
|
|
128
|
+
// first failure stops it: the later partitions would hit the same
|
|
129
|
+
// cause, and none of them is dropped without its copy.
|
|
130
|
+
try {
|
|
131
|
+
for (const partition of await expiredPartitions(table, cutoff)) {
|
|
132
|
+
if (stopped)
|
|
133
|
+
return;
|
|
134
|
+
if (await archive(table, partition))
|
|
135
|
+
await onArchived();
|
|
136
|
+
if (stopped)
|
|
137
|
+
return;
|
|
138
|
+
await queryClient.exec(`ALTER TABLE ${table} DROP PARTITION LIST '${partition.name}'`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
debug(`Retention for ${table} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
143
|
+
}
|
|
13
144
|
}
|
|
145
|
+
debug(`Retention check complete (keeping ${options.retentionDays} days)`);
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
running = false;
|
|
14
149
|
}
|
|
15
|
-
debug(`Retention check complete (keeping ${retentionDays} days)`);
|
|
16
150
|
}
|
|
17
|
-
|
|
18
|
-
|
|
151
|
+
void run();
|
|
152
|
+
const timer = setInterval(() => void run(), DAY_MS);
|
|
153
|
+
return {
|
|
154
|
+
stop() {
|
|
155
|
+
stopped = true;
|
|
156
|
+
clearInterval(timer);
|
|
157
|
+
},
|
|
158
|
+
};
|
|
19
159
|
}
|
|
20
160
|
//# sourceMappingURL=retention.js.map
|
package/dist/retention.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../src/retention.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../src/retention.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signalk-questdb",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "QuestDB history provider for Signal K — replaces signalk-to-influxdb",
|
|
6
6
|
"keywords": [
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@js-temporal/polyfill": "^0.5.0",
|
|
50
50
|
"minimatch": "^10.2.3",
|
|
51
|
+
"saxes": "^6.0.0",
|
|
51
52
|
"signalk-container-helper": "^0.11.0",
|
|
52
53
|
"typebox": "^1.3.11"
|
|
53
54
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./_virtual_mf___mfe_internal__signalk_questdb__mf_owner__196689844091135__loadShare__shared-BRI06Lxu.js";var a={root:{fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,color:`#333`,padding:`16px 0`},sectionToggle:{color:`#555`,display:`flex`,alignItems:`center`,gap:6,width:`100%`,textAlign:`left`,background:`none`,border:`none`,padding:0,cursor:`pointer`,userSelect:`none`},sectionMarker:{fontSize:11,transition:`transform 0.15s`},sectionTitle:{fontSize:13,fontWeight:600,color:`#888`,textTransform:`uppercase`,letterSpacing:`0.05em`,marginBottom:10,marginTop:24},btn:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`8px 16px`,border:`none`,borderRadius:6,fontSize:13,fontWeight:600,cursor:`pointer`},btnPrimary:{background:`#3b82f6`,color:`#fff`},btnSecondary:{background:`#f1f5f9`,color:`#475569`,border:`1px solid #e2e8f0`},btnWarn:{background:`#f59e0b`,color:`#fff`},btnDanger:{background:`#ef4444`,color:`#fff`},btnDisabled:{opacity:.5,cursor:`not-allowed`},btnSmall:{padding:`4px 12px`,fontSize:12},status:{marginTop:8,fontSize:12,minHeight:18},card:{display:`flex`,alignItems:`center`,gap:14,padding:`14px 18px`,background:`#f8f9fa`,border:`1px solid #e0e0e0`,borderRadius:10,marginBottom:12},cardIcon:{width:44,height:44,borderRadius:10,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:20,fontWeight:700,flexShrink:0},cardInfo:{flex:1},cardTitle:{fontSize:15,fontWeight:600,color:`#333`},cardMeta:{fontSize:12,color:`#888`},stateIndicator:{width:10,height:10,borderRadius:`50%`,flexShrink:0},fieldRow:{display:`flex`,alignItems:`center`,gap:12,marginBottom:10},label:{fontSize:13,fontWeight:500,color:`#555`,width:180,flexShrink:0},select:{padding:`6px 10px`,borderRadius:6,border:`1px solid #ccc`,fontSize:13,background:`#fff`,color:`#333`,minWidth:200},input:{padding:`6px 10px`,borderRadius:6,border:`1px solid #ccc`,fontSize:13,background:`#fff`,color:`#333`,width:200},inputSmall:{padding:`6px 10px`,borderRadius:6,border:`1px solid #ccc`,fontSize:13,background:`#fff`,color:`#333`,width:80},checkbox:{width:16,height:16,accentColor:`#3b82f6`},hint:{fontSize:11,color:`#aaa`,marginLeft:8},link:{color:`#3b82f6`,textDecoration:`none`,fontSize:13,fontWeight:600},textarea:{padding:`6px 10px`,borderRadius:6,border:`1px solid #ccc`,fontSize:13,fontFamily:`monospace`,background:`#fff`,color:`#333`,width:`100%`,minHeight:70,boxSizing:`border-box`,resize:`vertical`},empty:{textAlign:`center`,padding:`30px 16px`,color:`#999`,fontSize:13},tag:{display:`inline-block`,padding:`2px 8px`,borderRadius:4,fontSize:10,fontWeight:600,marginLeft:8},tagPre:{background:`#fef3c7`,color:`#92400e`},tagLatest:{background:`#dcfce7`,color:`#166534`},warnBanner:{padding:`12px 16px`,background:`#fef2f2`,border:`1px solid #fecaca`,borderRadius:10,marginBottom:12,fontSize:13,color:`#991b1b`,lineHeight:1.5},warnBannerTitle:{fontWeight:700,marginBottom:4},infoBanner:{padding:`12px 16px`,background:`#fffbeb`,border:`1px solid #fde68a`,borderRadius:10,marginBottom:12,fontSize:13,color:`#92400e`,lineHeight:1.5},bannerCode:{display:`block`,marginTop:8,padding:`8px 10px`,background:`#fff`,border:`1px solid #fecaca`,borderRadius:6,fontFamily:`monospace`,fontSize:12,color:`#7f1d1d`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},statsGrid:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(140px, 1fr))`,gap:10,marginBottom:12},statCard:{padding:`12px 16px`,background:`#f8f9fa`,border:`1px solid #e0e0e0`,borderRadius:10,textAlign:`center`},statValue:{fontSize:22,fontWeight:700,color:`#333`},statLabel:{fontSize:11,color:`#888`,marginTop:2}},o={ok:`#10b981`,warn:`#f59e0b`,error:`#ef4444`};function s(e,t){if(!e)return{versions:null,versionsError:`⚠ Could not reach GitHub — showing last known versions, retry`};let n=t&&typeof t==`object`?t:{},r=Array.isArray(n)?n:Array.isArray(n.versions)?n.versions:[],i=!Array.isArray(n)&&n.sources&&typeof n.sources==`object`?n.sources:{},a=``;return i.prImages===`rate-limited`?a=`⚠ GitHub rate-limited — PR test images temporarily unavailable, retry shortly`:i.releases===`rate-limited`?a=`⚠ GitHub rate-limited — some versions temporarily unavailable, retry shortly`:(i.prImages===`error`||i.releases===`error`)&&(a=`⚠ Could not fetch some versions from GitHub, retry`),{versions:r,versionsError:a}}function c(e,t={}){let{stableCount:n=5,preCount:r=3}=t,i=e.filter(e=>typeof e.pr==`number`),a=e.filter(e=>typeof e.pr!=`number`);return{prVersions:i,stableVersions:a.filter(e=>!e.prerelease).slice(0,n),preVersions:a.filter(e=>e.prerelease).slice(0,r)}}function l(e,t=[`latest`],n={}){let{prVersions:r,stableVersions:i,preVersions:a}=c(e,n);return new Set([...t,...a.map(e=>e.tag),...i.map(e=>e.tag),...r.map(e=>e.tag)])}function u(e,t,n=[`latest`],r={}){return e?l(t,n,r).has(e)?null:e:null}function d(e){return e==null?`—`:e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:String(e)}function f(e,a={}){let{intervalMs:o=5e3}=a,[s,c]=t(null),[l,u]=t(!0),d=r(0),f=r(a.fallback??null),p=i(async t=>{let n=++d.current,r=f.current;try{let n=await(await fetch(e,{signal:t})).json().catch(()=>null);n&&typeof n==`object`&&(r=n)}catch{}n===d.current&&(c(r),u(!1))},[e]);return n(()=>{let e=!1,t=null,n=new AbortController,r=async()=>{await p(n.signal),!e&&o>0&&(t=setTimeout(()=>void r(),o))};return r(),()=>{e=!0,n.abort(),t&&clearTimeout(t)}},[p,o]),{status:s,loading:l,refresh:()=>p()}}function p(e){let[a,o]=t([]),[c,l]=t(``),[u,d]=t(!1),f=r(0),p=i(async()=>{let t=++f.current;d(!0);try{let n=await fetch(e),r=await n.json().catch(()=>null),i=s(n.ok,r);if(t!==f.current)return;i.versions!==null&&o(i.versions),l(i.versionsError)}catch{if(t!==f.current)return;l(`⚠ Offline — showing last known versions`)}d(!1)},[e]);return n(()=>{p()},[p]),{versions:a,versionsError:c,loading:u,refresh:p}}function m({children:t,color:n}){return e.createElement(`span`,{style:{...a.hint,...n?{color:n}:{}}},t)}function h({state:t=`ok`,color:n,title:r,style:i}){return e.createElement(`div`,{style:{...a.stateIndicator,background:n??o[t],...i},title:r})}function g({icon:t,iconBackground:n,iconColor:r,title:i,meta:s,state:c=`ok`,stateTitle:l,link:u,children:d}){let f=c===`error`&&!n;return e.createElement(`div`,{style:a.card},e.createElement(`div`,{style:{...a.cardIcon,background:f?`#fef2f2`:n??`#3b82f6`,color:f?o.error:r??`#fff`}},t),e.createElement(`div`,{style:a.cardInfo},e.createElement(`div`,{style:a.cardTitle},i),s!=null&&e.createElement(`div`,{style:a.cardMeta},s)),d,u&&e.createElement(`a`,{href:u.href,target:`_blank`,rel:`noopener noreferrer`,style:a.link},u.label),e.createElement(h,{state:c,title:l}))}function _({title:n,defaultOpen:r=!1,children:i}){let[o,s]=t(r);return e.createElement(`div`,null,e.createElement(`button`,{type:`button`,"aria-expanded":o,style:{...a.sectionTitle,...a.sectionToggle},onClick:()=>s(!o)},e.createElement(`span`,{style:{...a.sectionMarker,transform:o?`rotate(90deg)`:`rotate(0deg)`}},`▶`),n),o&&e.createElement(`div`,{style:{marginBottom:16}},i))}var v={primary:a.btnPrimary,secondary:a.btnSecondary,warn:a.btnWarn,danger:a.btnDanger};function y({variant:t=`primary`,small:n=!1,busy:r=!1,busyLabel:i,disabled:o=!1,onClick:s,title:c,style:l,children:u}){let d=o||r;return e.createElement(`button`,{type:`button`,style:{...a.btn,...v[t],...n?a.btnSmall:{},...d?a.btnDisabled:{},...l},onClick:s,disabled:d,title:c},r?i??u:u)}function b({message:t,error:n=!1,style:r}){return t?e.createElement(`div`,{style:{...a.status,color:n?o.error:o.ok,marginTop:16,...r}},t):null}var x=[{tag:`latest`,label:`latest (recommended)`}];function S({value:t,onChange:n,versions:r,floatingOptions:i=x,stableCount:s,preCount:l,loading:d=!1,error:f,onRefresh:p,disabled:h=!1,style:g}){let _={stableCount:s,preCount:l},{prVersions:v,stableVersions:b,preVersions:S}=c(r,_),C=u(t,r,i.map(e=>e.tag),_);return e.createElement(e.Fragment,null,e.createElement(`select`,{style:{...a.select,...g},value:t,onChange:e=>n(e.target.value),disabled:h},i.map(t=>e.createElement(`option`,{key:t.tag,value:t.tag},t.label??t.tag)),S.map(t=>e.createElement(`option`,{key:t.tag,value:t.tag},t.tag,` (pre-release)`)),b.map((t,n)=>e.createElement(`option`,{key:t.tag,value:t.tag},t.tag,n===0?` (current stable)`:``)),v.length>0&&e.createElement(`optgroup`,{label:`PR test images`},v.map(t=>e.createElement(`option`,{key:t.tag,value:t.tag},t.tag,t.title?` — ${t.title}`:``))),C&&e.createElement(`option`,{value:C},C,` (running)`)),d&&e.createElement(m,null,`loading releases...`),p&&e.createElement(y,{small:!0,style:{padding:`4px 10px`,fontSize:11},onClick:p,title:`Refresh available versions`},`↻`),f&&e.createElement(m,{color:o.error},f))}var C={...a,warnBannerCode:{display:`block`,marginTop:8,padding:`8px 10px`,background:`#fff`,border:`1px solid #fecaca`,borderRadius:6,fontFamily:`monospace`,fontSize:12,color:`#7f1d1d`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},fieldHelp:{fontSize:12,color:`#666`,marginTop:6,lineHeight:1.5},migrationItem:{display:`flex`,alignItems:`center`,gap:12,padding:`12px 16px`,background:`#f8f9fa`,border:`1px solid #e0e0e0`,borderRadius:10,marginBottom:8},migrationActions:{display:`flex`,gap:8,alignItems:`center`}},ee=8388608,te=3e5,w=3e5,T=1,E={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`};function ne(e){return e.replace(/&(?:#(\d+)|#x([0-9a-fA-F]+)|(amp|lt|gt|quot|apos));/g,(e,t,n,r)=>{if(r!==void 0)return E[r];let i=t===void 0?Number.parseInt(n,16):Number(t);return i<=1114111?String.fromCodePoint(i):e})}function re(e){return/^AIS\b/.test(e)||/^\d{9}$/.test(e)}var D=/[^\s/>]+/y,ie=[`trkpt`,`time`,`trkseg`,`trk`,`name`,`gpx`];function ae(e,t){for(let n of ie)if(e.startsWith(n,t)){let r=e.charCodeAt(t+n.length);if(r<=32||r===47||r===62)return n}D.lastIndex=t;let n=D.exec(e)?.[0]??``,r=n.indexOf(`:`);return r>=0?n.slice(r+1):n}function oe(e,t,n,r){let i=e.indexOf(t,n);for(;i>=0&&i<r;){let n=e.charCodeAt(i-1),a=i+t.length;for(;e.charCodeAt(a)===32;)a++;if((n===32||n===9||n===10||n===13)&&e.charCodeAt(a)===61){let t=a+1;for(;e.charCodeAt(t)===32;)t++;let n=e[t];if(n!==`"`&&n!==`'`)return NaN;let i=e.indexOf(n,t+1);return i>0&&i<r?Number(e.slice(t+1,i)):NaN}i=e.indexOf(t,i+1)}return NaN}async function se(e,t=()=>{},n,r=ee){let i=new Map,a=new TextDecoder(`utf-8`),o=[],s=``,c=``,l=!1,u=[],d=(e,t)=>{if(C!==2){c+=e;return}let n=u[u.length-1];n&&n.cdata===t?n.value+=e:u.push({value:e,cdata:t})},f=null,p=null,m=null,h=0,g=0,_=``,v=-1/0,y=``,b=NaN,x=e=>{p=e;let t=i.get(e);t||(t={name:e,tracks:0,points:0,from:null,to:null,samples:[]},i.set(e,t)),t.tracks++,f=t,v=-1/0},S=()=>{let e=f,t=m;if(m=null,!e||t===null)return;e.points++;let n=_.trim(),r=n.slice(0,16);r!==y&&(y=r,b=Date.parse(n));let i=b;if(Number.isFinite(i)&&((e.from===null||i<e.from)&&(e.from=i),(e.to===null||i>e.to)&&(e.to=i),i-v>=te)){let r=oe(t,`lat`,h,g),a=oe(t,`lon`,h,g);Number.isFinite(r)&&Number.isFinite(a)&&(e.samples.push(Date.parse(n),r,a),v=i)}},C=0,w=()=>{let e=o.length;return e<2||o[0]!==`gpx`||o[1]!==`trk`?0:e===2?1:e===3?o[2]===`name`?2:o[2]===`trkseg`?3:0:o[2]!==`trkseg`||o[3]!==`trkpt`?0:e===4?4:e===5&&o[4]===`time`?5:0},T=(e,t)=>{let n=s+e,r=0;for(;;){let e=n.indexOf(`<`,r);if(e<0){l&&d(n.slice(r),!1),s=``;return}l&&d(n.slice(r,e),!1);let i=null,a=n.charCodeAt(e+1);(a===33||a===63)&&(n.startsWith(`<!--`,e)?i=`-->`:n.startsWith(`<![CDATA[`,e)?i=`]]>`:a===63&&(i=`?>`));let v=i?n.indexOf(i,e):n.indexOf(`>`,e);if(v<0){s=t?``:n.slice(e);return}let y=v+(i?i.length:1);i===`]]>`&&l&&d(n.slice(e+9,v),!0),r=y,!i&&(a===47?(C===2&&p===null?x(u.map(e=>e.cdata?e.value:ne(e.value)).join(``).trim()):C===5?_=c:C===4?S():C===1&&(f=null),o.pop()):a!==33&&(o.push(ae(n,e+1)),C=w(),C===1?(p=null,f=null):C===3&&p===null?x(``):C===4&&(m=n,h=e,g=v,_=``),n.charCodeAt(v-1)===47&&(C===4&&S(),o.pop())),C=w(),c=``,u=[],l=C===2||C===5)}};for(let i=0;i<e.size;i+=r){if(n?.aborted)throw new DOMException(`Scan aborted`,`AbortError`);let o=new Uint8Array(await e.slice(i,i+r).arrayBuffer());T(a.decode(o,{stream:!0}),!1),t(Math.min(e.size,i+r))}return T(a.decode(),!0),de([...i.values()])}function O(e,t,n,r){let i=Math.PI/180,a=Math.sin((n-e)*i/2)**2+Math.cos(e*i)*Math.cos(n*i)*Math.sin((r-t)*i/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(a)))}function ce(e){let t=[];for(let n=0;n<e.length;n+=3)t.push([e[n],e[n+1],e[n+2]]);return t.sort((e,t)=>e[0]-t[0])}function le(e,t,n){let r=e[t],i=e[t+1];if(r&&i&&r[0]<=n&&n<=i[0]&&i[0]-r[0]<=2*w){let e=i[0]===r[0]?0:(n-r[0])/(i[0]-r[0]),t=i[2]-r[2];return t>180?t-=360:t<-180&&(t+=360),[r[1]+e*(i[1]-r[1]),r[2]+e*t]}let a=[r,i].filter(e=>e!==void 0&&Math.abs(e[0]-n)<=w).sort((e,t)=>Math.abs(e[0]-n)-Math.abs(t[0]-n))[0];return a?[a[1],a[2]]:null}function ue(e,t){let n=[],r=0;for(let[i,a,o]of e){for(;r<t.length-1&&t[r+1][0]<=i;)r++;let e=le(t,r,i);e&&n.push({km:O(a,o,e[0],e[1]),at:i})}return n.length===0?null:{km:[...n].sort((e,t)=>e.km-t.km)[Math.floor(n.length/2)].km,at:n[0].at}}function de(e){let t=[...e].sort((e,t)=>t.points-e.points),n=new Map(e.map(e=>[e,ce(e.samples)])),r=t.find(e=>!re(e.name)&&e.name!==``);return t.map(e=>{let i=re(e.name),a=null;if(!i)for(let r of t){if(r===e)break;if(re(r.name))continue;let t=ue(n.get(e),n.get(r));if(t&&t.km>T){a={name:r.name,...t};break}}let o=!i&&a===null&&(e===r||e.tracks>=2&&e.name!==``);return{name:e.name,tracks:e.tracks,points:e.points,from:e.from,to:e.to,otherVessel:i,conflict:a,selected:o}})}var k=`/plugins/signalk-questdb/api/gpx-import`,fe=5,pe=2e3,A=class extends Error{status;constructor(e,t){super(e),this.status=t}};async function j(e){try{return await e.json()}catch{return{error:`${e.status} ${e.statusText}`}}}async function me(e){let t=e.fetch??fetch,n=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),{file:r,signal:i}=e,a=e.sliceBytes??4194304,o=await t(k,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({filename:e.filename,size:r.size,tracks:e.tracks,fillGapsOnly:e.fillGapsOnly})}),s=await j(o);if(!o.ok||!s.import)throw new A(s.error??`The import could not start`,s.import??null);let c=s.import;e.onStatus(c);let l=`${k}/${encodeURIComponent(c.id)}`,u=async()=>{throw await t(l,{method:`DELETE`}).catch(()=>void 0),new DOMException(`The import was aborted`,`AbortError`)},d=0;for(;c.received<r.size;){i.aborted&&await u();let o=c.received,s;try{let e=await r.slice(o,o+a).arrayBuffer();s=await t(`${l}?offset=${o}`,{method:`PUT`,headers:{"content-type":`application/octet-stream`},body:e})}catch(e){if(i.aborted&&await u(),++d>fe)throw e;await n(pe);let r=await t(k).then(j,()=>null);r?.import?.id===c.id&&(c=r.import);continue}let f=await j(s);if(s.status===409&&f.import?.state===`receiving`){if(f.import.received===o){if(++d>fe)throw new A(f.error??`The slice at byte ${o} was refused`,f.import);await n(pe)}c=f.import}else{if(!s.ok||!f.import)throw new A(f.error??`The slice at byte ${o} was refused`,f.import??null);d=0,c=f.import,e.onStatus(c)}}i.aborted&&await u();let f;try{f=await t(`${l}/finish`,{method:`POST`,signal:i})}catch(e){throw i.aborted&&await u(),e}let p=await j(f);if(i.aborted&&await u(),!f.ok||!p.import||p.import.state!==`finished`)throw new A(p.error??`The import could not finish`,p.import??null);return e.onStatus(p.import),p.import}var M=e=>e===null?`?`:new Date(e).toISOString().slice(0,10),he=(e,t)=>t>0?Math.min(100,Math.floor(e/t*100)):0,ge={receiving:`Importing`,finishing:`Finishing`,finished:`Import complete`,failed:`Import failed`,aborted:`Import aborted`};function _e({value:t}){return e.createElement(`div`,{role:`progressbar`,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,style:{height:8,background:`#e5e7eb`,borderRadius:4,overflow:`hidden`,margin:`8px 0`}},e.createElement(`div`,{style:{width:`${t}%`,height:`100%`,background:`#2563eb`}}))}function ve({status:t}){let n=t.summary;return e.createElement(`div`,{style:{...C.empty,padding:`12px`,textAlign:`left`}},e.createElement(`div`,null,e.createElement(`strong`,null,ge[t.state]),t.filename?` — ${t.filename}`:``),t.state===`receiving`&&e.createElement(_e,{value:he(t.received,t.size)}),e.createElement(`div`,{style:C.cardMeta},(t.received/1e6).toFixed(0),` of `,(t.size/1e6).toFixed(0),` `,`MB read · `,d(n.imported),` rows written ·`,` `,d(n.alreadyRecorded),` points already recorded ·`,` `,d(n.invalid),` invalid`),n.from&&n.to&&e.createElement(`div`,{style:C.cardMeta},`From `,n.from.slice(0,10),` to `,n.to.slice(0,10)),t.error&&e.createElement(`div`,{style:{...C.cardMeta,color:`#b91c1c`}},t.error))}function ye({archiveResolutionSeconds:i}){let[a,o]=t(null),[s,c]=t(0),[l,u]=t(null),[f,p]=t(new Set),[m,h]=t(!0),[g,_]=t(null),[v,b]=t(null),[x,S]=t(null),[ee,te]=t(!1),w=r(null),T=r(null),E=r(0);n(()=>{let e=!1,t=E.current;return fetch(k).then(e=>e.json()).then(n=>{!e&&t===E.current&&n.import&&_(n.import)}).catch(()=>void 0),()=>{e=!0,T.current?.abort()}},[]);let ne=v!==`importing`&&(g?.state===`receiving`||g?.state===`finishing`);n(()=>{if(!ne)return;let e=setInterval(()=>{let e=E.current;fetch(k).then(e=>e.json()).then(t=>{e===E.current&&t.import&&_(t.import)}).catch(()=>void 0)},2e3);return()=>clearInterval(e)},[ne]);let re=async e=>{T.current?.abort();let t=new AbortController;T.current=t,o(e),u(null),S(null),c(0),b(`scanning`);try{let n=await se(e,c,t.signal);u(n),p(new Set(n.filter(e=>e.selected).map(e=>e.name)))}catch(e){t.signal.aborted||S(e instanceof Error?e.message:String(e))}finally{T.current===t&&(T.current=null),b(null)}},D=async()=>{if(!a)return;let e=++E.current,t=new AbortController;w.current=t,S(null),b(`importing`);try{await me({file:a,filename:a.name,tracks:[...f],fillGapsOnly:m,onStatus:_,signal:t.signal})}catch(e){e instanceof A&&e.status&&_(e.status),t.signal.aborted||S(e instanceof Error?e.message:String(e))}finally{w.current===t&&(w.current=null),b(null)}let n=await fetch(k).then(e=>e.json()).catch(()=>null);e===E.current&&n?.import&&_(n.import)},ie=async()=>{if(E.current++,w.current?.abort(),g){let e=await(await fetch(`${k}/${encodeURIComponent(g.id)}`,{method:`DELETE`}).catch(()=>null))?.json().catch(()=>null);e?.import&&_(e.import)}},ae=e=>p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),oe=g?.state===`receiving`||g?.state===`finishing`,O=l?.filter(e=>e.otherVessel)??[];return e.createElement(`div`,null,e.createElement(`div`,{style:{fontSize:13,color:`#555`,marginBottom:10}},`Import a track exported from a chartplotter (GPX) into the archive, where retention never drops it. Points are thinned to one per`,` `,i>0?`${i} s`:`recorded point`,` `,`(Archive resolution). The file is read here first, so you choose which tracks are your own before anything is uploaded.`),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`GPX file`),e.createElement(`input`,{type:`file`,accept:`.gpx,application/gpx+xml`,"aria-label":`GPX file`,disabled:v!==null,onChange:e=>{let t=e.target.files?.[0];t&&re(t)}})),v===`scanning`&&a&&e.createElement(`div`,{style:C.cardMeta},`Reading `,a.name,`…`,e.createElement(_e,{value:he(s,a.size)})),l&&e.createElement(e.Fragment,null,e.createElement(`div`,{style:{...C.label,width:`auto`,margin:`10px 0 6px`}},`Tracks in the file, by name`),e.createElement(`table`,{style:{width:`100%`,fontSize:13,borderSpacing:0}},e.createElement(`thead`,null,e.createElement(`tr`,{style:{textAlign:`left`,color:`#666`}},e.createElement(`th`,null),e.createElement(`th`,null,`Name`),e.createElement(`th`,null,`Tracks`),e.createElement(`th`,null,`Points`),e.createElement(`th`,null,`Period`),e.createElement(`th`,null))),e.createElement(`tbody`,null,l.filter(e=>!e.otherVessel||ee).map(t=>e.createElement(`tr`,{key:t.name},e.createElement(`td`,null,e.createElement(`input`,{type:`checkbox`,style:C.checkbox,"aria-label":`Import ${t.name||`(no name)`}`,checked:f.has(t.name),disabled:v!==null,onChange:()=>ae(t.name)})),e.createElement(`td`,null,t.name||e.createElement(`em`,null,`(no name)`)),e.createElement(`td`,null,d(t.tracks)),e.createElement(`td`,null,d(t.points)),e.createElement(`td`,null,M(t.from),` – `,M(t.to)),e.createElement(`td`,{style:{color:`#92400e`}},t.otherVessel?`AIS target`:t.conflict?`${Math.round(t.conflict.km).toLocaleString()} km from “${t.conflict.name}” on ${M(t.conflict.at)}: another vessel?`:``))),O.length>0&&e.createElement(`tr`,null,e.createElement(`td`,null),e.createElement(`td`,{colSpan:5},e.createElement(`button`,{type:`button`,style:{...C.link,background:`none`,border:0,padding:0},onClick:()=>te(e=>!e)},ee?`Hide`:`Show`,` `,O.length,` AIS target`,O.length===1?``:`s`,` (`,d(O.reduce((e,t)=>e+t.points,0)),` `,`points)`))))),e.createElement(`div`,{style:{...C.fieldRow,marginTop:10}},e.createElement(`span`,{style:C.label},`Skip recorded times`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,"aria-label":`Skip times already recorded`,checked:m,disabled:v!==null,onChange:e=>h(e.target.checked)}),e.createElement(`span`,{style:C.hint},`leave out points where QuestDB already has positions of the vessel within the same five minutes`)),e.createElement(`div`,{style:{display:`flex`,gap:8}},e.createElement(y,{variant:`primary`,busy:v===`importing`,busyLabel:`Importing…`,disabled:f.size===0||v!==null||oe,onClick:()=>void D()},`Import ${f.size} track name${f.size===1?``:`s`}`))),x&&e.createElement(`div`,{style:{...C.cardMeta,color:`#b91c1c`,marginTop:8}},x),g&&e.createElement(`div`,{style:{marginTop:10}},e.createElement(ve,{status:g}),oe&&e.createElement(y,{variant:`warn`,small:!0,onClick:()=>void ie()},`Abort`)))}var N=e=>typeof e==`object`&&!!e;function be(e){let t=N(e)?e.sources:void 0;return Array.isArray(t)?t.filter(e=>N(e)&&typeof e.type==`string`&&typeof e.url==`string`&&typeof e.status==`string`&&(e.version===void 0||typeof e.version==`string`)):[]}function xe(e){let t=N(e)?e.buckets:void 0;return Array.isArray(t)?t.filter(e=>N(e)&&typeof e.name==`string`&&(e.id===void 0||typeof e.id==`string`)&&(e.retentionSeconds===void 0||typeof e.retentionSeconds==`number`)):[]}function Se(e){let t=N(e)?e.measurements:void 0;return Array.isArray(t)?t.filter(e=>N(e)&&typeof e.name==`string`&&Array.isArray(e.fields)):[]}function P(e){let t=N(e)?e.run:void 0;if(!N(t)||typeof t.id!=`string`||typeof t.state!=`string`)return;let n=t.state;if(n!==`running`&&n!==`done`&&n!==`failed`&&n!==`cancelled`)return;let r=N(t.progress)?t.progress:{},i=e=>typeof e==`number`&&Number.isFinite(e)?e:0,a=e=>typeof e==`string`?e:void 0;return{id:t.id,state:n,url:a(t.url)??``,bucket:a(t.bucket)??``,startedAt:a(t.startedAt)??``,finishedAt:a(t.finishedAt),error:a(t.error),resumedFrom:N(t.resumedFrom)?{measurement:a(t.resumedFrom.measurement),windowStart:a(t.resumedFrom.windowStart)}:void 0,progress:{read:i(r.read),written:i(r.written),skipped:i(r.skipped),measurementsDone:i(r.measurementsDone),measurementsTotal:i(r.measurementsTotal),currentMeasurement:a(r.currentMeasurement),currentWindowStart:a(r.currentWindowStart)}}}function Ce(e){let t=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0;return{rows:t(N(e)?e.rows:void 0),dropped:t(N(e)?e.dropped:void 0)}}function we(e){let t=N(e)&&Array.isArray(e.contexts)?e.contexts.filter(e=>typeof e==`string`&&!!e):[],n=N(e)&&typeof e.self==`string`&&t.includes(e.self)?e.self:void 0;return{contexts:t,self:n,selfBy:n!==void 0&&N(e)&&(e.selfBy===`tag`||e.selfBy===`identity`)?e.selfBy:void 0}}function F(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Te(e){let t=N(e)?e.interrupted:void 0;if(N(t)&&typeof t.url==`string`&&typeof t.type==`string`&&typeof t.bucket==`string`&&typeof t.from==`string`&&typeof t.to==`string`&&typeof t.updatedAt==`string`)return{url:t.url,type:t.type,bucket:t.bucket,from:t.from,to:t.to,updatedAt:t.updatedAt,measurementsDone:typeof t.measurementsDone==`number`&&Number.isFinite(t.measurementsDone)?t.measurementsDone:0,measurement:typeof t.measurement==`string`?t.measurement:void 0,windowStart:typeof t.windowStart==`string`?t.windowStart:void 0}}function Ee(e,t){let n=new Date(e),r=new Date(t);return Number.isNaN(n.getTime())||Number.isNaN(r.getTime())?{error:`Enter a valid From and To date for the import.`}:r<=n?{error:`The To date must be after the From date.`}:{from:n.toISOString(),to:r.toISOString()}}function I(e){return e instanceof Error?e.message:String(e)}function L(e,t){return e??t}var De=[`none`,`lz4`,`zstd`],Oe={padding:`4px 12px`,fontSize:12};function ke(e){return De.includes(e)?e:`lz4`}function Ae({configuration:a,save:o}){let s=a||{},[c,l]=t(s.questdbHost||`127.0.0.1`),[u,m]=t(s.questdbIlpPort||9009),[h,v]=t(s.questdbHttpPort||9e3),[x,ee]=t(s.questdbPgPort||8812),[te,w]=t(s.questdbVersion||`latest`),[T,E]=t(s.managedContainer!==!1),[ne,re]=t(s.recordSelf!==!1),[D,ie]=t(s.recordOthers!==!1),[ae,oe]=t(s.restoreOnStart===!0),[se,O]=t(s.enableConsole!==!1),[ce,le]=t(s.historySourcePolicyAll===!0),[ue,de]=t((s.restoreMaxAgeMinutes??0)>0?s.restoreMaxAgeMinutes:9),[k,fe]=t(s.defaultSamplingRate??2e3),[pe,A]=t(String(s.ilpFlushIntervalMs??5e3)),[j,me]=t(String(s.unchangedHeartbeatSeconds??300)),[M,he]=t(s.retentionDays||0),[ge,_e]=t(s.archiveOwnTrack!==!1),[ve,N]=t((Array.isArray(s.archivePaths)?s.archivePaths:[]).join(`
|
|
2
|
+
`)),[De,Ae]=t(String(s.archiveResolutionSeconds??10)),[je,Me]=t(s.pathFilter?.mode===`include`?`include`:`exclude`),[Ne,Pe]=t((Array.isArray(s.pathFilter?.paths)?s.pathFilter.paths:[]).join(`
|
|
3
|
+
`)),[Fe,Ie]=t(s.compression||`lz4`),[Le,Re]=t(s.compressionLevel||3),[ze,Be]=t(s.networkName||`sk-network`),[Ve,He]=t(s.exposeToContainers||!1),{versions:Ue,versionsError:We,loading:Ge,refresh:Ke}=p(`/plugins/signalk-questdb/api/versions`),{status:R,loading:qe,refresh:Je}=f(`/plugins/signalk-questdb/api/status`,{fallback:{status:`not_running`},intervalMs:5e3}),[Ye,Xe]=t(null),[Ze,Qe]=t(!1),[z,$e]=t(``),[B,et]=t(null),[tt,nt]=t(``),[rt,it]=t(``),[at,ot]=t(``),[st,ct]=t(``),[lt,ut]=t(null),[V,dt]=t(``),[H,ft]=t(null),[pt,mt]=t(!1),[ht,gt]=t(!1),[U,_t]=t(null),[vt,yt]=t(``),[bt,xt]=t(!0),[St,Ct]=t(``),[wt,Tt]=t(``),[W,G]=t(null),[Et,Dt]=t(!1),[Ot,kt]=t(null),[At,jt]=t(!1),[K,q]=t(null),[Mt,J]=t(``),[Nt,Y]=t(!1),[X,Pt]=t(null),[Ft,It]=t(!1),[Lt,Rt]=t(!1),[zt,Bt]=t(!1),[Vt,Ht]=t(!1),[Ut,Z]=t(``),[Wt,Gt]=t(null),[Kt,qt]=t(!1),Jt=r(0),[Yt,Xt]=t(!1),Zt=i(async e=>{let t=++Jt.current;try{let n=await fetch(`/plugins/signalk-questdb/api/wal-diagnosis`,{signal:e});if(t!==Jt.current)return;if(n.ok){let e=await n.json();if(t!==Jt.current)return;Gt(e),qt(!1)}else qt(!0)}catch{t===Jt.current&&qt(!0)}},[]),Qt=!!(R&&R.status===`running`&&(R.suspendedTables||[]).length>0);n(()=>{if(!Qt){Gt(null),qt(!1);return}let e=!1,t=null,n=new AbortController,r=async()=>{await Zt(n.signal),e||(t=setTimeout(r,15e3))};return r(),()=>{e=!0,n.abort(),t&&clearTimeout(t)}},[Qt,Zt]);let $t=async(e,t)=>{let n=t.tailSkip?`
|
|
4
|
+
|
|
5
|
+
WARNING: this is the newest pending segment — skipping it drops the ENTIRE pending backlog.`:``;if(window.confirm(`Skip the unreadable WAL segment on ${e}?\n\nThis permanently loses ${d(t.skippedTxns)} transaction(s) recorded between ${t.skipWindowStart} and ${t.skipWindowEnd}. Everything after the skipped segment is replayed without loss.`+n)){Xt(!0),Z(``);try{let n=await fetch(`/plugins/signalk-questdb/api/resume-wal/skip`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({table:e,confirmPlan:t})}),r=await n.json().catch(()=>({error:n.statusText}));n.ok?Z(r.message??``):Z(`Skip failed: ${L(r.error,`unknown error`)}`),Je(),Zt()}catch(e){Z(`Skip failed: ${I(e)}`)}Xt(!1)}},en=async()=>{It(!0);try{let e=await fetch(`/plugins/signalk-questdb/api/update/check`);e.ok&&Pt(await e.json())}catch{}It(!1)},tn=async()=>{Rt(!0),J(`Pulling new image and restarting...`),Y(!1);try{let e=await fetch(`/plugins/signalk-questdb/api/update/apply`,{method:`POST`});if(e.ok){let t=await e.json();J(t.message??``),Pt(null),t.newVersion&&w(t.newVersion),Je()}else{let t=await e.json().catch(()=>({error:e.statusText}));J(`Update failed: ${L(t.error,`unknown error`)}`),Y(!0)}}catch(e){J(`Update failed: ${I(e)}`),Y(!0)}Rt(!1)},nn=async()=>{if(window.confirm(`Remove the QuestDB container and DELETE ALL recorded data? This cannot be undone.`)){Bt(!0),J(`Removing QuestDB container and data...`),Y(!1);try{let e=await fetch(`/plugins/signalk-questdb/api/purge-data`,{method:`POST`}),t=await e.json().catch(()=>({error:e.statusText}));e.ok?(J(t.message??``),Je()):(J(`Remove failed: ${L(t.error,`unknown error`)}`),Y(!0))}catch(e){J(`Remove failed: ${I(e)}`),Y(!0)}Bt(!1)}},rn=async()=>{Ht(!0),Z(``);try{let e=await fetch(`/plugins/signalk-questdb/api/resume-wal`,{method:`POST`}),t=await e.json().catch(()=>({error:e.statusText}));if(e.ok){let e=(t.results||[]).filter(e=>!e.ok);Z(e.length===0?`${L(t.message,`Resume requested`)}. Recording resumes as the backlog drains — the banner clears once tables catch up.`:`${L(t.message,`Resume requested`)}. `+e.map(e=>`${e.table}: ${e.error}`).join(` · `)),Je(),Zt()}else Z(`Resume failed: ${L(t.error,`unknown error`)}`)}catch(e){Z(`Resume failed: ${I(e)}`)}Ht(!1)},an=async()=>{Qe(!0),J(``);try{let e=z?`?url=${encodeURIComponent(z)}`:``,t=await fetch(`/plugins/signalk-questdb/api/migration/detect${e}`);if(t.ok){let e=be(await t.json().catch(()=>null));Xe(e),e.length===0&&(J(z?`No InfluxDB found at ${z}.`:`No InfluxDB instances detected on localhost:8086.`),Y(!1))}}catch(e){J(`Detection failed: `+I(e)),Y(!0)}Qe(!1)},Q=i(()=>({token:tt||void 0,org:rt||void 0,username:at||void 0,password:st||void 0}),[tt,rt,at,st]),on=i(async(e,t=Q())=>{mt(!0),J(``),dt(``);try{let n=await fetch(`/plugins/signalk-questdb/api/migration/buckets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,type:e.type,...t})}),r=await n.json().catch(()=>null),i=xe(r);ut(i),n.ok?i.length===0?(J(`No buckets found. InfluxDB 2.x needs an API token with read access.`),Y(!0)):i.length===1&&dt(i[0].name):(J(r?.error??`Could not list buckets.`),Y(!0))}catch(e){J(`Could not list buckets: `+I(e)),Y(!0)}mt(!1)},[Q]),sn=r(Q);n(()=>{sn.current=Q},[Q]),n(()=>{if(_t(null),yt(``),gt(!1),!B||!V)return;let e=!1;return gt(!0),(async()=>{try{let t=await fetch(`/plugins/signalk-questdb/api/migration/contexts`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:B.url,type:B.type,bucket:V,...sn.current()})}),n=await t.json().catch(()=>null);if(e)return;if(!t.ok){J(n?.error??`Could not list the vessels.`),Y(!0);return}let r=we(n);_t(r),yt(r.self??(r.contexts.length===1?r.contexts[0]:``))}catch(t){if(e)return;J(`Could not list the vessels: `+I(t)),Y(!0)}finally{e||gt(!1)}})(),()=>{e=!0}},[B,V]);let cn=i(async()=>{if(B&&V){mt(!0);try{let e=await fetch(`/plugins/signalk-questdb/api/migration/measurements`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:B.url,type:B.type,bucket:V,...Q()})}),t=await e.json().catch(()=>null),n=Se(t);ft(n),e.ok||(J(t?.error??`Could not list measurements.`),Y(!0))}catch(e){J(`Could not list measurements: `+I(e)),Y(!0)}mt(!1)}},[B,V,Q]),ln=async()=>{if(!B||!V)return;let e=Ee(St,wt);if(`error`in e)J(e.error),Y(!0);else{Dt(!0),J(``);try{let t=await fetch(`/plugins/signalk-questdb/api/migration/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:B.url,type:B.type,bucket:V,...Q(),from:e.from,to:e.to,sourceSelfContext:vt||void 0,others:bt?`keep`:`skip`})}),n=await t.json().catch(()=>null);t.ok?(G(P(n)??null),q(null)):(J(n?.error??`Could not start migration.`),Y(!0))}catch(e){J(`Could not start migration: `+I(e)),Y(!0)}Dt(!1)}},un=async()=>{Dt(!0),J(``),Y(!1);try{let e=await fetch(`/plugins/signalk-questdb/api/migration/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({resume:!0,...Q()})}),t=await e.json().catch(()=>null);e.ok?(G(P(t)??null),q(null)):(J(t?.error??`Could not resume the import.`),Y(!0))}catch(e){J(`Could not resume the import: `+I(e)),Y(!0)}Dt(!1)},dn=async()=>{if(window.confirm(`Discard the saved position? The import will then start again from the beginning. Rows already imported are kept and are not duplicated.`)){J(``),Y(!1);try{let e=await fetch(`/plugins/signalk-questdb/api/migration/discard`,{method:`POST`});if(e.ok)q(null);else{let t=await e.json().catch(()=>null);J(t?.error??`Could not discard the saved position.`),Y(!0)}}catch(e){J(`Could not discard: `+I(e)),Y(!0)}}},fn=async()=>{try{let e=await(await fetch(`/plugins/signalk-questdb/api/migration/cancel`,{method:`POST`})).json().catch(()=>null);G(P(e)??W)}catch(e){J(`Could not cancel: `+I(e)),Y(!0)}};n(()=>{if(W?.state!==`running`)return;let e=!1,t,n=async()=>{try{let t=await fetch(`/plugins/signalk-questdb/api/migration/status`),n=await t.json().catch(()=>null),r=P(n);if(!e){if(r)G(r),q(Te(n)??null);else if(t.ok){let e=Te(n)??null;G(null),q(e),J(e?`The import stopped because the Signal K server restarted. It can be resumed from its saved position below.`:`The import stopped because the Signal K server restarted before a position was saved. Start it again — already-imported rows are not duplicated.`),Y(!0)}}}catch{}e||(t=setTimeout(n,1e3))};return t=setTimeout(n,1e3),()=>{e=!0,clearTimeout(t)}},[W?.state]),n(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/plugins/signalk-questdb/api/migration/legacy-rows`),{rows:n}=Ce(await t.json().catch(()=>null));!e&&t.ok&&kt(n)}catch{}})(),()=>{e=!0}},[]);let pn=async()=>{if(Ot&&window.confirm(`Remove ${d(Ot)} rows imported under suffixed paths?\n\nThis rebuilds the string table without them, which can take a few minutes on a large database. Recording continues meanwhile. Run the import again afterwards to get these rows under their real paths.`)){jt(!0),J(``),Y(!1);try{let e=await fetch(`/plugins/signalk-questdb/api/migration/legacy-rows/remove`,{method:`POST`}),t=await e.json().catch(()=>null);if(e.ok){let{rows:e,dropped:n}=Ce(t);kt(0),J(`Removed ${d(e)} rows. Run the import again to get them under their real paths.`+(n>0?` ${d(n)} live samples could not be kept while the table was swapped.`:``)),n>0&&Y(!0)}else J(t?.error??`Could not remove the rows.`),Y(!0)}catch(e){J(`Could not remove the rows: `+I(e)),Y(!0)}jt(!1)}};n(()=>{let e=!1;return(async()=>{try{let t=await(await fetch(`/plugins/signalk-questdb/api/migration/status`)).json().catch(()=>null),n=P(t);if(e)return;n&&G(n),q(Te(t)??null)}catch{}})(),()=>{e=!0}},[]);let[mn,hn]=t(``),[gn,_n]=t(``),[vn,yn]=t(`parquet`),[bn,xn]=t(!1),Sn=()=>{let e=Number(pe);if(pe===``||!Number.isFinite(e)||e<500||e>3e5){J(`Write batch interval must be 500–300000 ms.`),Y(!0);return}let t=Number(j);if(j===``||!Number.isFinite(t)||t<0){J(`Unchanged-value heartbeat must be 0 or more seconds (0 = off).`),Y(!0);return}let n=Number(De);De===``||!Number.isInteger(n)||n<0?(J(`Archive resolution must be a whole number of seconds, 0 or more.`),Y(!0)):(o({...s,questdbHost:c,questdbIlpPort:u,questdbHttpPort:h,questdbPgPort:x,questdbVersion:te,managedContainer:T,defaultSamplingRate:k,ilpFlushIntervalMs:e,unchangedHeartbeatSeconds:t,recordSelf:ne,recordOthers:D,restoreOnStart:ae,historySourcePolicyAll:ce,enableConsole:se,restoreMaxAgeMinutes:ue,retentionDays:M,archiveOwnTrack:ge,archivePaths:ve.split(`
|
|
6
|
+
`).map(e=>e.trim()).filter(Boolean),archiveResolutionSeconds:n,compression:Fe,compressionLevel:Le,networkName:ze,exposeToContainers:Ve,pathFilter:{mode:je,paths:Ne.split(`
|
|
7
|
+
`).map(e=>e.trim()).filter(Boolean)},samplingRates:s.samplingRates||{}}),J(`Saved! Plugin will restart with new configuration.`),Y(!1))},Cn=async()=>{if(!mn||!gn)J(`Set both from and to dates for export.`),Y(!0);else{xn(!0),J(`Exporting ${vn.toUpperCase()}...`),Y(!1);try{let e=`/plugins/signalk-questdb/api/export?from=${encodeURIComponent(mn)}&to=${encodeURIComponent(gn)}&format=${vn}`,t=await fetch(e);if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));J(`Export failed: ${L(e.error,`unknown error`)}`),Y(!0),xn(!1);return}let n=await t.blob(),r=vn===`parquet`?`parquet`:`csv`,i=document.createElement(`a`);i.href=URL.createObjectURL(n),i.download=`signalk-export-${mn.slice(0,10)}.${r}`,i.click(),URL.revokeObjectURL(i.href),J(`Exported ${(n.size/1024/1024).toFixed(1)} MB`)}catch(e){J(`Export failed: ${I(e)}`),Y(!0)}xn(!1)}},wn=R&&R.status===`running`,Tn=wn&&R.suspendedTables||[],En=Tn.length>0,Dn=wn&&R.schemaMismatch||!1,$=wn&&R.ulimitClamp||null,On=$!==null&&$.granted<=0,kn=R?.hostMaxMapCount?.tooLow&&R.hostMaxMapCount||null;return e.createElement(`div`,{style:C.root},e.createElement(`div`,{style:C.sectionTitle},`QuestDB Status`),kn&&e.createElement(`div`,{style:C.infoBanner},e.createElement(`div`,{style:C.warnBannerTitle},`Host vm.max_map_count is low — `,d(kn.current),` `,`(QuestDB recommends `,d(kn.recommended),`)`),`QuestDB memory-maps every partition and WAL segment it touches. As the database grows, this kernel limit can run out — mmap then fails with out-of-memory errors even though RAM is free, which shows up as slow or failing history queries, can suspend recording, and can take QuestDB down entirely. Run this in a shell on the host machine — not inside the QuestDB container, which can neither change the kernel-global limit nor has sudo (takes effect immediately, no restart needed):`,e.createElement(`code`,{style:C.warnBannerCode},`echo 'vm.max_map_count=${kn.recommended}' | sudo tee /etc/sysctl.d/99-questdb.conf && sudo sysctl --system`)),qe?e.createElement(`div`,{style:C.empty},`Checking QuestDB...`):wn?e.createElement(e.Fragment,null,En&&e.createElement(`div`,{style:C.warnBanner},e.createElement(`div`,{style:C.warnBannerTitle},`QuestDB WAL suspended — recording stalled`),`Rows are arriving but no longer commit, so the counts below have stopped advancing. This follows an error while QuestDB applied the write-ahead log — see the reason reported per table below. Resuming replays every pending transaction, so no data is lost.`,e.createElement(`code`,{style:C.warnBannerCode},Tn.map(e=>{let t=String(e.errorMessage||e.errorTag||`reason not reported`).replace(/[\r\n]+/g,` `),n=(Wt?.tables||[]).find(t=>t.name===e.name),r=n?.suspendedSince?` — frozen since ${n.suspendedSince}`:``;return`${e.name}: ${d(e.txnLag)} txns behind — ${t}${r}`}).join(`
|
|
8
|
+
`)),(Wt?.tables||[]).filter(e=>e.applyError).map(t=>e.createElement(`div`,{key:t.name,style:{marginTop:8,fontSize:12}},`QuestDB's own log reports the apply failure on`,` `,e.createElement(`code`,null,t.name),` as:`,e.createElement(`code`,{style:C.warnBannerCode},t.applyError))),e.createElement(`div`,{style:{marginTop:10}},e.createElement(y,{variant:`primary`,busy:Vt,busyLabel:`Resuming...`,disabled:Yt,onClick:rn},`Resume recording`)),Tn.filter(e=>e.autoResume===`failed`).map(t=>{let n=(Wt?.tables||[]).find(e=>e.name===t.name);if(n?.partitionOpenFailure)return e.createElement(`div`,{key:t.name,style:{marginTop:12}},e.createElement(`div`,{style:C.warnBannerTitle},t.name,`: table data damaged — automatic repair not possible`),`QuestDB fails while opening this table's stored data, before it reaches any pending transaction. That means the commit record on disk describes rows whose data never made it to storage — the signature of a power loss during a write. Skipping transactions cannot fix this (the failure happens before them) and would discard the `,d(t.txnLag),` pending transactions for nothing, so no repair button is offered. Recovering this table means repairing its commit record by hand; please open an issue with the error above. Recording continues into the other tables, and “Resume recording” will re-suspend this one within milliseconds — it is safe to press, but it cannot repair this damage.`);let r=n?.skipPlan;return r?e.createElement(`div`,{key:t.name,style:{marginTop:12}},e.createElement(`div`,{style:C.warnBannerTitle},t.name,`: automatic resume failed — WAL segment unreadable`),`A lossless resume was attempted and the table re-suspended at the same transaction: the write-ahead-log segment at the stall point cannot be read back (typically corrupted by an unclean shutdown mid-write). Replaying can never get past it. The only repair is to skip the unreadable segment, losing`,` `,e.createElement(`b`,null,d(r.skippedTxns),` transaction(s)`),` `,`recorded between `,e.createElement(`b`,null,r.skipWindowStart),` and`,` `,e.createElement(`b`,null,r.skipWindowEnd),r.tailSkip?` — and this is the newest pending segment, so skipping it drops the ENTIRE pending backlog`:` — everything after the skipped segment (${d(Math.max(0,t.txnLag-r.skippedTxns))} txns) is replayed without loss`,`.`,e.createElement(`div`,{style:{marginTop:8}},e.createElement(y,{variant:`danger`,busy:Yt,busyLabel:`Skipping...`,disabled:Vt||Kt,onClick:()=>$t(t.name,r)},`Skip unreadable segment (loses data)`),Kt&&e.createElement(`div`,{style:{marginTop:6,fontSize:12}},`The diagnosis could not be refreshed — the numbers above may be stale. The skip re-enables once a refresh succeeds.`))):null}),e.createElement(`div`,{style:{marginTop:8,fontSize:12}},`Manual fallback in the QuestDB SQL console (`,e.createElement(`code`,null,`:9000`),`), one statement at a time — avoid running it from several tabs, the console retries a busy statement forever:`,e.createElement(`code`,{style:C.warnBannerCode},Tn.map(e=>{let t=`"${String(e.name).replace(/"/g,`""`)}"`,n=(Wt?.tables||[]).find(t=>t.name===e.name),r=[`ALTER TABLE ${t} RESUME WAL;`];return e.autoResume===`failed`&&n?.skipPlan&&!Kt&&r.push(`-- if the resume re-suspends: skip the unreadable segment (loses ${d(n.skipPlan.skippedTxns)} txns)`,`ALTER TABLE ${t} RESUME WAL FROM TXN ${n.skipPlan.skipToTxn};`),r.join(`
|
|
9
|
+
`)}).join(`
|
|
10
|
+
`)))),Ut&&e.createElement(`div`,{style:C.infoBanner},Ut),Dn&&e.createElement(`div`,{style:C.warnBanner},e.createElement(`div`,{style:C.warnBannerTitle},`QuestDB table schema mismatch — data not readable`),`A QuestDB table was re-created by ILP ingestion with the wrong timestamp column, so rows are being stored but reads filtering on time (history, Grafana, and the counts above) return nothing. The plugin rebuilds the affected table with the correct schema automatically within a minute; if this persists, restart the plugin. (The few rows written into the wrong-schema table are lost — they were unreadable anyway.)`),$&&e.createElement(`div`,{style:C.infoBanner},e.createElement(`div`,{style:C.warnBannerTitle},On?`QuestDB open-files request rejected by the host`:`QuestDB open-files limit capped by the host`),On?e.createElement(e.Fragment,null,`QuestDB requested a `,e.createElement(`code`,null,$.ulimit),` limit of`,` `,d($.requested),`, but the container host rejected it, so QuestDB is running with the runtime's default limits. This is typical for podman machine on macOS, where the limits live inside the VM and cannot be read from here. Raise the limits of the service that runs the container runtime (on macOS: inside the VM, via`,` `,e.createElement(`code`,null,`podman machine ssh`),`), then remove the container once with `,e.createElement(`code`,null,`podman rm -f sk-signalk-questdb`),` and restart Signal K — a restart alone cannot re-grant a rejected ask.`):e.createElement(e.Fragment,null,`QuestDB requested a `,e.createElement(`code`,null,$.ulimit),` limit of`,` `,d($.requested),`, but this host only allows `,d($.granted),`, so it was capped. QuestDB is running on the lower limit. To grant the full value, raise the host limit for the user running the container runtime — under rootless Podman that means a systemd`,` `,e.createElement(`code`,null,`user@.service`),` `,e.createElement(`code`,null,`LimitNOFILE`),` drop-in (editing `,e.createElement(`code`,null,`/etc/security/limits.conf`),` alone is usually not enough) — then restart the Signal K server so the plugin can re-create the QuestDB container with the raised limit (signalk-container 1.25.3+; on older versions remove the container once with`,` `,e.createElement(`code`,null,`podman rm -f sk-signalk-questdb`),` instead).`),` `,`This warning clears itself once the container is running with the full value.`,` `,e.createElement(`a`,{href:On?`https://github.com/dirkwa/signalk-questdb#questdb-container-never-starts-on-macos-podman-machine`:`https://github.com/dirkwa/signalk-container#raising-the-open-files-limit-nofile`,target:`_blank`,rel:`noreferrer`,style:{color:`#92400e`,textDecoration:`underline`}},`Step-by-step instructions`),`.`),e.createElement(g,{icon:`Q`,iconBackground:`#7c3aed`,iconColor:`#fff`,title:`QuestDB`,meta:e.createElement(e.Fragment,null,R?.endpoint||`${c}:${h}`,` `,`· `,En?`WAL suspended`:`Recording`),state:En?`error`:`ok`,stateTitle:En?`WAL suspended`:`Running`}),e.createElement(`div`,{style:C.statsGrid},e.createElement(`div`,{style:C.statCard},e.createElement(`div`,{style:C.statValue},d(R.totalRows)),e.createElement(`div`,{style:C.statLabel},`Total Rows`)),e.createElement(`div`,{style:C.statCard},e.createElement(`div`,{style:C.statValue},d(R.activePathsToday)),e.createElement(`div`,{style:C.statLabel},`Active Paths Today`)),R.restore&&e.createElement(`div`,{style:C.statCard},e.createElement(`div`,{style:C.statValue},R.restore.failed?`—`:d(R.restore.contexts)),e.createElement(`div`,{style:C.statLabel},R.restore.failed?`Restore failed`:`Vessels Restored`))),e.createElement(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:12}},X&&X.updateAvailable?e.createElement(e.Fragment,null,e.createElement(`span`,{style:{fontSize:13}},`v`,X.currentVersion,` →`,` `,e.createElement(`strong`,null,`v`,X.latestVersion),` available`),e.createElement(y,{variant:`primary`,busy:Lt,busyLabel:`Updating...`,onClick:tn,style:Oe},`Update QuestDB`)):X&&!X.updateAvailable?e.createElement(`span`,{style:{fontSize:12,color:`#888`}},`v`,X.currentVersion,` (up to date)`):e.createElement(y,{variant:`secondary`,busy:Ft,busyLabel:`Checking...`,onClick:en,style:Oe},`Check for updates`))):e.createElement(g,{icon:`Q`,title:`QuestDB`,meta:e.createElement(e.Fragment,null,R?.status===`unhealthy`?`Not responding`:`Not running`,T?` — enable plugin to start container`:``),state:`error`}),e.createElement(`div`,{style:C.sectionTitle},`Image Version`),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`QuestDB version`),e.createElement(S,{value:te,onChange:w,versions:Ue,loading:Ge,onRefresh:()=>void Ke(),error:We,stableCount:3,preCount:2})),e.createElement(`div`,{style:C.sectionTitle},`Connection`),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Managed container`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,checked:T,onChange:e=>E(e.target.checked)}),e.createElement(`span`,{style:C.hint},T?`signalk-container manages QuestDB`:`Connect to external QuestDB`)),!T&&e.createElement(e.Fragment,null,e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`QuestDB host`),e.createElement(`input`,{style:C.input,value:c,onChange:e=>l(e.target.value)})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`HTTP port (queries)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:h,onChange:e=>v(Number(e.target.value))})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`ILP port (writes)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:u,onChange:e=>m(Number(e.target.value))}))),T&&e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Bind to 0.0.0.0`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,checked:Ve,onChange:e=>He(e.target.checked)}),e.createElement(`span`,{style:{...C.hint,color:Ve?`#ef4444`:void 0}},Ve?`Caution! This exposes your data to the network`:`Signal K reaches QuestDB automatically — only enable to reach it from another machine or a separate-Docker Grafana`)),T&&Ve&&e.createElement(e.Fragment,null,e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`HTTP port (queries)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:h,onChange:e=>v(Number(e.target.value))})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`ILP port (writes)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:u,onChange:e=>m(Number(e.target.value))})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`PostgreSQL wire port`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:x,onChange:e=>ee(Number(e.target.value))}),e.createElement(`span`,{style:C.hint},`for Grafana`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Container network`),e.createElement(`input`,{style:C.input,value:ze,onChange:e=>Be(e.target.value)}),e.createElement(`span`,{style:C.hint},`shared with signalk-grafana`))),e.createElement(`div`,{style:C.sectionTitle},`Recording`),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Default sampling rate (ms)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:k,onChange:e=>fe(Number(e.target.value))}),e.createElement(`span`,{style:C.hint},`1000 = max 1 write/sec per path (0 = every update)`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Unchanged-value heartbeat (s)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,min:0,"aria-label":`Unchanged-value heartbeat in seconds`,value:j,onChange:e=>me(e.target.value)}),e.createElement(`span`,{style:C.hint},`a value that has not changed is written once per this many seconds; changes are written at the sampling rate (default 300, 0 = every sample)`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Write batch interval (ms)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,min:500,max:3e5,"aria-label":`Write batch interval in milliseconds`,value:pe,onChange:e=>A(e.target.value)}),e.createElement(`span`,{style:C.hint},`one QuestDB transaction per table per interval; longer = bigger batches, but up to this many ms lost on a hard crash (default 5000)`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Record own vessel`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,checked:ne,onChange:e=>re(e.target.checked)})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Record AIS targets`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,checked:D,onChange:e=>ie(e.target.checked)})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Restore vessels on startup`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,"aria-label":`Restore vessels on startup`,checked:ae,onChange:e=>oe(e.target.checked)}),e.createElement(`span`,{style:C.hint},`replay each vessel's last recorded position after a restart, so AIS targets appear at once instead of only when they next transmit`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Allow sourcePolicy=all`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,"aria-label":`Allow sourcePolicy=all in the History API`,checked:ce,onChange:e=>le(e.target.checked)}),e.createElement(`span`,{style:C.hint},`let History API callers split a path into one column per recording source. Off by default: a path recorded by four receivers becomes four queries and four columns, which is markedly more work on a Pi-class host. Requests that name a source explicitly are unaffected`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`QuestDB console webapp`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,"aria-label":`QuestDB console webapp`,checked:se,onChange:e=>O(e.target.checked)}),e.createElement(`span`,{style:C.hint},`serve QuestDB's own console inside the Signal K admin UI (admin only). It is a full SQL client — unlike the read-only query endpoint it can modify and delete recorded data`)),ae&&e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Restore max age (minutes)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,min:1,"aria-label":`Restore max age (minutes)`,value:ue,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>=1&&de(t)}}),e.createElement(`span`,{style:C.hint},`only replay values this recent (default 9, matching Freeboard's AIS expiry); higher puts staler positions on the chart`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Retention (days)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,value:M,onChange:e=>he(Number(e.target.value))}),e.createElement(`span`,{style:C.hint},`0 = keep forever`)),M>0&&e.createElement(e.Fragment,null,e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Keep own track`),e.createElement(`input`,{type:`checkbox`,style:C.checkbox,"aria-label":`Keep own track beyond retention`,checked:ge,onChange:e=>_e(e.target.checked)}),e.createElement(`span`,{style:C.hint},`copy the own vessel's positions into an archive retention never drops, so the own track stays available however old`)),e.createElement(`div`,{style:{marginBottom:10}},e.createElement(`div`,{style:{...C.label,width:`auto`,marginBottom:6}},`Archived own-vessel paths (one per line, glob supported)`),e.createElement(`textarea`,{style:C.textarea,"aria-label":`Own-vessel paths to keep beyond retention`,value:ve,onChange:e=>N(e.target.value)}),e.createElement(`div`,{style:C.fieldHelp},`Numeric paths only, e.g. environment.depth.* for the depth along the track. Other vessels are never archived.`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Archive resolution (s)`),e.createElement(`input`,{style:C.inputSmall,type:`number`,min:0,step:1,"aria-label":`Archive resolution (seconds)`,value:De,onChange:e=>Ae(e.target.value)}),e.createElement(`span`,{style:C.hint},`one row per path per interval (default 10); 0 keeps every recorded row`))),e.createElement(_,{title:`Path filtering`,defaultOpen:Ne.trim()!==``},e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Filter mode`),e.createElement(`select`,{style:C.select,value:je,onChange:e=>Me(e.target.value===`include`?`include`:`exclude`)},e.createElement(`option`,{value:`exclude`},`Exclude matching paths`),e.createElement(`option`,{value:`include`},`Include only matching paths`))),e.createElement(`div`,{style:{marginBottom:10}},e.createElement(`div`,{style:{...C.label,width:`auto`,marginBottom:6}},`Path patterns (one per line, glob supported) — optional`),e.createElement(`textarea`,{style:C.textarea,value:Ne,onChange:e=>Pe(e.target.value),placeholder:`notifications.*
|
|
11
|
+
environment.wind.*`}),e.createElement(`div`,{style:C.fieldHelp},`Empty = record everything (the default). Nothing is filtered out unless you list a pattern here.`),e.createElement(`div`,{style:{...C.hint,marginLeft:0}},je===`exclude`?`These paths are NOT recorded; everything else is.`:`ONLY these paths are recorded; everything else is dropped.`))),e.createElement(_,{title:`Compression (on-disk)`},e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Compression codec`),e.createElement(`select`,{style:C.select,value:Fe,onChange:e=>Ie(ke(e.target.value))},e.createElement(`option`,{value:`none`},`None`),e.createElement(`option`,{value:`lz4`},`LZ4 (fast)`),e.createElement(`option`,{value:`zstd`},`ZSTD (smaller)`)),e.createElement(`span`,{style:C.hint},`applies to new data after save`)),Fe===`zstd`&&e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`ZSTD level`),e.createElement(`input`,{style:C.inputSmall,type:`number`,min:`1`,max:`22`,value:Le,onChange:e=>Re(Number(e.target.value))}),e.createElement(`span`,{style:C.hint},`1 (fast) to 22 (smallest)`))),e.createElement(_,{title:`GPX track import`},e.createElement(ye,{archiveResolutionSeconds:s.archiveResolutionSeconds??10})),e.createElement(_,{title:`InfluxDB Migration`},Ot!==null&&Ot>0&&e.createElement(`div`,{style:{...C.empty,padding:`12px`,textAlign:`left`,marginBottom:12}},e.createElement(`div`,null,e.createElement(`strong`,null,d(Ot),` rows from an earlier import`),` `,`sit under paths nothing reads`),e.createElement(`div`,{style:C.fieldHelp},`Imports made before 2.1.5 from a signalk-to-influxdb 1.x database filed strings, booleans and positions under paths ending in`,` `,e.createElement(`code`,null,`.stringValue`),`, `,e.createElement(`code`,null,`.boolValue`),` or`,` `,e.createElement(`code`,null,`.jsonValue`),`. Removing them rebuilds the string table without them; run the import again afterwards and they land under their real paths.`),e.createElement(`div`,{style:{...C.migrationActions,marginTop:10}},e.createElement(y,{variant:`danger`,busy:At,busyLabel:`Removing...`,disabled:W?.state===`running`,onClick:pn},`Remove these rows`))),K&&W?.state!==`running`&&e.createElement(`div`,{style:{...C.empty,padding:`12px`,textAlign:`left`,marginBottom:12}},e.createElement(`div`,null,e.createElement(`strong`,null,`An import was interrupted`),` — ${K.bucket} from ${K.url}`),e.createElement(`div`,{style:C.cardMeta},F(K.from),` to`,` `,F(K.to),`.`,` `,K.measurementsDone,` measurements finished`,K.measurement?`, stopped in ${K.measurement}`+(K.windowStart?` at ${F(K.windowStart)}`:``):``,`. Position saved `,F(K.updatedAt),`.`),e.createElement(`div`,{style:C.fieldHelp},`Resuming continues from the saved position; rows already imported are not duplicated. If InfluxDB needs credentials, select the instance and enter them first — they are never stored.`),e.createElement(`div`,{style:{...C.migrationActions,marginTop:10}},e.createElement(y,{variant:`primary`,busy:Et,busyLabel:`Resuming...`,onClick:un},`Resume import`),e.createElement(y,{variant:`danger`,onClick:dn},`Discard saved position`))),e.createElement(`div`,{style:{display:`flex`,gap:10,alignItems:`center`,marginBottom:10}},e.createElement(y,{variant:`primary`,busy:Ze,busyLabel:`Detecting...`,onClick:an},`Detect InfluxDB`),e.createElement(`span`,{style:C.hint},`Checks localhost:8086 for InfluxDB 1.x and 2.x`)),Ye&&Ye.length>0&&e.createElement(`div`,null,Ye.map((t,n)=>{let r=B?.url===t.url&&B?.type===t.type,i=()=>{et(t),ut(null),dt(``),ft(null),nt(``),it(``),ot(``),ct(``),t.type!==`influxdb2`&&on(t,{token:void 0,org:void 0,username:void 0,password:void 0})};return e.createElement(`div`,{key:n,role:`button`,tabIndex:0,"aria-pressed":r,style:{...C.migrationItem,cursor:`pointer`,outline:r?`2px solid #22adf6`:void 0},onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())}},e.createElement(`div`,{style:{...C.cardIcon,width:36,height:36,fontSize:16,background:t.type===`influxdb2`?`#020a47`:`#22adf6`,color:`#fff`}},t.type===`influxdb2`?`2`:`1`),e.createElement(`div`,{style:C.cardInfo},e.createElement(`div`,{style:C.cardTitle},`InfluxDB `,t.type===`influxdb2`?`2.x`:`1.x`,e.createElement(`span`,{style:{...C.tag,...C.tagLatest}},t.status)),e.createElement(`div`,{style:C.cardMeta},t.url,` · v`,t.version)),e.createElement(`div`,{style:C.cardMeta},r?`selected`:`click to select`))})),e.createElement(`div`,{style:{...C.fieldRow,marginTop:10}},e.createElement(`span`,{style:C.label},`Manual InfluxDB URL`),e.createElement(`input`,{style:C.input,placeholder:`http://192.168.1.100:8086`,"aria-label":`Manual InfluxDB URL`,value:z,onChange:e=>$e(e.target.value)}),e.createElement(`span`,{style:C.hint},`for remote instances`)),Ye&&Ye.length===0&&!Ze&&e.createElement(`div`,{style:{...C.empty,padding:`16px`,textAlign:`left`}},`No InfluxDB found on localhost. Use manual URL above for remote instances.`),B&&e.createElement(`div`,{style:{marginTop:14}},e.createElement(`div`,{style:C.fieldHelp},B.type===`influxdb2`?`InfluxDB 2.x needs an API token with read access to the bucket, and the organisation name.`:`InfluxDB 1.x needs a username and password only if the server has authentication enabled.`),B.type===`influxdb2`?e.createElement(e.Fragment,null,e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`API token`),e.createElement(`input`,{style:C.input,type:`password`,"aria-label":`InfluxDB API token`,value:tt,onChange:e=>nt(e.target.value)}),e.createElement(`span`,{style:C.hint},`not stored`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Organisation`),e.createElement(`input`,{style:C.input,"aria-label":`InfluxDB organisation`,value:rt,onChange:e=>it(e.target.value)}))):e.createElement(e.Fragment,null,e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Username`),e.createElement(`input`,{style:C.input,"aria-label":`InfluxDB username`,value:at,onChange:e=>ot(e.target.value)}),e.createElement(`span`,{style:C.hint},`blank if auth is off`)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Password`),e.createElement(`input`,{style:C.input,type:`password`,"aria-label":`InfluxDB password`,value:st,onChange:e=>ct(e.target.value)}),e.createElement(`span`,{style:C.hint},`not stored`))),e.createElement(`div`,{style:{...C.fieldRow,marginTop:4}},e.createElement(`span`,{style:C.label}),e.createElement(y,{busy:pt,busyLabel:`Loading...`,onClick:()=>void on(B)},B.type===`influxdb2`?`List buckets`:`List databases`)),lt&<.length>0&&e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},B.type===`influxdb2`?`Bucket`:`Database`),e.createElement(`select`,{style:C.select,"aria-label":`InfluxDB bucket or database to import from`,value:V,onChange:e=>{dt(e.target.value),ft(null)}},e.createElement(`option`,{value:``},`Select...`),lt.map(t=>e.createElement(`option`,{key:t.name,value:t.name},t.name))),e.createElement(y,{busy:pt,busyLabel:`...`,onClick:()=>void cn()},`Preview paths`)),ht&&e.createElement(`div`,{style:C.fieldHelp},`Listing the vessels in the bucket... On a large bucket this takes a while; the import waits for it.`),U&&U.contexts.length>0&&e.createElement(e.Fragment,null,e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Your vessel`),e.createElement(`select`,{style:C.select,"aria-label":`Which vessel in the source is this one`,value:vt,onChange:e=>yt(e.target.value)},U.contexts.length>1&&e.createElement(`option`,{value:``},`Select...`),U.contexts.map(t=>e.createElement(`option`,{key:t,value:t},t,t===U.self?U.selfBy===`tag`?` (recorded as the own vessel)`:` (this server)`:``)))),U.contexts.length>1&&e.createElement(e.Fragment,null,!U.self&&e.createElement(`div`,{style:C.fieldHelp},`The source holds `,U.contexts.length,` `,`vessels, does not say which was its own, and none of them is this server's identity. Pick the one the recording server used for this boat; its history is imported as this vessel.`),e.createElement(`label`,{style:{...C.fieldHelp,display:`block`}},e.createElement(`input`,{type:`checkbox`,checked:bt,onChange:e=>xt(e.target.checked)}),` `,`Also import the other vessels (AIS targets), each under its own context`))),H&&e.createElement(`div`,{style:C.fieldHelp},H.length,` measurement`,H.length===1?``:`s`,` found`,H.length>0&&e.createElement(e.Fragment,null,` `,`— e.g.`,` `,H.slice(0,3).map(e=>e.name).join(`, `),H.length>3?`, ...`:``)),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`From`),e.createElement(`input`,{style:C.input,type:`datetime-local`,"aria-label":`Import range start`,value:St,onChange:e=>Ct(e.target.value)})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`To`),e.createElement(`input`,{style:C.input,type:`datetime-local`,"aria-label":`Import range end`,value:wt,onChange:e=>Tt(e.target.value)})),e.createElement(`div`,{style:C.fieldHelp},`Imported rows are tagged `,e.createElement(`code`,null,`source=influxdb-import`),` and written with their original timestamps, so re-running the same range overwrites rather than duplicating.`),e.createElement(`div`,{style:{...C.migrationActions,marginTop:10}},e.createElement(y,{variant:`primary`,busy:Et,busyLabel:`Starting...`,disabled:!V||!St||!wt||ht||(U?.contexts.length??0)>1&&!vt||W?.state===`running`,onClick:ln},`Start import`),W?.state===`running`&&e.createElement(y,{variant:`danger`,onClick:fn},`Cancel`))),W&&e.createElement(`div`,{style:{...C.empty,padding:`12px`,textAlign:`left`}},e.createElement(`div`,null,e.createElement(`strong`,null,W.state===`running`?`Importing`:W.state===`done`?`Import complete`:W.state===`cancelled`?`Import cancelled`:`Import failed`),W.bucket?` from ${W.bucket}`:``),W.resumedFrom&&e.createElement(`div`,{style:C.cardMeta},`Resumed`,W.resumedFrom.measurement?` in ${W.resumedFrom.measurement}`+(W.resumedFrom.windowStart?` at ${F(W.resumedFrom.windowStart)}`:``):` from the saved position`,`; the totals include the earlier run.`),e.createElement(`div`,{style:C.cardMeta},d(W.progress.written),` written,`,` `,d(W.progress.skipped),` skipped,`,` `,W.progress.measurementsDone,`/`,W.progress.measurementsTotal,` measurements`,W.progress.currentMeasurement?` — ${W.progress.currentMeasurement}`:``),W.error&&e.createElement(`div`,{style:{...C.cardMeta,color:`#b91c1c`}},W.error))),e.createElement(_,{title:`Data Export`},e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`From`),e.createElement(`input`,{style:C.input,type:`datetime-local`,value:mn,onChange:e=>hn(e.target.value)})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`To`),e.createElement(`input`,{style:C.input,type:`datetime-local`,value:gn,onChange:e=>_n(e.target.value)})),e.createElement(`div`,{style:C.fieldRow},e.createElement(`span`,{style:C.label},`Format`),e.createElement(`select`,{style:C.select,value:vn,onChange:e=>yn(e.target.value)},e.createElement(`option`,{value:`parquet`},`Parquet`),e.createElement(`option`,{value:`csv`},`CSV`))),e.createElement(y,{variant:`primary`,busy:bn,busyLabel:`Exporting...`,onClick:Cn},`Export Data`)),s.managedContainer!==!1&&e.createElement(_,{title:`Danger zone`},e.createElement(`div`,{style:{fontSize:13,color:`#555`,marginBottom:10}},`Remove the QuestDB container and permanently delete all recorded data. Use this to fully reset QuestDB — Signal K's plugin-uninstall cannot delete this data on rootless Podman. This cannot be undone.`),e.createElement(y,{variant:`danger`,busy:zt,busyLabel:`Removing...`,onClick:nn},`Remove container & all data`)),e.createElement(b,{message:Mt,error:Nt,style:{marginTop:16}}),e.createElement(`div`,{style:{marginTop:24}},e.createElement(y,{onClick:Sn},`Save Configuration`)))}export{Ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";import"./dist-
|
|
1
|
+
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";import"./dist-C5M3fhBw.js";var t=e=>{let t=e;for(let e=0;e<5;e++){let e=t?.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},n={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__signalk_questdb__mf_owner__196689844091135__prebuild__react__prebuild__-eQjVI-Oj.js`),[],import.meta.url)},r={react:{name:`react`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`signalk_questdb`,canLiveRebind:!0,get(){let e=r.react;return e.lib?e.lib:(e.loading||=(async()=>{try{let{react:r}=n,i=t({...await r()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`^19.2.4`,strictVersion:!1,eager:!1}}},i=[];export{i as usedRemotes,r as usedShared};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,o as n,r,t as i}from"./utils-
|
|
1
|
+
import{a as e,i as t,o as n,r,t as i}from"./utils-v9GZlbdk.js";function a(e){let i=new((t())||r)({id:`${e.name}@${e.version||Date.now()}`,...e});return n(i),i}var o=null;function s(e){let t=i(e.name,e.version),n={...e,id:e.id||``};return t?(t.initOptions(n),o||=t,t):(o=a(n),o)}e(r);export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./utils-v9GZlbdk.js";({...e.global});var t=e.share;e.utils;export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";import{t}from"./helpers-
|
|
1
|
+
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";import{t}from"./helpers-oIxDNnZJ.js";var n=`__mf_module_cache__`;globalThis[n]||={share:{},remote:{}},globalThis[n].share||={},globalThis[n].remote||={};var r=globalThis[n];for(let e of Object.keys(r.share))if(e.startsWith(`default:`)){let t=e.slice(8);r.share[t]===void 0&&(r.share[t]=r.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;r.share[t]===void 0&&(r.share[t]=r.share[e])}var i;async function a(){return i||=(async()=>{let n=(e,t,n,r)=>{let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},i=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},a=Symbol.for(`module-federation.shared-cache-listeners`),o=Symbol.for(`module-federation.shared-cache-owners`),s=e=>{let t=e[o];return t===void 0&&(t=Object.create(null),Object.defineProperty(e,o,{value:t,enumerable:!1,configurable:!1,writable:!1})),t},c=(e,t)=>e[o]?.[t.canonical],l=e=>{let t=[e,e?.default];for(let e of t)if(e&&typeof e==`object`){for(let t of[`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`,`__TEST_INTERNALS`,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`]){let n=e[t];if(n&&typeof n==`object`)return{internals:n}}if(typeof e.useState==`function`)return{hook:e.useState}}},u=(e,t)=>{if(e===t)return!0;let n=l(e),r=l(t);if(!n||!r)return!1;let i=n.internals,a=r.internals;return i!==void 0||a!==void 0?i!==void 0&&i===a:typeof n.hook==`function`&&n.hook===r.hook},d=(e,t,n,r)=>{let c=i(e,t);if(c!==void 0&&u(c,n))return n;e[t.canonical]=n;let l=t.aliases||[];for(let t of l)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});let d=e[o];r===void 0?d&&delete d[t.canonical]:s(e)[t.canonical]=r;let f=e[a]?.[t.canonical];if(f)for(let e of f)e(n);return n},f=await(await e(()=>import(`../remoteEntry.js`),[],import.meta.url)).init(),{usedShared:p}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-BUtmcsA-.js`);return{usedShared:e}},[],import.meta.url),m=e=>{let t=e;for(let e=0;e<5;e++){let e=t?.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},h=(e,t)=>y(t).some(n=>Object.keys(f.shareScopeMap?.[n]?.[e]||{}).some(e=>e!==t.version)),g=[[`react`]],_=Symbol(`mf.originalSharedProvider`),v={emit:e=>e},y=e=>Array.isArray(e.scope)?e.scope:[e.scope||`default`],b=(e,t)=>{if(t!==`version-first`)return e;let n={};for(let[t,r]of Object.entries(e))n[t]=Object.assign({},r,{[_]:r});return n},x=(e,n,r,i)=>{if(!e||!r)return;let a=Object.fromEntries(Object.entries(e).filter(([,e])=>e?.shareConfig?.import!==!1));if(Object.keys(a).length===0)return;let o=y(r),s=b(a,i),c={};for(let e of o)c[e||`default`]={[n]:s};let l=t.getRegisteredShare(c,n,{...r,scope:o,strategy:i},v)?.shared;return l?.[_]||l},S=(e,t,n,r)=>n.shareConfig?.singleton?Object.values(e||{}).some(e=>e?.shareConfig?.import!==!1):!!x(e,t,{...n,scope:[r]},`version-first`);for(let e of g)await Promise.all(e.map(async e=>{let t=p[e];if(!t||t.materialize===!1&&!t.lazy||t.treeShaking)return;let a=n(e,t.shareConfig?.singleton,t.version,t.scope);if(!(i(r.share,a)!==void 0&&(!t.shareConfig?.singleton&&c(r.share,a)===`signalk_questdb`||t.shareConfig?.singleton&&!h(e,t)))){if(t.shareConfig?.import===!1){let n=y(t),r=n=>!S(f.shareScopeMap?.[n]?.[e],e,t,n);if(n.some(r)){f.__mfKeepAdoptedProviders||(f.__mfKeepAdoptedProviders=!0,f.sharedHandler?.hooks?.lifecycle?.afterRegisterShare?.on?.(e=>{let{shared:t,previousShared:n,registeredShared:r}=e||{},i=f.shareScopeMap?.[e.scope]?.[e.pkgName];t&&i&&(t.shareConfig?.import===!1?r===t&&n&&n.shareConfig?.import!==!1&&i[t.version]===t&&(i[t.version]=n):r!==t&&r?.shareConfig?.import===!1&&!r.loaded&&i[t.version]===r&&(i[t.version]=t))}));for(let i of globalThis.__FEDERATION__?.__INSTANCES__||[])for(let a of n){let n=i?.shareScopeMap?.[a]?.[e];if(!S(n,e,t,a)||!r(a))continue;let o=(f.shareScopeMap[a]||={})[e]||={};for(let[e,t]of Object.entries(n))t?.shareConfig?.import!==!1&&(o[e]&&o[e].shareConfig?.import!==!1||(o[e]=t))}}if(n.every(r))return}await f.loadShare(e,{customShareInfo:{shareConfig:t.shareConfig}}).then(async e=>{if(e===!1)return;let t=typeof e==`function`?e():e,n=m(await Promise.resolve(t));d(r.share,a,n,`signalk_questdb`)})}}));for(let[e,t]of Object.entries(p)){if(!t.lib||t.treeShaking||t.shareConfig?.import===!1)continue;let i=n(e,t.shareConfig?.singleton,t.version,t.scope);if(c(r.share,i)===`signalk_questdb`)for(let n of Array.isArray(t.scope)?t.scope:[t.scope||`default`]){let r=f.shareScopeMap?.[n]?.[e],i=r?.[t.version];i&&i.get===t.get&&!i.lib&&(Object.values(r).some(e=>e!==i&&(e?.lib||e?.loaded))||(i.lib=t.lib,i.loaded=!0))}}return f})(),i}i=a();export{i as hostInitPromise,a as initHost};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./helpers-
|
|
2
|
-
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}(async()=>{let t=await e(()=>import(`./hostInit-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./helpers-oIxDNnZJ.js","./utils-v9GZlbdk.js","./pendingShares-PvyVL1Z8.js","./vite-preload-helper-CRzLMJPS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}(async()=>{let t=await e(()=>import(`./hostInit-B3lIJd9C.js`),__vite__mapDeps([0,1]),import.meta.url);await t.__tla;let{initHost:r}=t;await r();let i=await e(()=>import(`./pendingShares-PvyVL1Z8.js`),__vite__mapDeps([2,3]),import.meta.url).catch(()=>void 0);i&&typeof i.preloadPendingShares==`function`&&await i.preloadPendingShares(),n.pendingShareLoads&&await Promise.all(n.pendingShareLoads);let a=globalThis.__mf_module_cache_react_server__;a?.pendingShareLoads&&await Promise.all(a.pendingShareLoads)})().then(()=>e(()=>import(`./configpanel-BvRk9kiK.js`),[],import.meta.url));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./utils-
|
|
2
|
-
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}var r=(e,t,n,r)=>{let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},i=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},a=[[`react`,()=>e(()=>import(`./_virtual_mf___mfe_internal__signalk_questdb__mf_owner__196689844091135__loadShare__shared-BRI06Lxu.js`).then(e=>e.o),[],import.meta.url)]];async function o(){if(a.length===0)return;let t=`react-dom/client`,{usedShared:o}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./utils-v9GZlbdk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./vite-preload-helper-CRzLMJPS.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}var r=(e,t,n,r)=>{let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},i=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},a=[[`react`,()=>e(()=>import(`./_virtual_mf___mfe_internal__signalk_questdb__mf_owner__196689844091135__loadShare__shared-BRI06Lxu.js`).then(e=>e.o),[],import.meta.url)]];async function o(){if(a.length===0)return;let t=`react-dom/client`,{usedShared:o}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-BUtmcsA-.js`);return{usedShared:e}},__vite__mapDeps([0]),import.meta.url);await Promise.all(a.map(async([e,a])=>{let s=o[e],c=s??(e===t?o[`react-dom`]:void 0);if(!c||c.treeShaking||c.shareConfig?.import===!1||s&&s.materialize===!1&&e!==t)return;let l=r(e,c.shareConfig?.singleton,c.version,c.scope);i(n.share,l)===void 0&&await a().catch(t=>console.warn(`[module-federation] shared preload failed:`,e,t))}))}export{o as preloadPendingShares};
|