@qaecy/cue-sdk 0.0.17 → 0.0.18
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/{cue-yUoyoy61.js → cue-D52ik-Oy.js} +293 -198
- package/index.js +1 -1
- package/lib/cue.d.ts +1 -0
- package/lib/documents.d.ts +13 -0
- package/node.js +2 -2
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getApps as ge, initializeApp as ue } from "firebase/app";
|
|
2
|
-
import { ref as _, getDownloadURL as F, getMetadata as
|
|
2
|
+
import { ref as _, getDownloadURL as F, getMetadata as U, getBlob as Yt, updateMetadata as me, uploadBytesResumable as wt, uploadBytes as rt, StringFormat as we, uploadString as fe, listAll as z, getStorage as T, connectStorageEmulator as K } from "firebase/storage";
|
|
3
3
|
import { Writer as ye, DataFactory as j } from "n3";
|
|
4
|
-
import { getFirestore as be, connectFirestoreEmulator as ve, collection as
|
|
5
|
-
import { getAuth as Ae, connectAuthEmulator as Re, onIdTokenChanged as
|
|
4
|
+
import { getFirestore as be, connectFirestoreEmulator as ve, collection as ft, getDocs as _e, query as ke, where as Ee, limit as xe, doc as yt, getDoc as Ie, setDoc as Ce, serverTimestamp as Te, increment as Se } from "firebase/firestore";
|
|
5
|
+
import { getAuth as Ae, connectAuthEmulator as Re, onIdTokenChanged as Oe, getIdTokenResult as st, signInWithEmailAndPassword as Pe, GoogleAuthProvider as at, OAuthProvider as it, signInWithPopup as De, signInWithRedirect as Le, getRedirectResult as qe, signInWithCustomToken as je, signOut as Me, onAuthStateChanged as Ue, fetchSignInMethodsForEmail as ze, linkWithPopup as Ne, unlink as $e, reauthenticateWithCredential as bt, EmailAuthProvider as Q, updatePassword as Fe, linkWithCredential as Be, verifyBeforeUpdateEmail as Ge, sendEmailVerification as He } from "firebase/auth";
|
|
6
6
|
import { v5 as We } from "uuid";
|
|
7
7
|
import "spark-md5";
|
|
8
|
-
import { getFunctions as
|
|
9
|
-
class
|
|
8
|
+
import { getFunctions as Zt, connectFunctionsEmulator as Jt, httpsCallable as B } from "firebase/functions";
|
|
9
|
+
class lt {
|
|
10
10
|
queryEndpoint;
|
|
11
11
|
updateEndpoint;
|
|
12
12
|
baseHeaders;
|
|
@@ -18,7 +18,7 @@ class pt {
|
|
|
18
18
|
constructor(t) {
|
|
19
19
|
this.queryEndpoint = t.queryEndpoint, this.updateEndpoint = t.updateEndpoint, this.baseHeaders = Object.fromEntries(
|
|
20
20
|
Object.entries(t.originalHeaders || {}).filter(
|
|
21
|
-
([e]) =>
|
|
21
|
+
([e]) => lt.RELEVANT_HEADER_KEYS.includes(e)
|
|
22
22
|
)
|
|
23
23
|
), t.authHeader !== void 0 && (this.baseHeaders.Authorization = t.authHeader);
|
|
24
24
|
}
|
|
@@ -250,7 +250,7 @@ class Ke {
|
|
|
250
250
|
this._db = new A(this.options);
|
|
251
251
|
break;
|
|
252
252
|
case "fuseki":
|
|
253
|
-
this._db = new
|
|
253
|
+
this._db = new lt(this.options);
|
|
254
254
|
break;
|
|
255
255
|
default:
|
|
256
256
|
throw new Error(`Unsupported graph type: ${this.options.graphType}`);
|
|
@@ -342,7 +342,7 @@ class Qe {
|
|
|
342
342
|
if (this._knownMissing.has(o)) return;
|
|
343
343
|
const r = _(this._bucket(t), e);
|
|
344
344
|
try {
|
|
345
|
-
const s = await
|
|
345
|
+
const s = await U(r);
|
|
346
346
|
return `${await F(r)}&t=${encodeURIComponent(s.updated)}`;
|
|
347
347
|
} catch (s) {
|
|
348
348
|
if (s?.code === "storage/object-not-found" || s?.status === 404) {
|
|
@@ -356,7 +356,7 @@ class Qe {
|
|
|
356
356
|
async getFile(t, e) {
|
|
357
357
|
const o = _(this._bucket(t), e);
|
|
358
358
|
try {
|
|
359
|
-
return await
|
|
359
|
+
return await Yt(o);
|
|
360
360
|
} catch (r) {
|
|
361
361
|
if (r?.code === "storage/object-not-found") return;
|
|
362
362
|
throw r;
|
|
@@ -383,7 +383,7 @@ class Qe {
|
|
|
383
383
|
try {
|
|
384
384
|
const [a, n] = await Promise.all([
|
|
385
385
|
s(F(e)),
|
|
386
|
-
s(
|
|
386
|
+
s(U(e))
|
|
387
387
|
]), p = `${a}&t=${encodeURIComponent(n.updated)}`, c = await fetch(p, { signal: o.signal });
|
|
388
388
|
if (!c.ok) throw new Error(`HTTP ${c.status}`);
|
|
389
389
|
return c.text();
|
|
@@ -399,7 +399,7 @@ class Qe {
|
|
|
399
399
|
async getMetadata(t, e) {
|
|
400
400
|
const o = _(this._bucket(t), e);
|
|
401
401
|
try {
|
|
402
|
-
const r = await
|
|
402
|
+
const r = await U(o);
|
|
403
403
|
return {
|
|
404
404
|
updated: r.updated,
|
|
405
405
|
contentType: r.contentType,
|
|
@@ -423,7 +423,7 @@ class Qe {
|
|
|
423
423
|
* upload progress needs to be surfaced in the UI.
|
|
424
424
|
*/
|
|
425
425
|
uploadResumable(t, e, o, r) {
|
|
426
|
-
const s = _(this._bucket(t), e), a =
|
|
426
|
+
const s = _(this._bucket(t), e), a = wt(s, o, r ? { customMetadata: r } : void 0);
|
|
427
427
|
return {
|
|
428
428
|
complete: () => new Promise((n, p) => a.then(() => n(), p)),
|
|
429
429
|
pause: () => a.pause(),
|
|
@@ -499,7 +499,7 @@ class Qe {
|
|
|
499
499
|
d(new DOMException("Upload cancelled", "AbortError"));
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
|
-
const g =
|
|
502
|
+
const g = wt(n, e, { customMetadata: o }), w = () => {
|
|
503
503
|
g.cancel(), d(new DOMException("Upload cancelled", "AbortError"));
|
|
504
504
|
};
|
|
505
505
|
s?.addEventListener("abort", w, { once: !0 }), g.on(
|
|
@@ -532,7 +532,7 @@ class Qe {
|
|
|
532
532
|
*/
|
|
533
533
|
async uploadProcessed(t, e, o) {
|
|
534
534
|
const r = _(this.options.storageProcessed, t);
|
|
535
|
-
return await
|
|
535
|
+
return await U(r).catch(() => null) ? !1 : (await rt(r, e, { customMetadata: o }), !0);
|
|
536
536
|
}
|
|
537
537
|
/** List all blob names directly under `prefix` in the raw bucket. */
|
|
538
538
|
async listRaw(t) {
|
|
@@ -540,7 +540,7 @@ class Qe {
|
|
|
540
540
|
return (await z(e)).items.map((r) => r.name);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
const
|
|
543
|
+
const vt = {
|
|
544
544
|
ä: "ae",
|
|
545
545
|
ä: "ae",
|
|
546
546
|
Ä: "AE",
|
|
@@ -580,8 +580,8 @@ function D(i, t = !1) {
|
|
|
580
580
|
}
|
|
581
581
|
function Xe(i, t = !1) {
|
|
582
582
|
let e = i;
|
|
583
|
-
for (const o in
|
|
584
|
-
e = e.replace(new RegExp(o, "g"),
|
|
583
|
+
for (const o in vt)
|
|
584
|
+
e = e.replace(new RegExp(o, "g"), vt[o]);
|
|
585
585
|
return t && e !== i && console.info(`${i} -> ${e}`), e;
|
|
586
586
|
}
|
|
587
587
|
function Ye(i, t = "") {
|
|
@@ -608,7 +608,7 @@ class x {
|
|
|
608
608
|
return this;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function ct(i, t) {
|
|
612
612
|
const e = /* @__PURE__ */ new Set();
|
|
613
613
|
let o = t(), r = !1;
|
|
614
614
|
const s = [], a = () => {
|
|
@@ -630,7 +630,7 @@ function lt(i, t) {
|
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
|
-
async function
|
|
633
|
+
async function ht(i, t, e, o) {
|
|
634
634
|
const r = D(i);
|
|
635
635
|
let s;
|
|
636
636
|
if (o) {
|
|
@@ -646,8 +646,8 @@ const Y = {
|
|
|
646
646
|
apiKey: "AIzaSyAiW42QBx9HS4Khu88pCW7MV66IhBAQul0",
|
|
647
647
|
appId: "1:151132927589:web:d2ffdb377dfadfd23ab88c",
|
|
648
648
|
measurementId: "G-YT4PK6HGZD"
|
|
649
|
-
},
|
|
650
|
-
class
|
|
649
|
+
}, _t = "qaecy-mvp-406413", Ze = "734737865998", te = "europe-west6", kt = "projects", Je = "spaces_chats_eu_west6", Et = "spaces_raw_eu_west6", xt = "spaces_processed_eu_west6", to = "spaces_logs_eu_west6", eo = "cue_public_eu_west6", It = "db_persistence_eu_west6", oo = "/data-views/admin/consumption", ro = "/data-views/admin/profile/organizations", Ct = "/data-views/admin/profile/api-keys", Tt = "/commands/admin/profile/api-keys", so = "/commands/admin/profile/terms", ao = (i) => `/data-views/admin/organizations/${i}/members`, io = "/commands/admin/project", no = "/assistant/search", ee = "/triplestore/query", po = "/triplestore/update", lo = "/triplestore/shacl", oe = "/qlever-server/qlever/query", co = "/qlever-server/qlever/update", ho = "/qlever-server/qlever/shacl", St = "/commands/file-system-structure/batch", At = "microsoft.com", Rt = "superadmin", dt = "https://cue.qaecy.com/r/";
|
|
650
|
+
class Ot {
|
|
651
651
|
_auth;
|
|
652
652
|
_endpoints;
|
|
653
653
|
_userSignal = new x(null);
|
|
@@ -666,17 +666,17 @@ class Rt {
|
|
|
666
666
|
constructor(t, e = !1, o) {
|
|
667
667
|
this._auth = Ae(t), this._endpoints = o, e && Re(this._auth, o.authEmulatorUrl, {
|
|
668
668
|
disableWarnings: !0
|
|
669
|
-
}), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal =
|
|
669
|
+
}), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal = ct([this._userSignal], () => {
|
|
670
670
|
const r = this._userSignal.get();
|
|
671
671
|
if (!r) return [];
|
|
672
672
|
const s = /* @__PURE__ */ new Set([r.uid]);
|
|
673
673
|
return r.providerData.forEach((a) => s.add(a.uid)), Array.from(s);
|
|
674
|
-
}), this.userIds = this._userIdsSignal, this._stopTokenListener =
|
|
674
|
+
}), this.userIds = this._userIdsSignal, this._stopTokenListener = Oe(this._auth, async (r) => {
|
|
675
675
|
if (this._userSignal.set(r), r) {
|
|
676
676
|
const s = await r.getIdToken();
|
|
677
677
|
this._tokenSignal.set(s);
|
|
678
678
|
const a = await st(r);
|
|
679
|
-
this._isSuperAdminSignal.set(a.claims.role ===
|
|
679
|
+
this._isSuperAdminSignal.set(a.claims.role === Rt);
|
|
680
680
|
} else
|
|
681
681
|
this._tokenSignal.set(null), this._isSuperAdminSignal.set(!1);
|
|
682
682
|
});
|
|
@@ -689,13 +689,13 @@ class Rt {
|
|
|
689
689
|
if (t === "password") {
|
|
690
690
|
if (!e)
|
|
691
691
|
throw new Error("credentials are required for password sign-in");
|
|
692
|
-
return (await
|
|
692
|
+
return (await Pe(
|
|
693
693
|
this._auth,
|
|
694
694
|
e.email,
|
|
695
695
|
e.password
|
|
696
696
|
)).user;
|
|
697
697
|
}
|
|
698
|
-
const o = t === "google" ? new at() : new it(
|
|
698
|
+
const o = t === "google" ? new at() : new it(At);
|
|
699
699
|
return (await De(this._auth, o)).user;
|
|
700
700
|
}
|
|
701
701
|
/**
|
|
@@ -704,7 +704,7 @@ class Rt {
|
|
|
704
704
|
* retrieve the result.
|
|
705
705
|
*/
|
|
706
706
|
async signInWithRedirect(t) {
|
|
707
|
-
const e = t === "google" ? new at() : new it(
|
|
707
|
+
const e = t === "google" ? new at() : new it(At);
|
|
708
708
|
await Le(this._auth, e);
|
|
709
709
|
}
|
|
710
710
|
/**
|
|
@@ -722,7 +722,7 @@ class Rt {
|
|
|
722
722
|
*/
|
|
723
723
|
async checkSuperAdmin() {
|
|
724
724
|
const t = this._auth.currentUser;
|
|
725
|
-
return t ? (await st(t)).claims.role ===
|
|
725
|
+
return t ? (await st(t)).claims.role === Rt : !1;
|
|
726
726
|
}
|
|
727
727
|
/** Sign in with a Cue API key. `projectId` is optional — omit it when no project context is available (e.g. admin flows). */
|
|
728
728
|
async signInWithApiKey(t, e) {
|
|
@@ -739,7 +739,7 @@ class Rt {
|
|
|
739
739
|
}
|
|
740
740
|
/** Sign out the current user */
|
|
741
741
|
async signOut() {
|
|
742
|
-
await
|
|
742
|
+
await Me(this._auth);
|
|
743
743
|
}
|
|
744
744
|
/**
|
|
745
745
|
* Register a new user by name and email.
|
|
@@ -769,7 +769,7 @@ class Rt {
|
|
|
769
769
|
}
|
|
770
770
|
/** Subscribe to authentication state changes. Returns an unsubscribe function. */
|
|
771
771
|
onAuthStateChanged(t) {
|
|
772
|
-
return
|
|
772
|
+
return Ue(this._auth, t);
|
|
773
773
|
}
|
|
774
774
|
/** Get the Firebase ID token for the current user, or null if not authenticated */
|
|
775
775
|
async getToken(t = !1) {
|
|
@@ -861,7 +861,7 @@ class mo {
|
|
|
861
861
|
throw new Error(`Failed to save tables: ${o.status} ${o.statusText}`);
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class Dt {
|
|
865
865
|
constructor(t, e, o, r) {
|
|
866
866
|
this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new mo(t, e);
|
|
867
867
|
}
|
|
@@ -918,7 +918,7 @@ class Ot {
|
|
|
918
918
|
*/
|
|
919
919
|
async sparql(t, e, o) {
|
|
920
920
|
o || (o = (await this.projects.getProject(e))?.projectSettings?.graph?.type ?? "qlever");
|
|
921
|
-
const r = o === "fuseki" ?
|
|
921
|
+
const r = o === "fuseki" ? ee : oe;
|
|
922
922
|
console.log(`Executing SPARQL query against ${r} for project ${e} with graph type ${o}`);
|
|
923
923
|
const s = new URLSearchParams();
|
|
924
924
|
s.append("query", t);
|
|
@@ -1018,7 +1018,7 @@ const nt = [
|
|
|
1018
1018
|
"railway",
|
|
1019
1019
|
"natural",
|
|
1020
1020
|
"manmade"
|
|
1021
|
-
],
|
|
1021
|
+
], re = [
|
|
1022
1022
|
"address",
|
|
1023
1023
|
"poi",
|
|
1024
1024
|
"railway",
|
|
@@ -1160,7 +1160,7 @@ class ko {
|
|
|
1160
1160
|
}
|
|
1161
1161
|
async listFeatureCategoryDescriptors(t) {
|
|
1162
1162
|
return (await Promise.allSettled(
|
|
1163
|
-
|
|
1163
|
+
re.map(async (o) => {
|
|
1164
1164
|
const r = await this.search(t, o);
|
|
1165
1165
|
return { category: o, hasResults: r.length > 0 };
|
|
1166
1166
|
})
|
|
@@ -1229,7 +1229,7 @@ class ko {
|
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
|
-
const
|
|
1232
|
+
const Lt = {
|
|
1233
1233
|
// 100s – Residential
|
|
1234
1234
|
110: "residential",
|
|
1235
1235
|
120: "residential",
|
|
@@ -1308,7 +1308,7 @@ const Dt = {
|
|
|
1308
1308
|
960: "agricultural",
|
|
1309
1309
|
970: "agricultural",
|
|
1310
1310
|
990: "other"
|
|
1311
|
-
},
|
|
1311
|
+
}, qt = {
|
|
1312
1312
|
1010: "residential",
|
|
1313
1313
|
1020: "mixed",
|
|
1314
1314
|
1030: "residential",
|
|
@@ -1413,20 +1413,20 @@ const Dt = {
|
|
|
1413
1413
|
[/infrastruktur|verkehr|transport|energy|energie|forsyning|teknik|teknisk/i, "infrastructure"],
|
|
1414
1414
|
[/gemischt|mixed|blandet/i, "mixed"]
|
|
1415
1415
|
];
|
|
1416
|
-
function
|
|
1416
|
+
function P(i) {
|
|
1417
1417
|
for (const [t, e] of xo)
|
|
1418
1418
|
if (t.test(i)) return e;
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function Io(i, t) {
|
|
1421
1421
|
if (i == null) return;
|
|
1422
1422
|
const e = String(i).trim();
|
|
1423
|
-
return t === "swiss-gwr" ? Eo[e] ??
|
|
1423
|
+
return t === "swiss-gwr" ? Eo[e] ?? P(e) : t === "danish-matrikel" ? Lt[e] ?? P(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? qt[e] ?? P(e) : qt[e] ?? Lt[e] ?? P(e);
|
|
1424
1424
|
}
|
|
1425
|
-
function
|
|
1425
|
+
function Co(i, t) {
|
|
1426
1426
|
if (i != null)
|
|
1427
|
-
return
|
|
1427
|
+
return P(String(i).trim());
|
|
1428
1428
|
}
|
|
1429
|
-
function
|
|
1429
|
+
function se(i) {
|
|
1430
1430
|
return i.trim().toLowerCase().replace(/[\s_\-]/g, "");
|
|
1431
1431
|
}
|
|
1432
1432
|
const To = {
|
|
@@ -1448,11 +1448,11 @@ const To = {
|
|
|
1448
1448
|
forslag: "proposed",
|
|
1449
1449
|
aflyst: "repealed"
|
|
1450
1450
|
};
|
|
1451
|
-
function
|
|
1451
|
+
function ae(i) {
|
|
1452
1452
|
if (i)
|
|
1453
|
-
return To[
|
|
1453
|
+
return To[se(i)];
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const jt = {
|
|
1456
1456
|
// Swiss Nutzungsplanung (typ_gde_bezeichnung and common variants)
|
|
1457
1457
|
grundnutzungszonenplan: "land-use-plan",
|
|
1458
1458
|
nutzungszonenplan: "land-use-plan",
|
|
@@ -1546,17 +1546,17 @@ const qt = {
|
|
|
1546
1546
|
// Catch-all: any remaining Xzone / Xareal designation from the Grundnutzungszonenplan
|
|
1547
1547
|
[/zone$|areal$/i, "land-use-plan"]
|
|
1548
1548
|
];
|
|
1549
|
-
function
|
|
1549
|
+
function ie(i) {
|
|
1550
1550
|
if (!i) return;
|
|
1551
|
-
const t =
|
|
1552
|
-
if (t in
|
|
1551
|
+
const t = se(i);
|
|
1552
|
+
if (t in jt) return jt[t];
|
|
1553
1553
|
for (const [e, o] of So)
|
|
1554
1554
|
if (e.test(i)) return o;
|
|
1555
1555
|
console.warn(
|
|
1556
1556
|
`[cue-gis] Unknown zone plan type — add "${i}" to classifyZonePlanType: no ZonePlanType mapping found.`
|
|
1557
1557
|
);
|
|
1558
1558
|
}
|
|
1559
|
-
const Ao = "https://maps.zh.ch/wfs/OGDZHWFS", Ro = "zurich-wfs",
|
|
1559
|
+
const Ao = "https://maps.zh.ch/wfs/OGDZHWFS", Ro = "zurich-wfs", Oo = [8.35, 47.15, 8.95, 47.7], Po = [5.9, 45.7, 10.55, 47.85];
|
|
1560
1560
|
function Z(i) {
|
|
1561
1561
|
return typeof i == "string" ? i : i.typeName;
|
|
1562
1562
|
}
|
|
@@ -1606,27 +1606,27 @@ function tt(i, t, e, o) {
|
|
|
1606
1606
|
descriptionKey: `gis.layer.${i}.${r}.description`
|
|
1607
1607
|
};
|
|
1608
1608
|
}
|
|
1609
|
-
function
|
|
1609
|
+
function Mo(i, t) {
|
|
1610
1610
|
if (!i) return { featureType: "building" };
|
|
1611
1611
|
const e = i.grundflaeche ?? i.gbf ?? i.gebaeudegrundrissflaeche ?? i.flaeche ?? void 0, o = i.vollgeschosse ?? i.geschossanzahl ?? i.anzahl_geschosse ?? void 0, r = i.gebaeudefunktion ?? i.gfkode ?? i.art ?? i.objektart ?? void 0, s = i.baujahr ?? i.bauperiode ?? void 0, a = String(i.egid ?? i.gwr_egid ?? i.egris_egid ?? "").trim() || void 0;
|
|
1612
1612
|
return {
|
|
1613
1613
|
featureType: "building",
|
|
1614
1614
|
areaM2: typeof e == "number" ? e : void 0,
|
|
1615
1615
|
buildingUse: r ? String(r) : void 0,
|
|
1616
|
-
buildingUseGeneric:
|
|
1616
|
+
buildingUseGeneric: Io(r, t),
|
|
1617
1617
|
floors: typeof o == "number" ? o : void 0,
|
|
1618
1618
|
yearBuilt: typeof s == "number" ? s : void 0,
|
|
1619
1619
|
registryId: a
|
|
1620
1620
|
};
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function Uo(i, t) {
|
|
1623
1623
|
if (!i) return { featureType: "plot" };
|
|
1624
1624
|
const e = i.egris_egrid ?? i.egrid ?? void 0, o = i.nummer ?? void 0, r = i.nbident ?? void 0, s = o && r ? `${o}, ${r}` : o ?? void 0, a = i.flaechenmass ?? i.flaeche ?? void 0, n = i.art ?? i.nutzungsart ?? void 0;
|
|
1625
1625
|
return {
|
|
1626
1626
|
featureType: "plot",
|
|
1627
1627
|
areaM2: typeof a == "number" ? a : void 0,
|
|
1628
1628
|
plotUse: n ? String(n) : void 0,
|
|
1629
|
-
plotUseGeneric:
|
|
1629
|
+
plotUseGeneric: Co(n),
|
|
1630
1630
|
plotId: s,
|
|
1631
1631
|
registryId: e
|
|
1632
1632
|
};
|
|
@@ -1651,7 +1651,7 @@ function No(i) {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
function $o(i) {
|
|
1653
1653
|
if (!i) return { featureType: "zone" };
|
|
1654
|
-
const t = i.plannavn ?? i.bezeichnung ?? i.typ_bezeichnung ?? i.art ?? void 0, e = i.planid ?? i.plannummer ?? void 0, o = i.artcode ?? i.typ_code ?? i.abkuerzung ?? e ?? void 0, r = i.rechtsstatus ?? i.status ?? void 0, s =
|
|
1654
|
+
const t = i.plannavn ?? i.bezeichnung ?? i.typ_bezeichnung ?? i.art ?? void 0, e = i.planid ?? i.plannummer ?? void 0, o = i.artcode ?? i.typ_code ?? i.abkuerzung ?? e ?? void 0, r = i.rechtsstatus ?? i.status ?? void 0, s = ae(r), a = i.typ_gde_bezeichnung ?? void 0, n = ie(a), p = i.dagsordenpunkt_url ?? i.dokument_url ?? i.link ?? void 0, c = i.auflagedatum ?? void 0, h = i.festsetzungsdatum ?? void 0, d = i.genehmigungsdatum ?? void 0, g = i.inkraftsetzungsdatum ?? void 0, w = i.flaeche ?? i.flaeche_m2 ?? void 0;
|
|
1655
1655
|
return {
|
|
1656
1656
|
featureType: "zone",
|
|
1657
1657
|
zoneType: t ? String(t) : void 0,
|
|
@@ -1782,10 +1782,10 @@ class et {
|
|
|
1782
1782
|
};
|
|
1783
1783
|
}
|
|
1784
1784
|
_extractNormalisedProperties(t, e) {
|
|
1785
|
-
return e.category === "building" ?
|
|
1785
|
+
return e.category === "building" ? Mo(t.properties, this.sourceId) : e.category === "greenspace" ? zo(t.properties) : e.category === "paved" ? No(t.properties) : e.category === "zone" ? $o(t.properties) : Uo(t.properties, this.sourceId);
|
|
1786
1786
|
}
|
|
1787
1787
|
}
|
|
1788
|
-
const
|
|
1788
|
+
const ne = [8, 54.5, 15.2, 57.8], pe = {
|
|
1789
1789
|
building: [
|
|
1790
1790
|
{ source: "danish-matrikel", typename: "bbr_v001:bygning_current" }
|
|
1791
1791
|
],
|
|
@@ -1864,8 +1864,8 @@ function Vo(i, t) {
|
|
|
1864
1864
|
featureType: "zone",
|
|
1865
1865
|
zoneType: a ?? void 0,
|
|
1866
1866
|
zoneCode: p ?? void 0,
|
|
1867
|
-
legalStatus:
|
|
1868
|
-
planType:
|
|
1867
|
+
legalStatus: ae(c),
|
|
1868
|
+
planType: ie(i?.typ_gde_bezeichnung),
|
|
1869
1869
|
planId: n ?? void 0,
|
|
1870
1870
|
planDocumentLink: h ?? void 0,
|
|
1871
1871
|
publicationDate: i?.auflagedatum ?? void 0,
|
|
@@ -1889,7 +1889,7 @@ class Ko {
|
|
|
1889
1889
|
getHeaders;
|
|
1890
1890
|
sourceId;
|
|
1891
1891
|
constructor(t) {
|
|
1892
|
-
this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ??
|
|
1892
|
+
this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? pe, this.sourceId = t.sourceId ?? "cue-sdk-gis";
|
|
1893
1893
|
}
|
|
1894
1894
|
async listFeatureCategoryDescriptors(t) {
|
|
1895
1895
|
const e = await this.listAvailableLayers(t);
|
|
@@ -2021,10 +2021,10 @@ const Qo = {
|
|
|
2021
2021
|
// ÖREB Überlagernde Festlegungen (Flächen) – overlaying planning constraints
|
|
2022
2022
|
"ms:ogd-0155_arv_basis_np_ul_flaeche_f"
|
|
2023
2023
|
]
|
|
2024
|
-
},
|
|
2024
|
+
}, le = [
|
|
2025
2025
|
{
|
|
2026
2026
|
name: "Canton of Zürich",
|
|
2027
|
-
coverageBBox:
|
|
2027
|
+
coverageBBox: Oo,
|
|
2028
2028
|
supportedCategories: ["address", "poi", "railway", "natural", "manmade", "building", "cadastre", "greenspace", "paved", "zone"],
|
|
2029
2029
|
priority: 10,
|
|
2030
2030
|
adapter: new et({
|
|
@@ -2033,7 +2033,7 @@ const Qo = {
|
|
|
2033
2033
|
},
|
|
2034
2034
|
{
|
|
2035
2035
|
name: "Switzerland (national AV cadastre)",
|
|
2036
|
-
coverageBBox:
|
|
2036
|
+
coverageBBox: Po,
|
|
2037
2037
|
supportedCategories: ["cadastre"],
|
|
2038
2038
|
priority: 5,
|
|
2039
2039
|
// Lower priority than canton-specific adapters. For ZH, the canton adapter (priority 10) wins.
|
|
@@ -2061,7 +2061,7 @@ const Qo = {
|
|
|
2061
2061
|
* - `pdk:kommuneplanramme_vedtaget` – adopted municipal plan frameworks
|
|
2062
2062
|
*/
|
|
2063
2063
|
name: "Denmark (Plandata.dk – planning zones)",
|
|
2064
|
-
coverageBBox:
|
|
2064
|
+
coverageBBox: ne,
|
|
2065
2065
|
supportedCategories: ["zone"],
|
|
2066
2066
|
priority: 10,
|
|
2067
2067
|
adapter: new et({
|
|
@@ -2079,7 +2079,7 @@ const Qo = {
|
|
|
2079
2079
|
})
|
|
2080
2080
|
}
|
|
2081
2081
|
];
|
|
2082
|
-
function
|
|
2082
|
+
function Mt(i) {
|
|
2083
2083
|
return [...i].sort(
|
|
2084
2084
|
(t, e) => nt.indexOf(t.category) - nt.indexOf(e.category)
|
|
2085
2085
|
);
|
|
@@ -2100,7 +2100,7 @@ class Xo {
|
|
|
2100
2100
|
...s
|
|
2101
2101
|
} = t;
|
|
2102
2102
|
this.nominatim = new ko(s);
|
|
2103
|
-
const a = o ?
|
|
2103
|
+
const a = o ? le : [];
|
|
2104
2104
|
this.regions = e ?? a, this.zonePlanTypeColors = { ...fo, ...r };
|
|
2105
2105
|
}
|
|
2106
2106
|
/**
|
|
@@ -2120,12 +2120,12 @@ class Xo {
|
|
|
2120
2120
|
for (const a of e)
|
|
2121
2121
|
for (const n of a.supportedCategories ?? [])
|
|
2122
2122
|
r.has(n) || (r.add(n), s.push(S(n)));
|
|
2123
|
-
for (const a of
|
|
2123
|
+
for (const a of re)
|
|
2124
2124
|
r.has(a) || s.push(S(a));
|
|
2125
|
-
return
|
|
2125
|
+
return Mt(s);
|
|
2126
2126
|
}
|
|
2127
2127
|
const o = await this._adapterFor(t).listFeatureCategoryDescriptors(t);
|
|
2128
|
-
return
|
|
2128
|
+
return Mt(o);
|
|
2129
2129
|
}
|
|
2130
2130
|
/**
|
|
2131
2131
|
* Return the feature categories that have at least one result within the
|
|
@@ -2370,11 +2370,11 @@ class or {
|
|
|
2370
2370
|
_getGateway() {
|
|
2371
2371
|
if (this._gatewayCache !== null && this._gatewayProjectId === this._projectId)
|
|
2372
2372
|
return this._gatewayCache;
|
|
2373
|
-
const t = this._projectId, e = [...
|
|
2373
|
+
const t = this._projectId, e = [...le];
|
|
2374
2374
|
return t && e.unshift({
|
|
2375
2375
|
name: "Cue SDK (authenticated)",
|
|
2376
|
-
coverageBBox:
|
|
2377
|
-
supportedCategories: Object.keys(
|
|
2376
|
+
coverageBBox: ne,
|
|
2377
|
+
supportedCategories: Object.keys(pe),
|
|
2378
2378
|
priority: 10,
|
|
2379
2379
|
adapter: new Ko({
|
|
2380
2380
|
dataViewsBaseUrl: `${this._gatewayUrl}${tr}`,
|
|
@@ -2427,11 +2427,11 @@ class or {
|
|
|
2427
2427
|
this._loadListeners.forEach((e) => e(t));
|
|
2428
2428
|
}
|
|
2429
2429
|
}
|
|
2430
|
-
class
|
|
2430
|
+
class zt {
|
|
2431
2431
|
constructor(t, e, o = !1, r) {
|
|
2432
|
-
if (this._auth = t, this._db = be(e), this._functions =
|
|
2432
|
+
if (this._auth = t, this._db = be(e), this._functions = Zt(e, te), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
|
|
2433
2433
|
const s = r?.firestoreEmulatorHost ?? "localhost", a = r?.firestoreEmulatorPort ?? 8080;
|
|
2434
|
-
ve(this._db, s, a),
|
|
2434
|
+
ve(this._db, s, a), Jt(this._functions, "localhost", 5001);
|
|
2435
2435
|
}
|
|
2436
2436
|
}
|
|
2437
2437
|
_auth;
|
|
@@ -2464,12 +2464,12 @@ class Mt {
|
|
|
2464
2464
|
* Access is gated by Firestore rules which check membership.
|
|
2465
2465
|
*/
|
|
2466
2466
|
async listProjects() {
|
|
2467
|
-
const t = this._requireUser(), e =
|
|
2467
|
+
const t = this._requireUser(), e = ft(this._db, kt);
|
|
2468
2468
|
return (await _e(ke(e, Ee("members", "array-contains", t), xe(100)))).docs.map((r) => r.data());
|
|
2469
2469
|
}
|
|
2470
2470
|
/** Fetch a single project by ID. Returns null if not found. */
|
|
2471
2471
|
async getProject(t) {
|
|
2472
|
-
const e = ft(
|
|
2472
|
+
const e = yt(ft(this._db, kt), t), o = await Ie(e);
|
|
2473
2473
|
return o.exists() ? o.data() : null;
|
|
2474
2474
|
}
|
|
2475
2475
|
/**
|
|
@@ -2478,8 +2478,8 @@ class Mt {
|
|
|
2478
2478
|
*/
|
|
2479
2479
|
async incrementUnitsConsumed(t, e, o) {
|
|
2480
2480
|
if (e <= 0) return;
|
|
2481
|
-
const r =
|
|
2482
|
-
await
|
|
2481
|
+
const r = yt(this._db, "clientSync", t);
|
|
2482
|
+
await Ce(r, {
|
|
2483
2483
|
unitsConsumed: Se(e),
|
|
2484
2484
|
lastUpdated: Te(),
|
|
2485
2485
|
lastUserId: o
|
|
@@ -2500,9 +2500,9 @@ class Mt {
|
|
|
2500
2500
|
await B(this._functions, "removeUserFromProject")({ uid: t, spaceId: e });
|
|
2501
2501
|
}
|
|
2502
2502
|
}
|
|
2503
|
-
class
|
|
2503
|
+
class Nt {
|
|
2504
2504
|
constructor(t, e, o, r) {
|
|
2505
|
-
this._auth = t, this._gatewayUrl = r, this._functions =
|
|
2505
|
+
this._auth = t, this._gatewayUrl = r, this._functions = Zt(e, te), o && Jt(this._functions, "localhost", 5001);
|
|
2506
2506
|
}
|
|
2507
2507
|
_auth;
|
|
2508
2508
|
_gatewayUrl;
|
|
@@ -2551,7 +2551,7 @@ class zt {
|
|
|
2551
2551
|
async updatePassword(t, e) {
|
|
2552
2552
|
const o = this._requireUser();
|
|
2553
2553
|
if (!o.email) throw new Error("User has no e-mail");
|
|
2554
|
-
await
|
|
2554
|
+
await bt(
|
|
2555
2555
|
o,
|
|
2556
2556
|
Q.credential(o.email, t)
|
|
2557
2557
|
), await Fe(o, e);
|
|
@@ -2566,14 +2566,14 @@ class zt {
|
|
|
2566
2566
|
async updateEmail(t, e) {
|
|
2567
2567
|
const o = this._requireUser();
|
|
2568
2568
|
if (!o.email) throw new Error("User e-mail not available");
|
|
2569
|
-
await
|
|
2569
|
+
await bt(
|
|
2570
2570
|
o,
|
|
2571
2571
|
Q.credential(o.email, e)
|
|
2572
2572
|
), await Ge(o, t), await He(o);
|
|
2573
2573
|
}
|
|
2574
2574
|
/** Creates a new API key for the current user. */
|
|
2575
2575
|
async createAPIKey(t) {
|
|
2576
|
-
return this._fetch(
|
|
2576
|
+
return this._fetch(Tt, {
|
|
2577
2577
|
method: "POST",
|
|
2578
2578
|
headers: { "Content-Type": "application/json" },
|
|
2579
2579
|
body: JSON.stringify({ expiration: t })
|
|
@@ -2582,7 +2582,7 @@ class zt {
|
|
|
2582
2582
|
/** Revokes the current user's API key. */
|
|
2583
2583
|
async revokeAPIKey() {
|
|
2584
2584
|
const t = await this._auth.authenticatedFetch(
|
|
2585
|
-
this._url(
|
|
2585
|
+
this._url(Tt),
|
|
2586
2586
|
{ method: "DELETE" }
|
|
2587
2587
|
);
|
|
2588
2588
|
if (!t.ok)
|
|
@@ -2633,7 +2633,7 @@ class zt {
|
|
|
2633
2633
|
return t ? (await st(t)).claims.terms ?? null : null;
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
const
|
|
2636
|
+
const $t = ["superadmin", "admin", "syncer", "member"], Ft = {
|
|
2637
2637
|
createEntities: "admin",
|
|
2638
2638
|
createProvider: "superadmin",
|
|
2639
2639
|
changeContentCategories: "syncer",
|
|
@@ -2665,9 +2665,9 @@ function rr() {
|
|
|
2665
2665
|
viewEntities: !1
|
|
2666
2666
|
};
|
|
2667
2667
|
}
|
|
2668
|
-
class
|
|
2668
|
+
class Bt {
|
|
2669
2669
|
constructor(t) {
|
|
2670
|
-
this._isSuperAdmin = t, this._projectRoles = new x([]), this.privileges =
|
|
2670
|
+
this._isSuperAdmin = t, this._projectRoles = new x([]), this.privileges = ct(
|
|
2671
2671
|
[this._projectRoles, t],
|
|
2672
2672
|
() => this._compute()
|
|
2673
2673
|
);
|
|
@@ -2694,17 +2694,17 @@ class Ft {
|
|
|
2694
2694
|
_expand(t) {
|
|
2695
2695
|
if (this._isSuperAdmin.get())
|
|
2696
2696
|
return ["superadmin", "admin", "syncer", "member"];
|
|
2697
|
-
const e =
|
|
2698
|
-
return e === -1 ? [] : Array.from(
|
|
2697
|
+
const e = $t.findIndex((o) => t.includes(o));
|
|
2698
|
+
return e === -1 ? [] : Array.from($t.slice(e));
|
|
2699
2699
|
}
|
|
2700
2700
|
_compute() {
|
|
2701
2701
|
const t = this._projectRoles.get(), e = rr();
|
|
2702
|
-
for (const o of Object.keys(
|
|
2703
|
-
e[o] = t.includes(
|
|
2702
|
+
for (const o of Object.keys(Ft))
|
|
2703
|
+
e[o] = t.includes(Ft[o]);
|
|
2704
2704
|
return e;
|
|
2705
2705
|
}
|
|
2706
2706
|
}
|
|
2707
|
-
class
|
|
2707
|
+
class Gt {
|
|
2708
2708
|
constructor(t) {
|
|
2709
2709
|
this._storage = t;
|
|
2710
2710
|
}
|
|
@@ -2737,7 +2737,7 @@ class Bt {
|
|
|
2737
2737
|
// ── Internal helpers ───────────────────────────────────────────────────────
|
|
2738
2738
|
async _get(t, e) {
|
|
2739
2739
|
try {
|
|
2740
|
-
const r = await (await
|
|
2740
|
+
const r = await (await Yt(_(this._storage, `${t}/${e}.json.gz`))).arrayBuffer(), s = new DecompressionStream("gzip"), a = s.writable.getWriter(), n = s.readable.getReader();
|
|
2741
2741
|
a.write(new Uint8Array(r)), a.close();
|
|
2742
2742
|
const p = [];
|
|
2743
2743
|
let c = await n.read();
|
|
@@ -6022,12 +6022,12 @@ const b = {
|
|
|
6022
6022
|
fbsp: "http://purl.obolibrary.org/obo/FBSP_",
|
|
6023
6023
|
rex: "http://purl.obolibrary.org/obo/REX_"
|
|
6024
6024
|
};
|
|
6025
|
-
class
|
|
6025
|
+
class gt {
|
|
6026
6026
|
static _instance;
|
|
6027
6027
|
// Opposite map is built once
|
|
6028
6028
|
_nsMap;
|
|
6029
6029
|
static getInstance() {
|
|
6030
|
-
return this._instance ? this._instance : (this._instance = new
|
|
6030
|
+
return this._instance ? this._instance : (this._instance = new gt(), this._instance);
|
|
6031
6031
|
}
|
|
6032
6032
|
compactIRI(t) {
|
|
6033
6033
|
let e = this._nsMap;
|
|
@@ -6109,7 +6109,7 @@ class ar {
|
|
|
6109
6109
|
return;
|
|
6110
6110
|
}
|
|
6111
6111
|
const o = this._buildCategoriesQuery(t, "ContentCategory"), r = this._buildCategoriesQuery(t, "EntityCategory"), s = this._buildRelationshipsQuery(t);
|
|
6112
|
-
await
|
|
6112
|
+
await ht(
|
|
6113
6113
|
o + r + s,
|
|
6114
6114
|
async () => {
|
|
6115
6115
|
const [a, n, p] = await Promise.all([
|
|
@@ -6183,8 +6183,8 @@ GROUP BY ?iri ?parent`;
|
|
|
6183
6183
|
}
|
|
6184
6184
|
}
|
|
6185
6185
|
const ir = "https://qlever.dev/api/osm-planet";
|
|
6186
|
-
class
|
|
6187
|
-
constructor(t, e, o =
|
|
6186
|
+
class ce {
|
|
6187
|
+
constructor(t, e, o = dt, r, s) {
|
|
6188
6188
|
this._api = t, this._projectId = e, this._queryCache = r, this._graphType = s, this.baseURL = `${o}${e}/`, this.entityInfoMap = this._entityInfoMapComputed, this.entityGraph = this._entityGraph.asReadonly(), this._entityOSMMap.subscribe(() => this._checkPendingOSMFetches()), this._fetchEntityGraph().catch(
|
|
6189
6189
|
(a) => console.error("[CueProjectEntities] Entity graph fetch failed:", a)
|
|
6190
6190
|
);
|
|
@@ -6206,7 +6206,7 @@ class le {
|
|
|
6206
6206
|
_fetchingOSMIds = /* @__PURE__ */ new Set();
|
|
6207
6207
|
_entityGraph = new x(void 0);
|
|
6208
6208
|
// ── Derived signals ────────────────────────────────────────────────────────
|
|
6209
|
-
_entityInfoMapComputed =
|
|
6209
|
+
_entityInfoMapComputed = ct(
|
|
6210
6210
|
[
|
|
6211
6211
|
this._entityDetails,
|
|
6212
6212
|
this._entityDocuments,
|
|
@@ -6447,7 +6447,7 @@ ORDER BY DESC(?weight)`, o = await this._api.sparql(
|
|
|
6447
6447
|
};
|
|
6448
6448
|
}
|
|
6449
6449
|
if (t === "md") {
|
|
6450
|
-
const s =
|
|
6450
|
+
const s = gt.getInstance(), a = r.map((h) => ({
|
|
6451
6451
|
src: s.compactIRI(h.sourceCat.value),
|
|
6452
6452
|
pred: s.compactIRI(h.predicate.value),
|
|
6453
6453
|
tgt: s.compactIRI(h.targetCat.value),
|
|
@@ -6483,9 +6483,9 @@ ORDER BY DESC(?weight)`, o = await this._api.sparql(
|
|
|
6483
6483
|
for (const { osm: f, viaRels: k, entityUUID: m } of h.indirect) {
|
|
6484
6484
|
const E = s[f];
|
|
6485
6485
|
if (E)
|
|
6486
|
-
for (const
|
|
6487
|
-
const v = `${
|
|
6488
|
-
y.geometries.some((
|
|
6486
|
+
for (const I of k) {
|
|
6487
|
+
const v = `${I}:${m}`, y = u.get(v) ?? { geometries: [], entityUUID: m };
|
|
6488
|
+
y.geometries.some((C) => C.osmIRI === f) || (y.geometries.push({ osmIRI: f, wkt: E }), u.set(v, y));
|
|
6489
6489
|
}
|
|
6490
6490
|
}
|
|
6491
6491
|
u.size > 0 && (g = Array.from(u.entries()).map(
|
|
@@ -6582,7 +6582,7 @@ WHERE {
|
|
|
6582
6582
|
?e2 qcy:hasEntityCategory ?e2Cat
|
|
6583
6583
|
}
|
|
6584
6584
|
GROUP BY ?e1Cat ?e2Cat`;
|
|
6585
|
-
await
|
|
6585
|
+
await ht(
|
|
6586
6586
|
t,
|
|
6587
6587
|
async () => {
|
|
6588
6588
|
const e = await this._api.sparql(
|
|
@@ -6635,8 +6635,8 @@ SELECT * WHERE {
|
|
|
6635
6635
|
}), this._osmWKTMap.set(a);
|
|
6636
6636
|
}
|
|
6637
6637
|
}
|
|
6638
|
-
class
|
|
6639
|
-
constructor(t, e, o, r =
|
|
6638
|
+
class pt {
|
|
6639
|
+
constructor(t, e, o, r = dt, s, a) {
|
|
6640
6640
|
this._api = t, this._projectId = e, this._queryCache = s, this._graphType = a, this.baseURL = `${r}${e}/`, this._currentLang = o ?? this._api.language, this.documentInfoMap = this._documentInfoMap.asReadonly(), this.projectDocumentsData = this._projectDocumentsData.asReadonly();
|
|
6641
6641
|
}
|
|
6642
6642
|
_api;
|
|
@@ -6690,7 +6690,7 @@ class ce {
|
|
|
6690
6690
|
documentsByContentCategory: {}
|
|
6691
6691
|
});
|
|
6692
6692
|
const t = this._buildDocumentsBySuffixQuery(), e = this._buildDocumentsByContentCategoryQuery(), o = this._buildDuplicateCountQuery();
|
|
6693
|
-
await
|
|
6693
|
+
await ht(
|
|
6694
6694
|
t + e + o,
|
|
6695
6695
|
async () => {
|
|
6696
6696
|
const [r, s, a] = await Promise.all([
|
|
@@ -6739,6 +6739,23 @@ class ce {
|
|
|
6739
6739
|
t.filter((s) => r[s] !== void 0).map((s) => [s, r[s]])
|
|
6740
6740
|
);
|
|
6741
6741
|
}
|
|
6742
|
+
/**
|
|
6743
|
+
* Fetches a lightweight document metadata shape (id/path/suffix/size) for
|
|
6744
|
+
* the given UUIDs and merges the results into `documentInfoMap`.
|
|
6745
|
+
*
|
|
6746
|
+
* This is useful for list/table contexts that do not need language-tagged
|
|
6747
|
+
* fields (`subject`, `summary`) or category/tag enrichment.
|
|
6748
|
+
*
|
|
6749
|
+
* UUIDs already present in `documentInfoMap` are skipped.
|
|
6750
|
+
*/
|
|
6751
|
+
async fetchDocumentDataSimple(t) {
|
|
6752
|
+
const e = this._documentInfoMap.get(), o = t.filter((s) => e[s] === void 0);
|
|
6753
|
+
o.length > 0 && await this._fetchSimpleDocumentInfoBatch(o);
|
|
6754
|
+
const r = this._documentInfoMap.get();
|
|
6755
|
+
return Object.fromEntries(
|
|
6756
|
+
t.filter((s) => r[s] !== void 0).map((s) => [s, r[s]])
|
|
6757
|
+
);
|
|
6758
|
+
}
|
|
6742
6759
|
/**
|
|
6743
6760
|
* Returns the alternative representations of the given document UUID.
|
|
6744
6761
|
*
|
|
@@ -6756,16 +6773,44 @@ class ce {
|
|
|
6756
6773
|
* ```
|
|
6757
6774
|
*/
|
|
6758
6775
|
async fetchAlternativeRepresentations(t) {
|
|
6759
|
-
const e = `PREFIX qcy: <${b.qcy}>
|
|
6776
|
+
const e = this._api.language, o = `PREFIX qcy: <${b.qcy}>
|
|
6760
6777
|
PREFIX r: <${this.baseURL}>
|
|
6761
|
-
SELECT ?altId
|
|
6778
|
+
SELECT ?altId ?contentIRI ?suffix ?size ?subject ?summary
|
|
6779
|
+
(SAMPLE(?fp) AS ?path)
|
|
6780
|
+
(GROUP_CONCAT(DISTINCT ?tag; SEPARATOR=";") AS ?tags)
|
|
6781
|
+
(GROUP_CONCAT(DISTINCT STR(?cat); SEPARATOR=";") AS ?categories)
|
|
6762
6782
|
WHERE {
|
|
6763
|
-
r:${t} qcy:alternativeRepresentation ?
|
|
6764
|
-
BIND(REPLACE(STR(?
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6783
|
+
r:${t} qcy:alternativeRepresentation ?contentIRI .
|
|
6784
|
+
BIND(REPLACE(STR(?contentIRI), "^.*/([^/]*)$", "$1") AS ?altId)
|
|
6785
|
+
?contentIRI qcy:sizeBytes ?size ;
|
|
6786
|
+
qcy:hasFileLocation ?loc .
|
|
6787
|
+
?loc qcy:filePath ?fp ;
|
|
6788
|
+
qcy:suffix ?suffix .
|
|
6789
|
+
OPTIONAL { ?contentIRI qcy:hasContentCategory ?cat }
|
|
6790
|
+
OPTIONAL { ?contentIRI qcy:tag ?tag }
|
|
6791
|
+
OPTIONAL { ?contentIRI qcy:subject ?lang_subj FILTER(LANG(?lang_subj) = "${e}") }
|
|
6792
|
+
OPTIONAL { ?contentIRI qcy:subject ?no_lang_subj }
|
|
6793
|
+
BIND(COALESCE(?lang_subj, ?no_lang_subj) AS ?subject)
|
|
6794
|
+
OPTIONAL { ?contentIRI qcy:textSummary ?lang_summary FILTER(LANG(?lang_summary) = "${e}") }
|
|
6795
|
+
OPTIONAL { ?contentIRI qcy:textSummary ?no_lang_summary }
|
|
6796
|
+
BIND(COALESCE(?lang_summary, ?no_lang_summary) AS ?summary)
|
|
6797
|
+
}
|
|
6798
|
+
GROUP BY ?altId ?contentIRI ?suffix ?size ?subject ?summary`, r = await this._api.sparql(o, this._projectId, this._graphType), s = { ...this._documentInfoMap.get() }, a = [];
|
|
6799
|
+
return r.results.bindings.forEach((n) => {
|
|
6800
|
+
if (!n.altId || !n.contentIRI) return;
|
|
6801
|
+
const p = n.altId.value, c = {
|
|
6802
|
+
id: p,
|
|
6803
|
+
contentIRI: n.contentIRI.value,
|
|
6804
|
+
path: n.path?.value ?? "",
|
|
6805
|
+
suffix: n.suffix?.value ?? "",
|
|
6806
|
+
size: n.size ? parseInt(n.size.value, 10) : 0,
|
|
6807
|
+
tags: n.tags?.value?.split(";").filter(Boolean) ?? [],
|
|
6808
|
+
categories: n.categories?.value?.split(";").filter(Boolean) ?? [],
|
|
6809
|
+
subject: n.subject?.value,
|
|
6810
|
+
summary: n.summary?.value
|
|
6811
|
+
};
|
|
6812
|
+
s[p] = c, a.push(c);
|
|
6813
|
+
}), this._documentInfoMap.set(s), a;
|
|
6769
6814
|
}
|
|
6770
6815
|
/**
|
|
6771
6816
|
* Returns a single arbitrary file path from the project's triplestore.
|
|
@@ -6829,6 +6874,38 @@ GROUP BY ?id ?contentIRI ?suffix ?size ?subject ?summary`, s = await this._api.s
|
|
|
6829
6874
|
a[c] = h, n[c] = h;
|
|
6830
6875
|
}), this._documentInfoMap.set(a), n;
|
|
6831
6876
|
}
|
|
6877
|
+
/** Executes a reduced document-info query (id/path/suffix/size only), merges
|
|
6878
|
+
* into `documentInfoMap`, and returns newly fetched entries. */
|
|
6879
|
+
async _fetchSimpleDocumentInfoBatch(t) {
|
|
6880
|
+
const e = t.map((n) => `r:${n}`).join(" "), o = `PREFIX qcy: <${b.qcy}>
|
|
6881
|
+
PREFIX r: <${this.baseURL}>
|
|
6882
|
+
SELECT ?id ?contentIRI ?suffix ?size (SAMPLE(?fp) AS ?path)
|
|
6883
|
+
WHERE {
|
|
6884
|
+
VALUES ?contentIRI { ${e} }
|
|
6885
|
+
?contentIRI qcy:sizeBytes ?size ;
|
|
6886
|
+
qcy:hasFileLocation ?loc .
|
|
6887
|
+
?loc qcy:filePath ?fp ;
|
|
6888
|
+
qcy:suffix ?suffix .
|
|
6889
|
+
BIND(REPLACE(STR(?contentIRI), "^.*/([^/]*)$", "$1") AS ?id)
|
|
6890
|
+
}
|
|
6891
|
+
GROUP BY ?id ?contentIRI ?suffix ?size`, r = await this._api.sparql(o, this._projectId, this._graphType), s = { ...this._documentInfoMap.get() }, a = {};
|
|
6892
|
+
return r.results.bindings.forEach((n) => {
|
|
6893
|
+
if (!n.id) return;
|
|
6894
|
+
const p = n.id.value, c = s[p], h = {
|
|
6895
|
+
id: p,
|
|
6896
|
+
contentIRI: n.contentIRI?.value ?? c?.contentIRI ?? p,
|
|
6897
|
+
path: n.path?.value ?? c?.path ?? p,
|
|
6898
|
+
suffix: n.suffix?.value ?? c?.suffix ?? "",
|
|
6899
|
+
size: n.size ? parseInt(n.size.value, 10) : c?.size ?? 0,
|
|
6900
|
+
tags: c?.tags ?? [],
|
|
6901
|
+
categories: c?.categories ?? [],
|
|
6902
|
+
subject: c?.subject,
|
|
6903
|
+
summary: c?.summary,
|
|
6904
|
+
providerId: c?.providerId
|
|
6905
|
+
};
|
|
6906
|
+
s[p] = h, a[p] = h;
|
|
6907
|
+
}), this._documentInfoMap.set(s), a;
|
|
6908
|
+
}
|
|
6832
6909
|
async _fetchDocumentsBySuffix() {
|
|
6833
6910
|
return this._runDocumentsBySuffixQuery(this._buildDocumentsBySuffixQuery());
|
|
6834
6911
|
}
|
|
@@ -6910,8 +6987,8 @@ WHERE {
|
|
|
6910
6987
|
}
|
|
6911
6988
|
}
|
|
6912
6989
|
class nr {
|
|
6913
|
-
constructor(t, e, { language: o, queryCache: r, rdfBase: s =
|
|
6914
|
-
this._api = t, this._projectId = e, this.schema = new ar(t, e, o, r, a), this.entities = new
|
|
6990
|
+
constructor(t, e, { language: o, queryCache: r, rdfBase: s = dt, graphType: a }) {
|
|
6991
|
+
this._api = t, this._projectId = e, this.schema = new ar(t, e, o, r, a), this.entities = new ce(t, e, s, r, a), this.documents = new pt(t, e, o, s, r, a), this.availableContentCategories = this.schema.availableContentCategories, this.availableEntityCategories = this.schema.availableEntityCategories, this.availableEntityRelationships = this.schema.availableEntityRelationships, this.schemaReady = this.schema.ready, this.entityInfoMap = this.entities.entityInfoMap, this.entityGraph = this.entities.entityGraph, this.documentInfoMap = this.documents.documentInfoMap, this.projectDocumentsData = this.documents.projectDocumentsData, this.searchResults = this._searchResults.asReadonly(), this.documents.fetchOverview().catch((n) => console.error("[CueProjectView] fetchOverview failed:", n));
|
|
6915
6992
|
}
|
|
6916
6993
|
_api;
|
|
6917
6994
|
_projectId;
|
|
@@ -7029,7 +7106,7 @@ class nr {
|
|
|
7029
7106
|
this._destroyed = !0, this._searchResults.set(void 0);
|
|
7030
7107
|
}
|
|
7031
7108
|
}
|
|
7032
|
-
function
|
|
7109
|
+
function Ht(i, t) {
|
|
7033
7110
|
return new Promise((e) => {
|
|
7034
7111
|
const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
7035
7112
|
for (const m of i)
|
|
@@ -7926,7 +8003,7 @@ const pr = {
|
|
|
7926
8003
|
}
|
|
7927
8004
|
};
|
|
7928
8005
|
l.AUDIO + "", l.VIDEO + "", l.IMAGE + "", l.TEXT + "", l.MARKUP + "", l.SCRIPT + "", l.DATA + "", l.ARCHIVE + "", l.INSTALLER + "", l.BINARY + "", l.BACKUP + "", l.AUTOMATION + "", l.PRESENTATION + "", l.SPREADSHEET + "", l.FONT + "", l.GEOSPATIAL + "", l.THREE_D + "", l.CAD + "", l.BIM + "", l.PLANNING + "", l.EMAIL + "", l.MULTIMEDIA + "", l.UNKNOWN + "";
|
|
7929
|
-
const { namedNode: lr, literal:
|
|
8006
|
+
const { namedNode: lr, literal: Cr } = j;
|
|
7930
8007
|
lr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
|
|
7931
8008
|
const { namedNode: Tr } = j, { namedNode: cr, literal: Sr } = j;
|
|
7932
8009
|
cr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
|
|
@@ -7938,7 +8015,7 @@ const { namedNode: dr, literal: Ar } = j;
|
|
|
7938
8015
|
dr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
|
|
7939
8016
|
const { namedNode: gr, literal: Rr } = j;
|
|
7940
8017
|
gr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
|
|
7941
|
-
function
|
|
8018
|
+
function Wt(i, t, e, o, r, s, a, n = !1, p = !1) {
|
|
7942
8019
|
const c = hr(i), h = D(o), d = `${t}/${h}${c}`;
|
|
7943
8020
|
a === void 0 && (a = pr[c]?.mime ?? "application/octet-stream");
|
|
7944
8021
|
const g = Ye(i, r);
|
|
@@ -7961,22 +8038,22 @@ function Ht(i, t, e, o, r, s, a, n = !1, p = !1) {
|
|
|
7961
8038
|
})
|
|
7962
8039
|
};
|
|
7963
8040
|
}
|
|
7964
|
-
async function
|
|
8041
|
+
async function M() {
|
|
7965
8042
|
return import(
|
|
7966
8043
|
/* webpackIgnore: true */
|
|
7967
8044
|
"fs/promises"
|
|
7968
8045
|
);
|
|
7969
8046
|
}
|
|
7970
|
-
async function
|
|
8047
|
+
async function Vt(i) {
|
|
7971
8048
|
if (typeof window < "u")
|
|
7972
8049
|
throw new Error(
|
|
7973
8050
|
`Cannot read file from path "${i}" in a browser environment. Provide file.data (Uint8Array) instead.`
|
|
7974
8051
|
);
|
|
7975
|
-
const { readFile: t } = await
|
|
8052
|
+
const { readFile: t } = await M();
|
|
7976
8053
|
return t(i);
|
|
7977
8054
|
}
|
|
7978
8055
|
let q = null, H = null, W = null;
|
|
7979
|
-
function
|
|
8056
|
+
function Or(i) {
|
|
7980
8057
|
W = i, H = null, q = null;
|
|
7981
8058
|
}
|
|
7982
8059
|
async function ur() {
|
|
@@ -7991,7 +8068,7 @@ async function ur() {
|
|
|
7991
8068
|
const t = new Uint8Array(await i.arrayBuffer()), o = await import(`${W}/dir_scanner_wasm.mjs`);
|
|
7992
8069
|
await o.default({ module_or_path: t }), q = o.scan;
|
|
7993
8070
|
} else {
|
|
7994
|
-
const { readFile: i } = await
|
|
8071
|
+
const { readFile: i } = await M(), { join: t } = await import(
|
|
7995
8072
|
/* webpackIgnore: true */
|
|
7996
8073
|
"path"
|
|
7997
8074
|
), { pathToFileURL: e } = await import(
|
|
@@ -8001,8 +8078,8 @@ async function ur() {
|
|
|
8001
8078
|
await a.default({ module_or_path: r }), q = a.scan;
|
|
8002
8079
|
}
|
|
8003
8080
|
}
|
|
8004
|
-
const mr = "qlever", $ = 1e3,
|
|
8005
|
-
async function
|
|
8081
|
+
const mr = "qlever", $ = 1e3, ut = "cue:pending:";
|
|
8082
|
+
async function mt(i) {
|
|
8006
8083
|
const { tmpdir: t } = await import(
|
|
8007
8084
|
/* webpackIgnore: true */
|
|
8008
8085
|
"os"
|
|
@@ -8012,33 +8089,33 @@ async function ut(i) {
|
|
|
8012
8089
|
);
|
|
8013
8090
|
return e(t(), `cue-sync-pending-${i}.json`);
|
|
8014
8091
|
}
|
|
8015
|
-
async function
|
|
8092
|
+
async function Kt(i) {
|
|
8016
8093
|
if (typeof window < "u") {
|
|
8017
|
-
const t = window.localStorage.getItem(`${
|
|
8094
|
+
const t = window.localStorage.getItem(`${ut}${i}`);
|
|
8018
8095
|
return t ? JSON.parse(t) : null;
|
|
8019
8096
|
}
|
|
8020
8097
|
try {
|
|
8021
|
-
const t = await (await
|
|
8098
|
+
const t = await (await M()).readFile(await mt(i), "utf-8");
|
|
8022
8099
|
return JSON.parse(t);
|
|
8023
8100
|
} catch {
|
|
8024
8101
|
return null;
|
|
8025
8102
|
}
|
|
8026
8103
|
}
|
|
8027
|
-
async function
|
|
8104
|
+
async function Qt(i) {
|
|
8028
8105
|
const t = JSON.stringify(i);
|
|
8029
8106
|
if (typeof window < "u") {
|
|
8030
|
-
window.localStorage.setItem(`${
|
|
8107
|
+
window.localStorage.setItem(`${ut}${i.spaceId}`, t);
|
|
8031
8108
|
return;
|
|
8032
8109
|
}
|
|
8033
|
-
await (await
|
|
8110
|
+
await (await M()).writeFile(await mt(i.spaceId), t, "utf-8");
|
|
8034
8111
|
}
|
|
8035
8112
|
async function wr(i) {
|
|
8036
8113
|
if (typeof window < "u") {
|
|
8037
|
-
window.localStorage.removeItem(`${
|
|
8114
|
+
window.localStorage.removeItem(`${ut}${i}`);
|
|
8038
8115
|
return;
|
|
8039
8116
|
}
|
|
8040
8117
|
try {
|
|
8041
|
-
await (await
|
|
8118
|
+
await (await M()).unlink(await mt(i));
|
|
8042
8119
|
} catch {
|
|
8043
8120
|
}
|
|
8044
8121
|
}
|
|
@@ -8098,7 +8175,7 @@ class fr {
|
|
|
8098
8175
|
*/
|
|
8099
8176
|
async flushPendingMetadata(t, e, o) {
|
|
8100
8177
|
this._legacy = o ?? !1;
|
|
8101
|
-
const r = await
|
|
8178
|
+
const r = await Kt(t);
|
|
8102
8179
|
if (!(!r || r.items.length === 0)) {
|
|
8103
8180
|
console.info(`Trying to upload metadata (${r.items.length} item(s))...`), e && console.info(`Flushing ${r.items.length} pending file location(s) from previous sync ⏳`);
|
|
8104
8181
|
try {
|
|
@@ -8121,20 +8198,20 @@ class fr {
|
|
|
8121
8198
|
this._api?.getConsumption(o) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance")),
|
|
8122
8199
|
this._fetchUnitCreditMap(s),
|
|
8123
8200
|
this._fetchTierNames()
|
|
8124
|
-
]), f = (await
|
|
8201
|
+
]), f = (await Ht(t, h)).localNotOnRemote ?? [], k = f.length > 0 ? await this.scanCost(f) : [];
|
|
8125
8202
|
let m = 0, E = 0;
|
|
8126
8203
|
for (const v of k) {
|
|
8127
8204
|
m += v.units;
|
|
8128
|
-
const y = g[c],
|
|
8205
|
+
const y = g[c], C = y?.[v.ext] ?? 1;
|
|
8129
8206
|
s && y && !(v.ext in y) && console.info(` Unknown format: .${v.ext} (using default rate of 1 credit/unit)`);
|
|
8130
|
-
const
|
|
8131
|
-
E +=
|
|
8207
|
+
const O = v.units * C;
|
|
8208
|
+
E += O, v.credits = Math.round(O);
|
|
8132
8209
|
}
|
|
8133
|
-
const
|
|
8210
|
+
const I = w[c] ?? c;
|
|
8134
8211
|
return {
|
|
8135
8212
|
costRecords: k,
|
|
8136
8213
|
tier: c,
|
|
8137
|
-
tierName:
|
|
8214
|
+
tierName: I,
|
|
8138
8215
|
unitsToConsume: m,
|
|
8139
8216
|
creditsToConsume: Math.round(E),
|
|
8140
8217
|
creditsAvailable: d.creditsAvailable,
|
|
@@ -8153,35 +8230,35 @@ class fr {
|
|
|
8153
8230
|
const [d, g] = await Promise.all([
|
|
8154
8231
|
this._listRemoteFiles(h, o, r, a),
|
|
8155
8232
|
this._api?.getConsumption(o) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance"))
|
|
8156
|
-
]), { unitsAvailable: w } = g, u = await
|
|
8233
|
+
]), { unitsAvailable: w } = g, u = await Ht(t, d);
|
|
8157
8234
|
a && (console.info(`Total local files: ${t.length}`), console.info(`Total remote files: ${d.length}`), console.info(
|
|
8158
8235
|
`Total files to sync: ${(u.localNotOnRemote?.length ?? 0) + u.localNotOnRemotePathOnly.length}`
|
|
8159
8236
|
));
|
|
8160
8237
|
let f = u.syncCount, k = u.syncSize, m = 0, E = !1;
|
|
8161
|
-
const
|
|
8162
|
-
if (
|
|
8163
|
-
const
|
|
8164
|
-
if (
|
|
8238
|
+
const I = u.localNotOnRemote ?? [];
|
|
8239
|
+
if (I.length > 0) {
|
|
8240
|
+
const C = (await this.scanCost(I)).reduce((O, de) => O + de.units, 0);
|
|
8241
|
+
if (C > w)
|
|
8165
8242
|
throw new Error(
|
|
8166
|
-
`Insufficient units: ${
|
|
8243
|
+
`Insufficient units: ${C} units required but only ${w} available.`
|
|
8167
8244
|
);
|
|
8168
8245
|
}
|
|
8169
|
-
await this._initPendingBatch(o, a), a &&
|
|
8170
|
-
for (const y of
|
|
8246
|
+
await this._initPendingBatch(o, a), a && I.length && console.info("Syncing missing files ⏳");
|
|
8247
|
+
for (const y of I)
|
|
8171
8248
|
try {
|
|
8172
|
-
const
|
|
8249
|
+
const C = Wt(
|
|
8173
8250
|
y.relativePath,
|
|
8174
8251
|
o,
|
|
8175
8252
|
s,
|
|
8176
8253
|
y.md5,
|
|
8177
8254
|
r
|
|
8178
8255
|
);
|
|
8179
|
-
if (!
|
|
8180
|
-
const
|
|
8256
|
+
if (!C.blob_name) throw new Error(`blob_name missing for ${y.relativePath}`);
|
|
8257
|
+
const O = y.data ?? new Uint8Array(await Vt(y.fullPath));
|
|
8181
8258
|
await this._blob.uploadRaw(
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8259
|
+
C.blob_name,
|
|
8260
|
+
O,
|
|
8261
|
+
C
|
|
8185
8262
|
), await this._queueFileLocation({
|
|
8186
8263
|
relativePath: y.relativePath,
|
|
8187
8264
|
md5: y.md5,
|
|
@@ -8189,8 +8266,8 @@ class fr {
|
|
|
8189
8266
|
providerId: r,
|
|
8190
8267
|
fileContentExists: !1
|
|
8191
8268
|
}), E = !0, f += 1, k += y.size || 0, this._logProgress(f, u.totalCount, k, u.totalSize, n);
|
|
8192
|
-
} catch (
|
|
8193
|
-
m += 1, console.error(`[CueSyncApi] Failed to upload file: ${y.fullPath}`), a && console.error("[CueSyncApi] Upload error details:",
|
|
8269
|
+
} catch (C) {
|
|
8270
|
+
m += 1, console.error(`[CueSyncApi] Failed to upload file: ${y.fullPath}`), a && console.error("[CueSyncApi] Upload error details:", C);
|
|
8194
8271
|
}
|
|
8195
8272
|
a && u.localNotOnRemotePathOnly.length && console.info(`Syncing missing file locations (on provider "${r}") ⏳`);
|
|
8196
8273
|
for (const y of u.localNotOnRemotePathOnly)
|
|
@@ -8216,7 +8293,7 @@ class fr {
|
|
|
8216
8293
|
async _getOrCreateGraph(t, e) {
|
|
8217
8294
|
const o = this._graphMap.get(t);
|
|
8218
8295
|
if (o) return o;
|
|
8219
|
-
const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? mr, a = s === "qlever" ? `${this._gatewayUrl}${
|
|
8296
|
+
const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? mr, a = s === "qlever" ? `${this._gatewayUrl}${oe}` : `${this._gatewayUrl}${ee}`, n = s === "qlever" ? `${this._gatewayUrl}${co}` : `${this._gatewayUrl}${po}`, p = new Ke({
|
|
8220
8297
|
graphType: s,
|
|
8221
8298
|
queryEndpoint: a,
|
|
8222
8299
|
updateEndpoint: n,
|
|
@@ -8282,7 +8359,7 @@ WHERE {
|
|
|
8282
8359
|
}
|
|
8283
8360
|
async _initPendingBatch(t, e) {
|
|
8284
8361
|
this._flushTimer !== null && (clearInterval(this._flushTimer), this._flushTimer = null), this._pendingSpaceId = t, this._pendingItems = [];
|
|
8285
|
-
const o = await
|
|
8362
|
+
const o = await Kt(t);
|
|
8286
8363
|
if (o && o.items.length > 0) {
|
|
8287
8364
|
console.info(`Trying to upload metadata from interrupted sync (${o.items.length} item(s))...`), e && console.info(`Flushing ${o.items.length} pending file location(s) from previous sync ⏳`);
|
|
8288
8365
|
try {
|
|
@@ -8303,7 +8380,7 @@ WHERE {
|
|
|
8303
8380
|
typeof r == "object" && typeof r.unref == "function" && r.unref(), this._flushTimer = r;
|
|
8304
8381
|
}
|
|
8305
8382
|
async _queueFileLocation(t) {
|
|
8306
|
-
this._pendingItems.push(t), this._pendingSpaceId && await
|
|
8383
|
+
this._pendingItems.push(t), this._pendingSpaceId && await Qt({ spaceId: this._pendingSpaceId, items: this._pendingItems });
|
|
8307
8384
|
}
|
|
8308
8385
|
/**
|
|
8309
8386
|
* Flush all queued file-location items to the commands API in a single batch.
|
|
@@ -8325,11 +8402,11 @@ WHERE {
|
|
|
8325
8402
|
o && console.info(`Wrote ${r.length} file location(s) to commands API ✅`);
|
|
8326
8403
|
} catch (s) {
|
|
8327
8404
|
const a = [...r, ...this._pendingItems];
|
|
8328
|
-
throw this._pendingItems = a, await
|
|
8405
|
+
throw this._pendingItems = a, await Qt({ spaceId: e, items: a }), s;
|
|
8329
8406
|
}
|
|
8330
8407
|
}
|
|
8331
8408
|
async _postFssBatch(t, e) {
|
|
8332
|
-
const o = this._legacy ? `${this._gatewayUrl}${
|
|
8409
|
+
const o = this._legacy ? `${this._gatewayUrl}${St}?blob=true` : `${this._gatewayUrl}${St}`;
|
|
8333
8410
|
let r;
|
|
8334
8411
|
try {
|
|
8335
8412
|
r = await this._auth.authenticatedFetch(o, {
|
|
@@ -8366,7 +8443,7 @@ WHERE {
|
|
|
8366
8443
|
s.map(async (p) => ({
|
|
8367
8444
|
originalPath: p.relativePath,
|
|
8368
8445
|
// Use pre-loaded data if available (browser), otherwise read from disk (Node.js).
|
|
8369
|
-
data: p.data ?? new Uint8Array(await
|
|
8446
|
+
data: p.data ?? new Uint8Array(await Vt(p.fullPath))
|
|
8370
8447
|
}))
|
|
8371
8448
|
), n = q(a);
|
|
8372
8449
|
for (const p of n) {
|
|
@@ -8426,7 +8503,7 @@ WHERE {
|
|
|
8426
8503
|
const { spaceId: o, providerId: r, userId: s, signal: a, onProgress: n } = e;
|
|
8427
8504
|
if (!t.data)
|
|
8428
8505
|
throw new Error("syncBrowserFile requires file.data (Uint8Array). Read the file with File.arrayBuffer() first.");
|
|
8429
|
-
const p =
|
|
8506
|
+
const p = Wt(t.relativePath, o, s, t.md5, r);
|
|
8430
8507
|
if (!p.blob_name) throw new Error(`blob_name missing for ${t.relativePath}`);
|
|
8431
8508
|
await this._blob.uploadRaw(
|
|
8432
8509
|
p.blob_name,
|
|
@@ -8470,7 +8547,7 @@ WHERE {
|
|
|
8470
8547
|
s({ percent: a, syncCount: t, totalCount: e, syncSize: o, totalSize: r });
|
|
8471
8548
|
}
|
|
8472
8549
|
}
|
|
8473
|
-
const
|
|
8550
|
+
const Xt = {
|
|
8474
8551
|
production: {
|
|
8475
8552
|
gatewayUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app",
|
|
8476
8553
|
tokenUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app/token",
|
|
@@ -8504,6 +8581,7 @@ class he {
|
|
|
8504
8581
|
_storageRaw;
|
|
8505
8582
|
_storageProcessed;
|
|
8506
8583
|
_gis = null;
|
|
8584
|
+
_projectDocuments = /* @__PURE__ */ new Map();
|
|
8507
8585
|
/**
|
|
8508
8586
|
* Reactive GIS service. Lazily constructed on first access.
|
|
8509
8587
|
*
|
|
@@ -8526,21 +8604,21 @@ class he {
|
|
|
8526
8604
|
"Using default SDK app settings. Contact QAECY for your own configuration for any production code."
|
|
8527
8605
|
);
|
|
8528
8606
|
const o = t.apiKey ?? Y.apiKey, r = t.appId ?? Y.appId, s = t.measurementId ?? Y.measurementId, a = t.environment ?? "production";
|
|
8529
|
-
this._endpoints = { ...
|
|
8607
|
+
this._endpoints = { ...Xt[a], ...t.endpoints }, this._isEmulator = a === "emulator", this._app = ge().find((p) => p.name === "[DEFAULT]") ?? ue({
|
|
8530
8608
|
apiKey: o,
|
|
8531
8609
|
appId: r,
|
|
8532
8610
|
measurementId: s,
|
|
8533
|
-
authDomain: `${
|
|
8534
|
-
projectId:
|
|
8611
|
+
authDomain: `${_t}.firebaseapp.com`,
|
|
8612
|
+
projectId: _t,
|
|
8535
8613
|
messagingSenderId: Ze
|
|
8536
|
-
}), this.auth = new
|
|
8614
|
+
}), this.auth = new Ot(this._app, this._isEmulator, this._endpoints), this.projects = new zt(this.auth, this._app, this._isEmulator, this._endpoints), this._storageRaw = T(this._app, Et), this._storageProcessed = T(this._app, xt), this._isEmulator && (K(this._storageRaw, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), K(this._storageProcessed, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort)), this.api = this._buildApi(this.projects), this.storage = new Pt(this._storageRaw, this._storageProcessed), this.profile = new Nt(
|
|
8537
8615
|
this.auth,
|
|
8538
8616
|
this._app,
|
|
8539
8617
|
this._isEmulator,
|
|
8540
8618
|
this._endpoints.gatewayUrl
|
|
8541
|
-
), this.privileges = new
|
|
8542
|
-
const n = T(this._app,
|
|
8543
|
-
this._isEmulator && K(n, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new
|
|
8619
|
+
), this.privileges = new Bt(this.auth.isSuperAdmin);
|
|
8620
|
+
const n = T(this._app, It);
|
|
8621
|
+
this._isEmulator && K(n, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new Gt(n);
|
|
8544
8622
|
}
|
|
8545
8623
|
/**
|
|
8546
8624
|
* Create a `Cue` instance from an already-initialized Firebase app.
|
|
@@ -8559,16 +8637,16 @@ class he {
|
|
|
8559
8637
|
* });
|
|
8560
8638
|
*/
|
|
8561
8639
|
static fromApp(t, e = {}) {
|
|
8562
|
-
const o = e.environment ?? "production", r = { ...
|
|
8640
|
+
const o = e.environment ?? "production", r = { ...Xt[o], ...e.endpoints }, s = new Ot(t, !1, r), a = new zt(s, t, !1, r), n = T(t, Et), p = T(t, xt), c = T(t, eo), h = T(t, to), d = T(t, Je), g = T(t, It), w = new Qe({
|
|
8563
8641
|
storageRaw: n,
|
|
8564
8642
|
storageProcessed: p,
|
|
8565
8643
|
storagePublic: c,
|
|
8566
8644
|
storageLogs: h,
|
|
8567
8645
|
storageChatSessions: d,
|
|
8568
8646
|
storagePersistence: g
|
|
8569
|
-
}), u = new fr(s, a, w, r.gatewayUrl), f = new
|
|
8647
|
+
}), u = new fr(s, a, w, r.gatewayUrl), f = new Dt(s, r.gatewayUrl, a, u);
|
|
8570
8648
|
u._bindApi(f);
|
|
8571
|
-
const k = new
|
|
8649
|
+
const k = new Nt(s, t, !1, r.gatewayUrl), m = Object.create(he.prototype), E = new Bt(s.isSuperAdmin), I = new Gt(g), v = new Pt(n, p);
|
|
8572
8650
|
return Object.assign(m, {
|
|
8573
8651
|
_app: t,
|
|
8574
8652
|
_endpoints: r,
|
|
@@ -8580,13 +8658,13 @@ class he {
|
|
|
8580
8658
|
projects: a,
|
|
8581
8659
|
profile: k,
|
|
8582
8660
|
privileges: E,
|
|
8583
|
-
cache:
|
|
8661
|
+
cache: I,
|
|
8584
8662
|
storage: v
|
|
8585
8663
|
}), m;
|
|
8586
8664
|
}
|
|
8587
8665
|
/** Override in subclasses to provide a custom CueApi (e.g. with sync). */
|
|
8588
8666
|
_buildApi(t) {
|
|
8589
|
-
return new
|
|
8667
|
+
return new Dt(this.auth, this._endpoints.gatewayUrl, t);
|
|
8590
8668
|
}
|
|
8591
8669
|
/** Convenience: get the current user's Firebase ID token */
|
|
8592
8670
|
getToken(t = !1) {
|
|
@@ -8635,7 +8713,7 @@ class he {
|
|
|
8635
8713
|
get: (r) => this.cache.getQueryCache(t, r).then((s) => s?.results),
|
|
8636
8714
|
set: (r, s) => this.cache.setQueryCache(t, r, { query: r, results: s })
|
|
8637
8715
|
};
|
|
8638
|
-
return new
|
|
8716
|
+
return new ce(
|
|
8639
8717
|
this.api,
|
|
8640
8718
|
t,
|
|
8641
8719
|
e?.rdfBase,
|
|
@@ -8658,16 +8736,33 @@ class he {
|
|
|
8658
8736
|
* ```
|
|
8659
8737
|
*/
|
|
8660
8738
|
createProjectDocuments(t, e) {
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8739
|
+
if (!(e?.language !== void 0 || e?.rdfBase !== void 0 || e?.graphType !== void 0 || e?.queryCache !== void 0)) {
|
|
8740
|
+
const s = this._projectDocuments.get(t);
|
|
8741
|
+
if (s)
|
|
8742
|
+
return s.setLanguage(this.api.language), s;
|
|
8743
|
+
const a = {
|
|
8744
|
+
get: (p) => this.cache.getQueryCache(t, p).then((c) => c?.results),
|
|
8745
|
+
set: (p, c) => this.cache.setQueryCache(t, p, { query: p, results: c })
|
|
8746
|
+
}, n = new pt(
|
|
8747
|
+
this.api,
|
|
8748
|
+
t,
|
|
8749
|
+
this.api.language,
|
|
8750
|
+
void 0,
|
|
8751
|
+
a,
|
|
8752
|
+
void 0
|
|
8753
|
+
);
|
|
8754
|
+
return this._projectDocuments.set(t, n), n;
|
|
8755
|
+
}
|
|
8756
|
+
const r = e?.queryCache ?? {
|
|
8757
|
+
get: (s) => this.cache.getQueryCache(t, s).then((a) => a?.results),
|
|
8758
|
+
set: (s, a) => this.cache.setQueryCache(t, s, { query: s, results: a })
|
|
8664
8759
|
};
|
|
8665
|
-
return new
|
|
8760
|
+
return new pt(
|
|
8666
8761
|
this.api,
|
|
8667
8762
|
t,
|
|
8668
|
-
e?.language,
|
|
8763
|
+
e?.language ?? this.api.language,
|
|
8669
8764
|
e?.rdfBase,
|
|
8670
|
-
|
|
8765
|
+
r,
|
|
8671
8766
|
e?.graphType
|
|
8672
8767
|
);
|
|
8673
8768
|
}
|
|
@@ -8675,27 +8770,27 @@ class he {
|
|
|
8675
8770
|
export {
|
|
8676
8771
|
Je as B,
|
|
8677
8772
|
he as C,
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8773
|
+
Ft as R,
|
|
8774
|
+
Dt as a,
|
|
8775
|
+
Ot as b,
|
|
8776
|
+
Gt as c,
|
|
8682
8777
|
or as d,
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8778
|
+
Bt as e,
|
|
8779
|
+
Nt as f,
|
|
8780
|
+
pt as g,
|
|
8781
|
+
ce as h,
|
|
8687
8782
|
ar as i,
|
|
8688
8783
|
nr as j,
|
|
8689
|
-
|
|
8784
|
+
zt as k,
|
|
8690
8785
|
x as l,
|
|
8691
8786
|
Pt as m,
|
|
8692
8787
|
fr as n,
|
|
8693
8788
|
mo as o,
|
|
8694
|
-
|
|
8695
|
-
|
|
8789
|
+
Or as p,
|
|
8790
|
+
ct as q,
|
|
8696
8791
|
to as r,
|
|
8697
|
-
|
|
8698
|
-
|
|
8792
|
+
ht as s,
|
|
8793
|
+
It as t,
|
|
8699
8794
|
eo as u,
|
|
8700
8795
|
Qe as v
|
|
8701
8796
|
};
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as s, a as u, b as C, c as i, d as t, e as c, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as S, n as g, o as h, R as p, p as R, q as f, s as E } from "./cue-
|
|
1
|
+
import { C as s, a as u, b as C, c as i, d as t, e as c, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as S, n as g, o as h, R as p, p as R, q as f, s as E } from "./cue-D52ik-Oy.js";
|
|
2
2
|
export {
|
|
3
3
|
s as Cue,
|
|
4
4
|
u as CueApi,
|
package/lib/cue.d.ts
CHANGED
package/lib/documents.d.ts
CHANGED
|
@@ -90,6 +90,16 @@ export declare class CueProjectDocuments {
|
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
92
|
fetchDocumentData(uuids: string[]): Promise<Record<string, DocumentInfo>>;
|
|
93
|
+
/**
|
|
94
|
+
* Fetches a lightweight document metadata shape (id/path/suffix/size) for
|
|
95
|
+
* the given UUIDs and merges the results into `documentInfoMap`.
|
|
96
|
+
*
|
|
97
|
+
* This is useful for list/table contexts that do not need language-tagged
|
|
98
|
+
* fields (`subject`, `summary`) or category/tag enrichment.
|
|
99
|
+
*
|
|
100
|
+
* UUIDs already present in `documentInfoMap` are skipped.
|
|
101
|
+
*/
|
|
102
|
+
fetchDocumentDataSimple(uuids: string[]): Promise<Record<string, DocumentInfo>>;
|
|
93
103
|
/**
|
|
94
104
|
* Returns the alternative representations of the given document UUID.
|
|
95
105
|
*
|
|
@@ -115,6 +125,9 @@ export declare class CueProjectDocuments {
|
|
|
115
125
|
/** Executes the document-info SPARQL query for the given UUIDs, merges results
|
|
116
126
|
* into `documentInfoMap`, and returns the newly fetched entries. */
|
|
117
127
|
private _fetchDocumentInfoBatch;
|
|
128
|
+
/** Executes a reduced document-info query (id/path/suffix/size only), merges
|
|
129
|
+
* into `documentInfoMap`, and returns newly fetched entries. */
|
|
130
|
+
private _fetchSimpleDocumentInfoBatch;
|
|
118
131
|
private _fetchDocumentsBySuffix;
|
|
119
132
|
private _buildDocumentsBySuffixQuery;
|
|
120
133
|
private _runDocumentsBySuffixQuery;
|
package/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as h, B as l, r as _, t as S, u as E, n as m, v as P, a as d } from "./cue-
|
|
2
|
-
import { b as j, c as y, d as I, e as K, f as L, g as v, h as x, i as H, j as N, k as O, l as D, m as G, o as W, R as k, p as q, q as Q, s as V } from "./cue-
|
|
1
|
+
import { C as h, B as l, r as _, t as S, u as E, n as m, v as P, a as d } from "./cue-D52ik-Oy.js";
|
|
2
|
+
import { b as j, c as y, d as I, e as K, f as L, g as v, h as x, i as H, j as N, k as O, l as D, m as G, o as W, R as k, p as q, q as Q, s as V } from "./cue-D52ik-Oy.js";
|
|
3
3
|
import { getStorage as e, connectStorageEmulator as b } from "firebase/storage";
|
|
4
4
|
import "firebase/firestore";
|
|
5
5
|
class A extends h {
|