@qaecy/cue-sdk 0.0.5 → 0.0.8
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/PORTAL_MIGRATION.md +346 -0
- package/README.md +50 -3
- package/cue-BIvMahsX.js +3553 -0
- package/index.d.ts +13 -1
- package/index.js +15 -3
- package/lib/api.d.ts +1 -2
- package/lib/auth.d.ts +41 -2
- package/lib/cache.d.ts +26 -0
- package/lib/cue.d.ts +42 -2
- package/lib/documents.d.ts +84 -0
- package/lib/entities.d.ts +107 -0
- package/lib/models.d.ts +201 -9
- package/lib/privileges.d.ts +53 -0
- package/lib/profile.d.ts +22 -5
- package/lib/project-view.d.ts +107 -0
- package/lib/project.d.ts +17 -2
- package/lib/schema.d.ts +66 -0
- package/lib/signal.d.ts +54 -0
- package/lib/sync.d.ts +79 -0
- package/node.js +45 -302
- package/package.json +1 -1
- package/variables.d.ts +40 -0
- package/cue-y-t8nSnt.js +0 -353
package/lib/sync.d.ts
CHANGED
|
@@ -4,6 +4,15 @@ import { CueAuth } from './auth';
|
|
|
4
4
|
import { CueApi } from './api';
|
|
5
5
|
import { CueProjects } from './project';
|
|
6
6
|
import { ScanOutputRecord, SyncOptions, SyncPreview, SyncResult } from './models';
|
|
7
|
+
/**
|
|
8
|
+
* Configure the URL from which the WASM scanner assets are loaded in browser environments.
|
|
9
|
+
* Call this once during app initialisation (e.g. Angular APP_INITIALIZER) before any credit
|
|
10
|
+
* calculations are requested.
|
|
11
|
+
*
|
|
12
|
+
* @param baseUrl - URL prefix for `dir_scanner_wasm_bg.wasm` and `dir_scanner_wasm.mjs`,
|
|
13
|
+
* e.g. `'/assets/wasm'` or `'https://cdn.example.com/wasm'`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function configureScanWasm(baseUrl: string): void;
|
|
7
16
|
export declare class CueSyncApi {
|
|
8
17
|
private readonly _auth;
|
|
9
18
|
private readonly _projects;
|
|
@@ -14,9 +23,33 @@ export declare class CueSyncApi {
|
|
|
14
23
|
private _pendingItems;
|
|
15
24
|
private _pendingSpaceId;
|
|
16
25
|
private _flushTimer;
|
|
26
|
+
private _legacy;
|
|
17
27
|
constructor(_auth: CueAuth, _projects: CueProjects, _blob: CueBlobStorage, _gatewayUrl: string);
|
|
18
28
|
/** @internal Injected by CueApi after construction to avoid circular dependency. */
|
|
19
29
|
_bindApi(api: CueApi): void;
|
|
30
|
+
/**
|
|
31
|
+
* Initialises browser-mode sync for a project space.
|
|
32
|
+
* - Flushes any metadata items that were queued but not sent in a previous session
|
|
33
|
+
* (persisted in `localStorage`).
|
|
34
|
+
* - Starts the 60-second periodic flush timer.
|
|
35
|
+
*
|
|
36
|
+
* Call this once when the file manager component is created (or when the active
|
|
37
|
+
* project changes) so that interrupted uploads are recovered immediately.
|
|
38
|
+
*/
|
|
39
|
+
initBrowserSync(spaceId: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Pushes filesystem-structure metadata for all provided files directly to the
|
|
42
|
+
* commands API, without checking what is already on the remote or accounting for
|
|
43
|
+
* credits. Use this when you want to force-write metadata for every file in a
|
|
44
|
+
* local path (e.g. to repair missing graph data after a migration).
|
|
45
|
+
*/
|
|
46
|
+
pushAllMetadata(localFiles: LocalFile[], options: Pick<SyncOptions, 'spaceId' | 'providerId' | 'verbose' | 'legacy'>): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Flushes any pending file-location metadata from a previously interrupted sync.
|
|
49
|
+
* Safe to call even when there are no new files to upload (e.g. when the process
|
|
50
|
+
* died after uploading to blob storage but before the commands-API batch POST).
|
|
51
|
+
*/
|
|
52
|
+
flushPendingMetadata(spaceId: string, verbose?: boolean, legacy?: boolean): Promise<void>;
|
|
20
53
|
/**
|
|
21
54
|
* Returns a preview of what would be synced: cost breakdown for new files only,
|
|
22
55
|
* units required, and units still available. Use this before calling {@link sync}
|
|
@@ -29,6 +62,12 @@ export declare class CueSyncApi {
|
|
|
29
62
|
private _getGraphFiles;
|
|
30
63
|
private _initPendingBatch;
|
|
31
64
|
private _queueFileLocation;
|
|
65
|
+
/**
|
|
66
|
+
* Flush all queued file-location items to the commands API in a single batch.
|
|
67
|
+
* Call this once after a group of `syncBrowserFile` calls completes so that
|
|
68
|
+
* all items are sent together rather than one POST per file.
|
|
69
|
+
*/
|
|
70
|
+
drainPending(): Promise<void>;
|
|
32
71
|
private _drainPending;
|
|
33
72
|
private _flushBatch;
|
|
34
73
|
private _postFssBatch;
|
|
@@ -41,5 +80,45 @@ export declare class CueSyncApi {
|
|
|
41
80
|
* shown to the user before or after calling {@link sync}.
|
|
42
81
|
*/
|
|
43
82
|
scanCost(localFiles: LocalFile[]): Promise<ScanOutputRecord[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Compute the credit cost for a set of local files without uploading anything.
|
|
85
|
+
* Intended for browser use where the full {@link previewSync} (which requires a
|
|
86
|
+
* remote file listing) would be too heavy for a quick estimate.
|
|
87
|
+
*
|
|
88
|
+
* @param localFiles - Files to analyse. Each entry must carry `data` when
|
|
89
|
+
* called from a browser context.
|
|
90
|
+
* @param spaceId - Project/space identifier used to fetch the tier settings.
|
|
91
|
+
* @returns Per-extension cost breakdown and the number of credits currently
|
|
92
|
+
* available in the project.
|
|
93
|
+
*/
|
|
94
|
+
computeCredits(localFiles: LocalFile[], spaceId: string): Promise<{
|
|
95
|
+
costRecords: ScanOutputRecord[];
|
|
96
|
+
creditsToConsume: number;
|
|
97
|
+
creditsAvailable: number;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Upload a single browser-supplied file and write its metadata to the knowledge graph.
|
|
101
|
+
*
|
|
102
|
+
* Unlike {@link sync} (which performs a full remote comparison), this method is
|
|
103
|
+
* designed for the web file-manager flow where the user has already confirmed the
|
|
104
|
+
* upload via the credit modal. The file's binary data must be provided in
|
|
105
|
+
* `file.data`; the `file.fullPath` field is ignored.
|
|
106
|
+
*
|
|
107
|
+
* Cancellation is supported via `options.signal`. Aborting the signal cancels
|
|
108
|
+
* the Firebase Storage upload; metadata is never written for a cancelled upload.
|
|
109
|
+
*
|
|
110
|
+
* @param file - `LocalFile` with `data` populated (e.g. from `File.arrayBuffer()`).
|
|
111
|
+
* @param options - Upload options including project/provider/user context and an
|
|
112
|
+
* optional `AbortSignal` for cancellation and `onProgress` for tracking.
|
|
113
|
+
*/
|
|
114
|
+
syncBrowserFile(file: LocalFile, options: {
|
|
115
|
+
spaceId: string;
|
|
116
|
+
providerId: string;
|
|
117
|
+
userId: string;
|
|
118
|
+
signal?: AbortSignal;
|
|
119
|
+
onProgress?: (percent: number) => void;
|
|
120
|
+
}): Promise<void>;
|
|
121
|
+
private _fetchTierNames;
|
|
122
|
+
private _fetchUnitCreditMap;
|
|
44
123
|
private _logProgress;
|
|
45
124
|
}
|
package/node.js
CHANGED
|
@@ -1,312 +1,55 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { b as
|
|
3
|
-
import { getStorage as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import { join as y } from "path";
|
|
7
|
-
import { pathToFileURL as j } from "url";
|
|
8
|
-
import { tmpdir as x } from "os";
|
|
9
|
-
import { compareLocalRemote as A } from "js-sync-tools";
|
|
10
|
-
import { uploadedFileMetadata as L } from "js-file-metadata-helpers";
|
|
11
|
-
import { qaecyPrefixes as M } from "js/prefixes";
|
|
12
|
-
let C = null, $ = null;
|
|
13
|
-
async function k() {
|
|
14
|
-
const c = y(__dirname, "assets", "wasm"), t = await P(y(c, "dir_scanner_wasm_bg.wasm")), e = await import(j(y(c, "dir_scanner_wasm.mjs")).href);
|
|
15
|
-
await e.default({ module_or_path: t }), C = e.scan;
|
|
16
|
-
}
|
|
17
|
-
const H = "fuseki", G = "/triplestore/query", W = "/sparql/query", K = "/triplestore/update", J = "/sparql/update", Q = "/commands/file-system-structure/batch", F = 1e3, I = "cue:pending:";
|
|
18
|
-
function U(c) {
|
|
19
|
-
return y(x(), `cue-sync-pending-${c}.json`);
|
|
20
|
-
}
|
|
21
|
-
async function Y(c) {
|
|
22
|
-
if (typeof window < "u") {
|
|
23
|
-
const t = window.localStorage.getItem(`${I}${c}`);
|
|
24
|
-
return t ? JSON.parse(t) : null;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
const t = await P(U(c), "utf-8");
|
|
28
|
-
return JSON.parse(t);
|
|
29
|
-
} catch {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function N(c) {
|
|
34
|
-
const t = JSON.stringify(c);
|
|
35
|
-
if (typeof window < "u") {
|
|
36
|
-
window.localStorage.setItem(`${I}${c.spaceId}`, t);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
await B(U(c.spaceId), t, "utf-8");
|
|
40
|
-
}
|
|
41
|
-
async function V(c) {
|
|
42
|
-
if (typeof window < "u") {
|
|
43
|
-
window.localStorage.removeItem(`${I}${c}`);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
await D(U(c));
|
|
48
|
-
} catch {
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
class X {
|
|
52
|
-
constructor(t, o, e, i) {
|
|
53
|
-
this._auth = t, this._projects = o, this._blob = e, this._gatewayUrl = i;
|
|
54
|
-
}
|
|
55
|
-
_auth;
|
|
56
|
-
_projects;
|
|
57
|
-
_blob;
|
|
58
|
-
_gatewayUrl;
|
|
59
|
-
_graphMap = /* @__PURE__ */ new Map();
|
|
60
|
-
_api;
|
|
61
|
-
_pendingItems = [];
|
|
62
|
-
_pendingSpaceId = null;
|
|
63
|
-
_flushTimer = null;
|
|
64
|
-
/** @internal Injected by CueApi after construction to avoid circular dependency. */
|
|
65
|
-
_bindApi(t) {
|
|
66
|
-
this._api = t;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Returns a preview of what would be synced: cost breakdown for new files only,
|
|
70
|
-
* units required, and units still available. Use this before calling {@link sync}
|
|
71
|
-
* to show the user an accurate cost estimate.
|
|
72
|
-
*/
|
|
73
|
-
async previewSync(t, o) {
|
|
74
|
-
const { spaceId: e, providerId: i, verbose: s } = o, n = await this._auth.getToken();
|
|
75
|
-
if (!n) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
|
|
76
|
-
const r = await this._getOrCreateGraph(e, n), [a, l] = await Promise.all([
|
|
77
|
-
this._listRemoteFiles(r, e, i, s),
|
|
78
|
-
this._api?.getConsumption(e) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance"))
|
|
79
|
-
]), p = (await A(t, a)).localNotOnRemote ?? [], h = p.length > 0 ? await this.scanCost(p) : [], _ = h.reduce((g, m) => g + m.units, 0);
|
|
80
|
-
return {
|
|
81
|
-
costRecords: h,
|
|
82
|
-
unitsToConsume: _,
|
|
83
|
-
unitsAvailable: l.unitsAvailable,
|
|
84
|
-
filesToUpload: p.length,
|
|
85
|
-
totalLocalFiles: t.length
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
async sync(t, o) {
|
|
89
|
-
const { spaceId: e, providerId: i, userId: s, verbose: n } = o, r = await this._auth.getToken();
|
|
90
|
-
if (!r) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
|
|
91
|
-
const a = await this._getOrCreateGraph(e, r);
|
|
92
|
-
n && console.info("Listing remote files ⏳");
|
|
93
|
-
const [l, d] = await Promise.all([
|
|
94
|
-
this._listRemoteFiles(a, e, i, n),
|
|
95
|
-
this._api?.getConsumption(e) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance"))
|
|
96
|
-
]), { unitsAvailable: p } = d, h = await A(t, l);
|
|
97
|
-
n && (console.info(`Total local files: ${t.length}`), console.info(`Total remote files: ${l.length}`), console.info(
|
|
98
|
-
`Total files to sync: ${(h.localNotOnRemote?.length ?? 0) + h.localNotOnRemotePathOnly.length}`
|
|
99
|
-
));
|
|
100
|
-
let _ = h.syncCount, g = h.syncSize, m = 0, S = !1;
|
|
101
|
-
const w = h.localNotOnRemote ?? [];
|
|
102
|
-
if (w.length > 0) {
|
|
103
|
-
const f = (await this.scanCost(w)).reduce((E, R) => E + R.units, 0);
|
|
104
|
-
if (f > p)
|
|
105
|
-
throw new Error(
|
|
106
|
-
`Insufficient units: ${f} units required but only ${p} available.`
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
await this._initPendingBatch(e, r, n), n && w.length && console.info("Syncing missing files ⏳");
|
|
110
|
-
for (const u of w)
|
|
111
|
-
try {
|
|
112
|
-
const f = L(
|
|
113
|
-
u.relativePath,
|
|
114
|
-
e,
|
|
115
|
-
s,
|
|
116
|
-
u.md5,
|
|
117
|
-
i
|
|
118
|
-
);
|
|
119
|
-
if (!f.blob_name) throw new Error(`blob_name missing for ${u.relativePath}`);
|
|
120
|
-
const E = await P(u.fullPath);
|
|
121
|
-
await this._blob.uploadRaw(
|
|
122
|
-
f.blob_name,
|
|
123
|
-
new Uint8Array(E),
|
|
124
|
-
f
|
|
125
|
-
), await this._queueFileLocation({
|
|
126
|
-
relativePath: u.relativePath,
|
|
127
|
-
md5: u.md5,
|
|
128
|
-
size: u.size,
|
|
129
|
-
providerId: i,
|
|
130
|
-
fileContentExists: !1
|
|
131
|
-
}), S = !0, _ += 1, g += u.size || 0, this._logProgress(_, h.totalCount, g, h.totalSize, n);
|
|
132
|
-
} catch (f) {
|
|
133
|
-
m += 1, console.error(`[CueSyncApi] Failed to upload file: ${u.fullPath}`), n && console.error("[CueSyncApi] Upload error details:", f);
|
|
134
|
-
}
|
|
135
|
-
n && h.localNotOnRemotePathOnly.length && console.info(`Syncing missing file locations (on provider "${i}") ⏳`);
|
|
136
|
-
for (const u of h.localNotOnRemotePathOnly)
|
|
137
|
-
await this._queueFileLocation({
|
|
138
|
-
relativePath: u.relativePath,
|
|
139
|
-
md5: u.md5,
|
|
140
|
-
size: u.size,
|
|
141
|
-
providerId: i,
|
|
142
|
-
fileContentExists: !0
|
|
143
|
-
}), S = !0, _ += 1, g += u.size || 0, this._logProgress(_, h.totalCount, g, h.totalSize, n);
|
|
144
|
-
return await this._drainPending(n), this._stopFlushTimer(), {
|
|
145
|
-
syncCount: _,
|
|
146
|
-
syncSize: g,
|
|
147
|
-
failedUploads: m,
|
|
148
|
-
totalCount: h.totalCount,
|
|
149
|
-
totalSize: h.totalSize,
|
|
150
|
-
rdfWritten: S
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
async _getOrCreateGraph(t, o) {
|
|
154
|
-
const e = this._graphMap.get(t);
|
|
155
|
-
if (e) return e;
|
|
156
|
-
const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? H, n = s === "qlever" ? `${this._gatewayUrl}${W}` : `${this._gatewayUrl}${G}`, r = s === "qlever" ? `${this._gatewayUrl}${J}` : `${this._gatewayUrl}${K}`, a = new q({
|
|
157
|
-
graphType: s,
|
|
158
|
-
queryEndpoint: n,
|
|
159
|
-
updateEndpoint: r,
|
|
160
|
-
originalHeaders: {
|
|
161
|
-
"x-project-id": t,
|
|
162
|
-
authorization: `Bearer ${o}`
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
return this._graphMap.set(t, a), a;
|
|
166
|
-
}
|
|
167
|
-
async _listRemoteFiles(t, o, e, i) {
|
|
168
|
-
i && console.info(`Listing files in raw space: ${o}`);
|
|
169
|
-
const [s, n] = await Promise.all([
|
|
170
|
-
this._blob.listRaw(o),
|
|
171
|
-
this._getGraphFiles(t, e)
|
|
172
|
-
]);
|
|
173
|
-
i && console.info(`Found ${s.length} files in raw store for space: ${o}`);
|
|
174
|
-
const r = [];
|
|
175
|
-
for (const a of s) {
|
|
176
|
-
const l = a.substring(0, 36), d = n[l] ?? [];
|
|
177
|
-
if (d.length === 0)
|
|
178
|
-
i && console.warn(`No location data found for contentUUID: ${l}`), r.push({ contentUUID: l });
|
|
179
|
-
else
|
|
180
|
-
for (const p of d)
|
|
181
|
-
r.push({
|
|
182
|
-
contentUUID: l,
|
|
183
|
-
locationUUID: p.locationUUID,
|
|
184
|
-
created: p.created,
|
|
185
|
-
size: p.size
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
return r;
|
|
189
|
-
}
|
|
190
|
-
async _getGraphFiles(t, o) {
|
|
191
|
-
const e = `PREFIX qcy: <${M.qcy}>
|
|
192
|
-
SELECT ?fc ?loc ?created ?fp ?size
|
|
193
|
-
WHERE {
|
|
194
|
-
?fc a qcy:FileContent ;
|
|
195
|
-
qcy:sizeBytes ?size ;
|
|
196
|
-
qcy:hasFileLocation ?loc .
|
|
197
|
-
?loc qcy:remoteProviderId "${o}" ;
|
|
198
|
-
qcy:dateCreated ?created ;
|
|
199
|
-
qcy:filePath ?fp .
|
|
200
|
-
}`, i = await t.query(e, "application/sparql-results+json"), s = {};
|
|
201
|
-
if (typeof i == "string") return s;
|
|
202
|
-
for (const n of i.results.bindings) {
|
|
203
|
-
const r = n.loc.value.split("/").at(-1) ?? "", a = n.fc.value.split("/").at(-1) ?? "", l = n.created.value, d = n.size.value;
|
|
204
|
-
s[a] || (s[a] = []), s[a].push({ locationUUID: r, created: l, size: d });
|
|
205
|
-
}
|
|
206
|
-
return s;
|
|
207
|
-
}
|
|
208
|
-
async _initPendingBatch(t, o, e) {
|
|
209
|
-
this._pendingSpaceId = t, this._pendingItems = [];
|
|
210
|
-
const i = await Y(t);
|
|
211
|
-
i && i.items.length > 0 && (e && console.info(`Flushing ${i.items.length} pending file location(s) from previous sync ⏳`), await this._flushBatch(i.items, t, o, e));
|
|
212
|
-
const s = setInterval(() => {
|
|
213
|
-
this._drainPending(e).catch(
|
|
214
|
-
(n) => console.error("[CueSyncApi] Periodic flush failed:", n)
|
|
215
|
-
);
|
|
216
|
-
}, 6e4);
|
|
217
|
-
typeof s == "object" && typeof s.unref == "function" && s.unref(), this._flushTimer = s;
|
|
218
|
-
}
|
|
219
|
-
async _queueFileLocation(t) {
|
|
220
|
-
this._pendingItems.push(t), this._pendingSpaceId && await N({ spaceId: this._pendingSpaceId, items: this._pendingItems });
|
|
221
|
-
}
|
|
222
|
-
async _drainPending(t) {
|
|
223
|
-
if (!this._pendingSpaceId || this._pendingItems.length === 0) return;
|
|
224
|
-
const o = await this._auth.getToken();
|
|
225
|
-
o && await this._flushBatch(this._pendingItems, this._pendingSpaceId, o, t);
|
|
226
|
-
}
|
|
227
|
-
async _flushBatch(t, o, e, i) {
|
|
228
|
-
const s = [...t];
|
|
229
|
-
this._pendingSpaceId === o && (this._pendingItems = []), await V(o);
|
|
230
|
-
try {
|
|
231
|
-
for (let n = 0; n < s.length; n += F)
|
|
232
|
-
await this._postFssBatch(s.slice(n, n + F), o, e);
|
|
233
|
-
i && console.info(`Wrote ${s.length} file location(s) to commands API ✅`);
|
|
234
|
-
} catch (n) {
|
|
235
|
-
const r = [...s, ...this._pendingItems];
|
|
236
|
-
throw this._pendingItems = r, await N({ spaceId: o, items: r }), n;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
async _postFssBatch(t, o, e) {
|
|
240
|
-
const i = await fetch(`${this._gatewayUrl}${Q}`, {
|
|
241
|
-
method: "POST",
|
|
242
|
-
headers: {
|
|
243
|
-
Authorization: `Bearer ${e}`,
|
|
244
|
-
"Content-Type": "application/json",
|
|
245
|
-
"x-project-id": o
|
|
246
|
-
},
|
|
247
|
-
body: JSON.stringify({ items: t })
|
|
248
|
-
});
|
|
249
|
-
if (!i.ok) {
|
|
250
|
-
const s = await i.text().catch(() => "");
|
|
251
|
-
throw new Error(`File structure batch POST failed: ${i.status} ${i.statusText}${s ? ` — ${s}` : ""}`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
_stopFlushTimer() {
|
|
255
|
-
this._flushTimer !== null && (clearInterval(this._flushTimer), this._flushTimer = null);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Scans `localFiles` and returns a per-extension cost breakdown.
|
|
259
|
-
*
|
|
260
|
-
* Each {@link ScanOutputRecord} contains `units` — the billable metric for
|
|
261
|
-
* that extension (e.g. pages for PDFs, rows for spreadsheets) — which can be
|
|
262
|
-
* shown to the user before or after calling {@link sync}.
|
|
263
|
-
*/
|
|
264
|
-
async scanCost(t) {
|
|
265
|
-
if ($ || ($ = k()), await $, !C) throw new Error("WASM scan function not initialised");
|
|
266
|
-
const o = 200, e = /* @__PURE__ */ new Map();
|
|
267
|
-
for (let i = 0; i < t.length; i += o) {
|
|
268
|
-
const s = t.slice(i, i + o), n = await Promise.all(
|
|
269
|
-
s.map(async (a) => ({
|
|
270
|
-
originalPath: a.relativePath,
|
|
271
|
-
data: new Uint8Array(await P(a.fullPath))
|
|
272
|
-
}))
|
|
273
|
-
), r = C(n);
|
|
274
|
-
for (const a of r) {
|
|
275
|
-
const l = e.get(a.ext);
|
|
276
|
-
l ? (l.count += a.count, l.units += a.units, l.sizeMb += a.sizeMb) : e.set(a.ext, { ...a });
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return Array.from(e.values());
|
|
280
|
-
}
|
|
281
|
-
_logProgress(t, o, e, i, s) {
|
|
282
|
-
if (!s || o === 0 || t % Math.ceil(o / 100) !== 0) return;
|
|
283
|
-
const n = Math.floor(t / o * 100);
|
|
284
|
-
console.info(
|
|
285
|
-
`Progress: ${n}% (${t}/${o} files, ${e}/${i} bytes)`
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
const Z = "spaces_raw_eu_west6", tt = "spaces_processed_eu_west6";
|
|
290
|
-
class ut extends v {
|
|
1
|
+
import { C as _, B as E, o as l, p as S, q as m, r as P, t as d, l as U, u as B, a as R } from "./cue-BIvMahsX.js";
|
|
2
|
+
import { b as y, c as I, d as L, e as O, f as x, g as D, h as H, i as N, j as W, k as v, R as k, m as q, n as G, s as Q } from "./cue-BIvMahsX.js";
|
|
3
|
+
import { getStorage as s, connectStorageEmulator as o } from "firebase/storage";
|
|
4
|
+
import "firebase/firestore";
|
|
5
|
+
class w extends _ {
|
|
291
6
|
constructor(t) {
|
|
292
7
|
super(t);
|
|
293
8
|
}
|
|
294
9
|
_buildApi(t) {
|
|
295
|
-
const
|
|
10
|
+
const p = s(this._app, E), C = s(this._app, l), i = s(this._app, S), g = s(this._app, m), r = s(this._app, P), n = s(this._app, d);
|
|
296
11
|
if (this._isEmulator) {
|
|
297
|
-
const
|
|
298
|
-
|
|
12
|
+
const e = this._endpoints.storageEmulatorHost, a = this._endpoints.storageEmulatorPort;
|
|
13
|
+
o(i, e, a), o(r, e, a), o(n, e, a);
|
|
299
14
|
}
|
|
300
|
-
const
|
|
301
|
-
|
|
15
|
+
const h = new B({
|
|
16
|
+
storageChatSessions: p,
|
|
17
|
+
storageLogs: C,
|
|
18
|
+
storageRaw: i,
|
|
19
|
+
storagePersistence: g,
|
|
20
|
+
storageProcessed: r,
|
|
21
|
+
storagePublic: n
|
|
22
|
+
}), c = new U(
|
|
23
|
+
this.auth,
|
|
24
|
+
t,
|
|
25
|
+
h,
|
|
26
|
+
this._endpoints.gatewayUrl
|
|
27
|
+
), u = new R(
|
|
28
|
+
this.auth,
|
|
29
|
+
this._endpoints.gatewayUrl,
|
|
30
|
+
t,
|
|
31
|
+
c
|
|
32
|
+
);
|
|
33
|
+
return c._bindApi(u), u;
|
|
302
34
|
}
|
|
303
35
|
}
|
|
304
36
|
export {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
37
|
+
_ as Cue,
|
|
38
|
+
R as CueApi,
|
|
39
|
+
y as CueAuth,
|
|
40
|
+
I as CueCache,
|
|
41
|
+
w as CueNode,
|
|
42
|
+
L as CuePrivileges,
|
|
43
|
+
O as CueProfile,
|
|
44
|
+
x as CueProjectDocuments,
|
|
45
|
+
D as CueProjectEntities,
|
|
46
|
+
H as CueProjectSchema,
|
|
47
|
+
N as CueProjectView,
|
|
48
|
+
W as CueProjects,
|
|
49
|
+
v as CueSignal,
|
|
50
|
+
U as CueSyncApi,
|
|
51
|
+
k as REQUIRED_ROLES,
|
|
52
|
+
q as configureScanWasm,
|
|
53
|
+
G as cueComputed,
|
|
54
|
+
Q as staleWhileRevalidate
|
|
312
55
|
};
|
package/package.json
CHANGED
package/variables.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Firebase configuration for the QAECY SDK demo app ("sdk-default").
|
|
3
|
+
* These are safe to use for evaluation and development purposes.
|
|
4
|
+
* For production use, obtain your own configuration from QAECY.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_SDK_CONFIG: {
|
|
7
|
+
readonly apiKey: "AIzaSyAiW42QBx9HS4Khu88pCW7MV66IhBAQul0";
|
|
8
|
+
readonly appId: "1:151132927589:web:d2ffdb377dfadfd23ab88c";
|
|
9
|
+
readonly measurementId: "G-YT4PK6HGZD";
|
|
10
|
+
};
|
|
11
|
+
export declare const FIREBASE_PROJECT_ID = "qaecy-mvp-406413";
|
|
12
|
+
export declare const FIREBASE_SENDER_ID = "734737865998";
|
|
13
|
+
export declare const GCP_REGION = "europe-west6";
|
|
14
|
+
export declare const COLLECTION_API_KEYS = "apiKeys";
|
|
15
|
+
export declare const COLLECTION_ORGANIZATIONS = "organizations";
|
|
16
|
+
export declare const COLLECTION_PROJECTS = "projects";
|
|
17
|
+
export declare const BUCKET_CHAT_SESSIONS = "spaces_chats_eu_west6";
|
|
18
|
+
export declare const BUCKET_RAW = "spaces_raw_eu_west6";
|
|
19
|
+
export declare const BUCKET_PROCESSED = "spaces_processed_eu_west6";
|
|
20
|
+
export declare const BUCKET_LOGS = "spaces_logs_eu_west6";
|
|
21
|
+
export declare const BUCKET_PUBLIC = "cue_public_eu_west6";
|
|
22
|
+
export declare const BUCKET_PERSISTENCE = "db_persistence_eu_west6";
|
|
23
|
+
export declare const ENDPOINT_CONSUMPTION = "/data-views/admin/consumption";
|
|
24
|
+
export declare const ENDPOINT_PROFILE_ORGANIZATIONS = "/data-views/admin/profile/organizations";
|
|
25
|
+
export declare const ENDPOINT_PROFILE_API_KEYS = "/data-views/admin/profile/api-keys";
|
|
26
|
+
export declare const ENDPOINT_ORG_MEMBERS: (orgId: string) => string;
|
|
27
|
+
export declare const ENDPOINT_CREATE_PROJECT = "/commands/admin/project";
|
|
28
|
+
export declare const ENDPOINT_SEARCH = "/assistant/search";
|
|
29
|
+
export declare const ENDPOINT_FUSEKI_QUERY = "/triplestore/query";
|
|
30
|
+
export declare const ENDPOINT_FUSEKI_UPDATE = "/triplestore/update";
|
|
31
|
+
export declare const ENDPOINT_QLEVER_QUERY = "/qlever-server/qlever/query";
|
|
32
|
+
export declare const ENDPOINT_QLEVER_UPDATE = "/qlever-server/qlever/update";
|
|
33
|
+
export declare const ENDPOINT_FSS_BATCH = "/commands/file-system-structure/batch";
|
|
34
|
+
export declare const MICROSOFT_PROVIDER_ID = "microsoft.com";
|
|
35
|
+
export declare const SUPERADMIN_ROLE = "superadmin";
|
|
36
|
+
/**
|
|
37
|
+
* Base URL for all RDF resource IRIs: `https://cue.qaecy.com/r/{projectId}/{entityUUID}`.
|
|
38
|
+
* Entity IRIs are constructed as `${RESOURCE_BASE}${projectId}/${uuid}`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const RESOURCE_BASE = "https://cue.qaecy.com/r/";
|