@thatopen/services 0.17.0 → 0.19.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/README.md +4 -0
- package/dist/built-in/index.d.ts +1044 -1
- package/dist/cli/commands/mcp.d.ts +3 -0
- package/dist/cli/lib/cli-client.d.ts +13 -0
- package/dist/cli/lib/config.d.ts +2 -0
- package/dist/cli/lib/zip.test.d.ts +1 -0
- package/dist/cli.js +20929 -392
- package/dist/cli.js.map +1 -0
- package/dist/core/client.d.ts +10 -6
- package/dist/core/platform-client.d.ts +17 -1
- package/dist/index.cjs.js +3 -2
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +118 -93
- package/dist/index.es.js.map +1 -0
- package/dist/types/base.d.ts +9 -1
- package/dist/types/notifications.d.ts +4 -2
- package/docs/ai-quickstart.md +58 -6
- package/docs/builtin/paths.json +16 -0
- package/docs/cli/mcp.md +41 -0
- package/docs/cli/paths.json +4 -0
- package/docs/platform-token.md +1 -1
- package/package.json +5 -2
- package/src/built-in/GISManager/example.ts +326 -0
- package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +5 -2
- package/src/built-in/UIManager/src/gis-panel/example.ts +163 -0
- package/src/built-in/UIManager/src/gis-properties-panel/example.ts +168 -0
- package/src/built-in/UIManager/src/map-panel/example.ts +189 -0
- package/src/built-in/UIManager/src/models-list/example.ts +61 -2
- package/src/built-in/UIManager/src/settings-panel/example.ts +5 -3
- package/src/built-in/UIManager/src/viewer-toolbar/example.ts +25 -1
- package/src/built-in/index.ts +1054 -1
- package/src/cli/templates/app/README.md +1 -1
package/dist/index.es.js
CHANGED
|
@@ -77,7 +77,7 @@ const At = (n) => {
|
|
|
77
77
|
default:
|
|
78
78
|
return n instanceof ArrayBuffer ? n : n.buffer;
|
|
79
79
|
}
|
|
80
|
-
}, ot = "",
|
|
80
|
+
}, ot = "", Rt = (n, e) => {
|
|
81
81
|
const t = n.length, s = new Array(t);
|
|
82
82
|
let r = 0;
|
|
83
83
|
n.forEach((i, o) => {
|
|
@@ -85,7 +85,7 @@ const At = (n) => {
|
|
|
85
85
|
s[o] = h, ++r === t && e(s.join(ot));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
88
|
+
}, Ct = (n, e) => {
|
|
89
89
|
const t = n.split(ot), s = [];
|
|
90
90
|
for (let r = 0; r < t.length; r++) {
|
|
91
91
|
const i = Fe(t[r], e);
|
|
@@ -94,7 +94,7 @@ const At = (n) => {
|
|
|
94
94
|
}
|
|
95
95
|
return s;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
97
|
+
function $t() {
|
|
98
98
|
return new TransformStream({
|
|
99
99
|
transform(n, e) {
|
|
100
100
|
kt(n, (t) => {
|
|
@@ -413,7 +413,7 @@ class Ht extends Me {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(s);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
Ct(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
419
|
* For polling, send a close packet.
|
|
@@ -433,7 +433,7 @@ class Ht extends Me {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(e) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, Rt(e, (t) => {
|
|
437
437
|
this.doWrite(t, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -721,7 +721,7 @@ class zt extends Me {
|
|
|
721
721
|
this.onError("webtransport error", e);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((e) => {
|
|
724
|
-
const t = Nt(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r =
|
|
724
|
+
const t = Nt(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = $t();
|
|
725
725
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
727
|
s.read().then(({ done: h, value: f }) => {
|
|
@@ -1094,8 +1094,8 @@ class ss extends M {
|
|
|
1094
1094
|
s || this.readyState !== "closed" && (y(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
|
|
1095
1095
|
});
|
|
1096
1096
|
} else {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1097
|
+
const C = new Error("probe error");
|
|
1098
|
+
C.transport = t.name, this.emitReserved("upgradeError", C);
|
|
1099
1099
|
}
|
|
1100
1100
|
}));
|
|
1101
1101
|
};
|
|
@@ -1103,8 +1103,8 @@ class ss extends M {
|
|
|
1103
1103
|
s || (s = !0, y(), t.close(), t = null);
|
|
1104
1104
|
}
|
|
1105
1105
|
const o = (g) => {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1106
|
+
const C = new Error("probe error: " + g);
|
|
1107
|
+
C.transport = t.name, i(), this.emitReserved("upgradeError", C);
|
|
1108
1108
|
};
|
|
1109
1109
|
function h() {
|
|
1110
1110
|
o("transport closed");
|
|
@@ -1196,9 +1196,9 @@ function Oe(n, e) {
|
|
|
1196
1196
|
return n;
|
|
1197
1197
|
}
|
|
1198
1198
|
function us(n, e) {
|
|
1199
|
-
return n.data =
|
|
1199
|
+
return n.data = Re(n.data, e), delete n.attachments, n;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Re(n, e) {
|
|
1202
1202
|
if (!n)
|
|
1203
1203
|
return n;
|
|
1204
1204
|
if (n && n._placeholder === !0) {
|
|
@@ -1207,10 +1207,10 @@ function $e(n, e) {
|
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
1208
|
} else if (Array.isArray(n))
|
|
1209
1209
|
for (let t = 0; t < n.length; t++)
|
|
1210
|
-
n[t] =
|
|
1210
|
+
n[t] = Re(n[t], e);
|
|
1211
1211
|
else if (typeof n == "object")
|
|
1212
1212
|
for (const t in n)
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(n, t) && (n[t] =
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(n, t) && (n[t] = Re(n[t], e));
|
|
1214
1214
|
return n;
|
|
1215
1215
|
}
|
|
1216
1216
|
const ls = [
|
|
@@ -1429,7 +1429,7 @@ const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1429
1429
|
return p;
|
|
1430
1430
|
}
|
|
1431
1431
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1432
|
-
function
|
|
1432
|
+
function R(n, e, t) {
|
|
1433
1433
|
return n.on(e, t), function() {
|
|
1434
1434
|
n.off(e, t);
|
|
1435
1435
|
};
|
|
@@ -1477,10 +1477,10 @@ class pt extends w {
|
|
|
1477
1477
|
return;
|
|
1478
1478
|
const e = this.io;
|
|
1479
1479
|
this.subs = [
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1480
|
+
R(e, "open", this.onopen.bind(this)),
|
|
1481
|
+
R(e, "packet", this.onpacket.bind(this)),
|
|
1482
|
+
R(e, "error", this.onerror.bind(this)),
|
|
1483
|
+
R(e, "close", this.onclose.bind(this))
|
|
1484
1484
|
];
|
|
1485
1485
|
}
|
|
1486
1486
|
/**
|
|
@@ -2058,7 +2058,7 @@ Q.prototype.setMax = function(n) {
|
|
|
2058
2058
|
Q.prototype.setJitter = function(n) {
|
|
2059
2059
|
this.jitter = n;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class Ce extends w {
|
|
2062
2062
|
constructor(e, t) {
|
|
2063
2063
|
var s;
|
|
2064
2064
|
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, me(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Q({
|
|
@@ -2112,11 +2112,11 @@ class Re extends w {
|
|
|
2112
2112
|
this.engine = new ns(this.uri, this.opts);
|
|
2113
2113
|
const t = this.engine, s = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
|
-
const r =
|
|
2115
|
+
const r = R(t, "open", function() {
|
|
2116
2116
|
s.onopen(), e && e();
|
|
2117
2117
|
}), i = (h) => {
|
|
2118
2118
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
|
|
2119
|
-
}, o =
|
|
2119
|
+
}, o = R(t, "error", i);
|
|
2120
2120
|
if (this._timeout !== !1) {
|
|
2121
2121
|
const h = this._timeout, f = this.setTimeoutFn(() => {
|
|
2122
2122
|
r(), i(new Error("timeout")), t.close();
|
|
@@ -2145,12 +2145,12 @@ class Re extends w {
|
|
|
2145
2145
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2146
2146
|
const e = this.engine;
|
|
2147
2147
|
this.subs.push(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2148
|
+
R(e, "ping", this.onping.bind(this)),
|
|
2149
|
+
R(e, "data", this.ondata.bind(this)),
|
|
2150
|
+
R(e, "error", this.onerror.bind(this)),
|
|
2151
|
+
R(e, "close", this.onclose.bind(this)),
|
|
2152
2152
|
// @ts-ignore
|
|
2153
|
-
|
|
2153
|
+
R(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2154
2154
|
);
|
|
2155
2155
|
}
|
|
2156
2156
|
/**
|
|
@@ -2301,10 +2301,10 @@ function se(n, e) {
|
|
|
2301
2301
|
typeof n == "object" && (e = n, n = void 0), e = e || {};
|
|
2302
2302
|
const t = rs(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Z[r] && i in Z[r].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
2303
2303
|
let f;
|
|
2304
|
-
return h ? f = new
|
|
2304
|
+
return h ? f = new Ce(s, e) : (Z[r] || (Z[r] = new Ce(s, e)), f = Z[r]), t.query && !e.query && (e.query = t.queryKey), f.socket(t.path, e);
|
|
2305
2305
|
}
|
|
2306
2306
|
Object.assign(se, {
|
|
2307
|
-
Manager:
|
|
2307
|
+
Manager: Ce,
|
|
2308
2308
|
Socket: pt,
|
|
2309
2309
|
io: se,
|
|
2310
2310
|
connect: se
|
|
@@ -2346,7 +2346,7 @@ class Ve extends Error {
|
|
|
2346
2346
|
this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? ws(o.details);
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
const
|
|
2349
|
+
const $ = "item/folder", d = "item", L = "processor", _s = "npm-registry", B = "hidden", Ee = "FILE", Te = "TOOL", ve = "APP", bs = 500, et = 3e4, Es = 0.25, Ts = (n) => new Promise((e) => setTimeout(e, n));
|
|
2350
2350
|
function vs(n) {
|
|
2351
2351
|
var r, i;
|
|
2352
2352
|
const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
|
|
@@ -2398,7 +2398,7 @@ const Je = class Je {
|
|
|
2398
2398
|
T(this, "context");
|
|
2399
2399
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
2400
2400
|
let h = t;
|
|
2401
|
-
if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl =
|
|
2401
|
+
if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl = h, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
|
|
2402
2402
|
let f = o;
|
|
2403
2403
|
f.charAt(f.length - 1) === "/" && (f = f.slice(0, -1)), this.localServerUrl = f;
|
|
2404
2404
|
}
|
|
@@ -2442,19 +2442,23 @@ const Je = class Je {
|
|
|
2442
2442
|
* {@link initBuiltInComponent} call will use these globals automatically
|
|
2443
2443
|
* — you no longer need to pass a `globals` argument to each one.
|
|
2444
2444
|
*
|
|
2445
|
-
* @param globals - Map of global names to module namespaces.
|
|
2446
|
-
*
|
|
2445
|
+
* @param globals - Map of global names to module namespaces. The FULL set
|
|
2446
|
+
* a built-in may ask for: `OBC`, `OBF`, `BUI`, `THREE`, `FRAGS`,
|
|
2447
|
+
* `MARKERJS` (plus `CUI` only if the app still uses the deprecated
|
|
2448
|
+
* `@thatopen/ui-obc`). Only `OBC` and `BUI` are strictly required by
|
|
2449
|
+
* `setup()`; passing everything you import is the safe default, because
|
|
2450
|
+
* a built-in that needs a missing one fails at init.
|
|
2447
2451
|
*
|
|
2448
2452
|
* @example
|
|
2449
2453
|
* ```ts
|
|
2450
2454
|
* import * as OBC from "@thatopen/components";
|
|
2451
2455
|
* import * as OBF from "@thatopen/components-front";
|
|
2452
2456
|
* import * as BUI from "@thatopen/ui";
|
|
2453
|
-
* import * as CUI from "@thatopen/ui-obc";
|
|
2454
2457
|
* import * as THREE from "three";
|
|
2455
2458
|
* import * as FRAGS from "@thatopen/fragments";
|
|
2459
|
+
* import * as MARKERJS from "@markerjs/markerjs3";
|
|
2456
2460
|
*
|
|
2457
|
-
* client.setBuiltInGlobals({ OBC, OBF, BUI,
|
|
2461
|
+
* client.setBuiltInGlobals({ OBC, OBF, BUI, THREE, FRAGS, MARKERJS });
|
|
2458
2462
|
*
|
|
2459
2463
|
* // Now just pass the component — no globals needed:
|
|
2460
2464
|
* await client.initBuiltInComponent(AppManager, components);
|
|
@@ -2476,8 +2480,8 @@ const Je = class Je {
|
|
|
2476
2480
|
*/
|
|
2477
2481
|
/**
|
|
2478
2482
|
* Socket origin without namespace or query, for gateways other than the
|
|
2479
|
-
* execution one.
|
|
2480
|
-
*
|
|
2483
|
+
* execution one. Callers pass their own credential in the Socket.IO auth
|
|
2484
|
+
* payload, resolved at connect time so a provider-backed client is current.
|
|
2481
2485
|
*/
|
|
2482
2486
|
get socketOrigin() {
|
|
2483
2487
|
return this.wsUrl.split("?")[0];
|
|
@@ -2502,7 +2506,7 @@ const Je = class Je {
|
|
|
2502
2506
|
*/
|
|
2503
2507
|
async listFiles(e) {
|
|
2504
2508
|
const { folderId: t, archived: s, projectId: r } = e || {};
|
|
2505
|
-
return t ? await a(this, c, l).call(this, "GET", `${
|
|
2509
|
+
return t ? await a(this, c, l).call(this, "GET", `${$}/${t}/items`, { query: { itemType: Ee, archived: s } }) : await a(this, c, l).call(this, "GET", `${d}`, {
|
|
2506
2510
|
query: {
|
|
2507
2511
|
itemType: Ee,
|
|
2508
2512
|
archived: s,
|
|
@@ -2626,7 +2630,7 @@ const Je = class Je {
|
|
|
2626
2630
|
*/
|
|
2627
2631
|
async listFolders(e) {
|
|
2628
2632
|
const { archived: t, parentFolderId: s, projectId: r } = e || {};
|
|
2629
|
-
return await a(this, c, l).call(this, "GET",
|
|
2633
|
+
return await a(this, c, l).call(this, "GET", $, {
|
|
2630
2634
|
query: {
|
|
2631
2635
|
parentFolderId: s,
|
|
2632
2636
|
archived: t,
|
|
@@ -2639,7 +2643,7 @@ const Je = class Je {
|
|
|
2639
2643
|
* @param folderId - The folder's unique identifier.
|
|
2640
2644
|
*/
|
|
2641
2645
|
async getFolder(e) {
|
|
2642
|
-
return await a(this, c, l).call(this, "GET", `${
|
|
2646
|
+
return await a(this, c, l).call(this, "GET", `${$}/${e}`);
|
|
2643
2647
|
}
|
|
2644
2648
|
/**
|
|
2645
2649
|
* Batch variant of {@link getFolder}. Resolves a known set of folder ids in
|
|
@@ -2667,7 +2671,7 @@ const Je = class Je {
|
|
|
2667
2671
|
* @returns The created folder.
|
|
2668
2672
|
*/
|
|
2669
2673
|
async createFolder(e, t, s) {
|
|
2670
|
-
return await a(this, c, l).call(this, "POST",
|
|
2674
|
+
return await a(this, c, l).call(this, "POST", $, {
|
|
2671
2675
|
body: JSON.stringify({
|
|
2672
2676
|
name: e,
|
|
2673
2677
|
...t && { parentId: t },
|
|
@@ -2684,7 +2688,7 @@ const Je = class Je {
|
|
|
2684
2688
|
*/
|
|
2685
2689
|
async updateFolder(e, t) {
|
|
2686
2690
|
const { name: s } = t;
|
|
2687
|
-
return await a(this, c, l).call(this, "PUT", `${
|
|
2691
|
+
return await a(this, c, l).call(this, "PUT", `${$}/${e}`, {
|
|
2688
2692
|
body: JSON.stringify({ name: s }),
|
|
2689
2693
|
contentType: "application/json"
|
|
2690
2694
|
});
|
|
@@ -2694,14 +2698,14 @@ const Je = class Je {
|
|
|
2694
2698
|
* @param folderId - The folder's unique identifier.
|
|
2695
2699
|
*/
|
|
2696
2700
|
async archiveFolder(e) {
|
|
2697
|
-
return await a(this, c, l).call(this, "DELETE", `${
|
|
2701
|
+
return await a(this, c, l).call(this, "DELETE", `${$}/${e}`);
|
|
2698
2702
|
}
|
|
2699
2703
|
/**
|
|
2700
2704
|
* Recovers a previously archived folder.
|
|
2701
2705
|
* @param folderId - The folder's unique identifier.
|
|
2702
2706
|
*/
|
|
2703
2707
|
async recoverFolder(e) {
|
|
2704
|
-
return await a(this, c, l).call(this, "PUT", `${
|
|
2708
|
+
return await a(this, c, l).call(this, "PUT", `${$}/${e}/recover`);
|
|
2705
2709
|
}
|
|
2706
2710
|
/**
|
|
2707
2711
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -2709,7 +2713,7 @@ const Je = class Je {
|
|
|
2709
2713
|
* @returns A fetch Response containing the ZIP data.
|
|
2710
2714
|
*/
|
|
2711
2715
|
async downloadFolder(e) {
|
|
2712
|
-
return await a(this, c, q).call(this, `${
|
|
2716
|
+
return await a(this, c, q).call(this, `${$}/${e}/download`);
|
|
2713
2717
|
}
|
|
2714
2718
|
// ─── Components ──────────────────────────────────────────────────
|
|
2715
2719
|
/**
|
|
@@ -2719,7 +2723,7 @@ const Je = class Je {
|
|
|
2719
2723
|
*/
|
|
2720
2724
|
async listComponents(e) {
|
|
2721
2725
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
2722
|
-
return t ? await a(this, c, l).call(this, "GET", `${
|
|
2726
|
+
return t ? await a(this, c, l).call(this, "GET", `${$}/${t}/items`, {
|
|
2723
2727
|
query: {
|
|
2724
2728
|
itemType: Te,
|
|
2725
2729
|
...s && { ShowVersions: s }
|
|
@@ -2903,7 +2907,7 @@ return main;`)(...h), y = (m == null ? void 0 : m.componentDefinition) ?? m;
|
|
|
2903
2907
|
*/
|
|
2904
2908
|
async listApps(e) {
|
|
2905
2909
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
2906
|
-
return t ? await a(this, c, l).call(this, "GET", `${
|
|
2910
|
+
return t ? await a(this, c, l).call(this, "GET", `${$}/${t}/items`, {
|
|
2907
2911
|
query: {
|
|
2908
2912
|
itemType: ve,
|
|
2909
2913
|
...s && { ShowVersions: s }
|
|
@@ -3073,8 +3077,9 @@ return main;`)(...h), y = (m == null ? void 0 : m.componentDefinition) ?? m;
|
|
|
3073
3077
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
3074
3078
|
*/
|
|
3075
3079
|
async onExecutionProgress(e, t) {
|
|
3076
|
-
const s = this.localServerUrl
|
|
3077
|
-
|
|
3080
|
+
const s = this.localServerUrl ?? this.wsUrl, r = await se(s, {
|
|
3081
|
+
auth: { accessToken: this.accessToken },
|
|
3082
|
+
transports: ["websocket"]
|
|
3078
3083
|
});
|
|
3079
3084
|
r.on("connect", function() {
|
|
3080
3085
|
r.emit("executionSubscription", JSON.stringify({ executionId: e })), r.on("execution", (i) => {
|
|
@@ -3329,9 +3334,9 @@ return main;`)(...h), y = (m == null ? void 0 : m.componentDefinition) ?? m;
|
|
|
3329
3334
|
c = new WeakSet(), Ne = function(e) {
|
|
3330
3335
|
return `${this.apiUrl}/${e}`;
|
|
3331
3336
|
}, l = async function(e, t, s) {
|
|
3332
|
-
const { body: r, query: i, contentType: o, retries: h, responseType: f, retryAttempt: m } = s || {}, y = a(this, c, Ne).call(this, t), g = a(this, c, yt).call(this, i),
|
|
3337
|
+
const { body: r, query: i, contentType: o, retries: h, responseType: f, retryAttempt: m } = s || {}, y = a(this, c, Ne).call(this, t), g = a(this, c, yt).call(this, i), C = await this.resolveAccessToken(), Et = {
|
|
3333
3338
|
...g,
|
|
3334
|
-
...this.useBearer ? {} : { accessToken:
|
|
3339
|
+
...this.useBearer ? {} : { accessToken: C }
|
|
3335
3340
|
};
|
|
3336
3341
|
try {
|
|
3337
3342
|
const O = await fetch(
|
|
@@ -3341,29 +3346,29 @@ c = new WeakSet(), Ne = function(e) {
|
|
|
3341
3346
|
headers: {
|
|
3342
3347
|
Accept: "application/json",
|
|
3343
3348
|
...o && { "Content-Type": o },
|
|
3344
|
-
...this.useBearer && { Authorization: `Bearer ${
|
|
3349
|
+
...this.useBearer && { Authorization: `Bearer ${C}` }
|
|
3345
3350
|
},
|
|
3346
3351
|
...r && { body: r }
|
|
3347
3352
|
}
|
|
3348
3353
|
);
|
|
3349
3354
|
if (!O.ok) {
|
|
3350
|
-
const
|
|
3355
|
+
const V = await O.text().then((ie) => ie).catch(() => "");
|
|
3351
3356
|
throw new Ve(
|
|
3352
3357
|
O.status,
|
|
3353
3358
|
O.statusText,
|
|
3354
|
-
|
|
3359
|
+
V,
|
|
3355
3360
|
vs(O)
|
|
3356
3361
|
);
|
|
3357
3362
|
}
|
|
3358
|
-
return f === "blob" ? await O.blob() : O.json().then((
|
|
3363
|
+
return f === "blob" ? await O.blob() : O.json().then((V) => V).catch(() => {
|
|
3359
3364
|
});
|
|
3360
3365
|
} catch (O) {
|
|
3361
|
-
const
|
|
3362
|
-
if (
|
|
3366
|
+
const V = h ?? this.retries;
|
|
3367
|
+
if (V > 0 && ks(O)) {
|
|
3363
3368
|
const ie = m ?? 0;
|
|
3364
3369
|
return await Ts(As(O, ie)), await a(this, c, l).call(this, e, t, {
|
|
3365
3370
|
...s,
|
|
3366
|
-
retries:
|
|
3371
|
+
retries: V - 1,
|
|
3367
3372
|
retryAttempt: ie + 1
|
|
3368
3373
|
});
|
|
3369
3374
|
}
|
|
@@ -3415,9 +3420,9 @@ c = new WeakSet(), Ne = function(e) {
|
|
|
3415
3420
|
const g = {
|
|
3416
3421
|
...r && { name: r },
|
|
3417
3422
|
...o && { folderId: o }
|
|
3418
|
-
},
|
|
3423
|
+
}, C = JSON.stringify(g);
|
|
3419
3424
|
m = await a(this, c, l).call(this, "PUT", `${d}/${e}`, {
|
|
3420
|
-
body:
|
|
3425
|
+
body: C,
|
|
3421
3426
|
contentType: "application/json"
|
|
3422
3427
|
});
|
|
3423
3428
|
}
|
|
@@ -3433,7 +3438,7 @@ c = new WeakSet(), Ne = function(e) {
|
|
|
3433
3438
|
{}
|
|
3434
3439
|
);
|
|
3435
3440
|
};
|
|
3436
|
-
let
|
|
3441
|
+
let $e = Je;
|
|
3437
3442
|
function Ss() {
|
|
3438
3443
|
if (typeof window > "u" || window.parent === window)
|
|
3439
3444
|
throw new Error(
|
|
@@ -3555,7 +3560,7 @@ x = new WeakMap(), k = new WeakMap(), A = new WeakMap(), Y = new WeakMap(), W =
|
|
|
3555
3560
|
u(this, Y).forEach((e) => de(e));
|
|
3556
3561
|
};
|
|
3557
3562
|
var z;
|
|
3558
|
-
class
|
|
3563
|
+
class Rs extends mt {
|
|
3559
3564
|
/** @internal Use `client.channel.collab()`. */
|
|
3560
3565
|
constructor(t) {
|
|
3561
3566
|
super(t, {
|
|
@@ -3593,7 +3598,7 @@ class $s extends mt {
|
|
|
3593
3598
|
}
|
|
3594
3599
|
z = new WeakMap();
|
|
3595
3600
|
var U;
|
|
3596
|
-
class
|
|
3601
|
+
class Cs extends mt {
|
|
3597
3602
|
/** @internal Use `client.channel.external(kind)`. */
|
|
3598
3603
|
constructor(t, s) {
|
|
3599
3604
|
super(t, {
|
|
@@ -3649,7 +3654,7 @@ function gt(n) {
|
|
|
3649
3654
|
kind: n.kind
|
|
3650
3655
|
};
|
|
3651
3656
|
}
|
|
3652
|
-
function
|
|
3657
|
+
function $s(n) {
|
|
3653
3658
|
const e = n;
|
|
3654
3659
|
if ((e == null ? void 0 : e.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
|
|
3655
3660
|
const t = e.message;
|
|
@@ -3663,20 +3668,20 @@ function Cs(n) {
|
|
|
3663
3668
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
3664
3669
|
};
|
|
3665
3670
|
}
|
|
3666
|
-
var
|
|
3671
|
+
var j, ne, I, D, F, b, qe, pe, wt, _t, bt, Ue;
|
|
3667
3672
|
class Ns {
|
|
3668
3673
|
constructor(e) {
|
|
3669
3674
|
_(this, b);
|
|
3670
|
-
_(this,
|
|
3675
|
+
_(this, j);
|
|
3671
3676
|
_(this, ne);
|
|
3672
3677
|
_(this, I);
|
|
3673
3678
|
_(this, D, /* @__PURE__ */ new Map());
|
|
3674
3679
|
_(this, F, /* @__PURE__ */ new Set());
|
|
3675
|
-
E(this,
|
|
3680
|
+
E(this, j, e), E(this, ne, e.listen((t) => void a(this, b, wt).call(this, t)));
|
|
3676
3681
|
}
|
|
3677
3682
|
/** The collaboration room for this app. Always the same instance. */
|
|
3678
3683
|
collab() {
|
|
3679
|
-
return u(this, I) ?? E(this, I, new
|
|
3684
|
+
return u(this, I) ?? E(this, I, new Rs(u(this, j))), u(this, I);
|
|
3680
3685
|
}
|
|
3681
3686
|
/**
|
|
3682
3687
|
* The room for commands from this account's external tools of one `kind`
|
|
@@ -3686,21 +3691,21 @@ class Ns {
|
|
|
3686
3691
|
external(e) {
|
|
3687
3692
|
const t = e ?? "";
|
|
3688
3693
|
let s = u(this, D).get(t);
|
|
3689
|
-
return s || (s = new
|
|
3694
|
+
return s || (s = new Cs(u(this, j), e), u(this, D).set(t, s)), s;
|
|
3690
3695
|
}
|
|
3691
3696
|
/** Stops listening. For tests and teardown; an app normally never calls it. */
|
|
3692
3697
|
dispose() {
|
|
3693
3698
|
u(this, ne).call(this);
|
|
3694
3699
|
}
|
|
3695
3700
|
}
|
|
3696
|
-
|
|
3701
|
+
j = new WeakMap(), ne = new WeakMap(), I = new WeakMap(), D = new WeakMap(), F = new WeakMap(), b = new WeakSet(), qe = function() {
|
|
3697
3702
|
return [...u(this, I) ? [u(this, I)] : [], ...u(this, D).values()];
|
|
3698
3703
|
}, pe = function(e, t) {
|
|
3699
3704
|
if (e === "collab") return u(this, I);
|
|
3700
3705
|
if (e === "external")
|
|
3701
3706
|
return u(this, D).get(typeof t == "string" ? t : "");
|
|
3702
3707
|
}, wt = async function(e) {
|
|
3703
|
-
const t =
|
|
3708
|
+
const t = $s(e);
|
|
3704
3709
|
if (t) {
|
|
3705
3710
|
if (t.type.startsWith(xe)) {
|
|
3706
3711
|
a(this, b, _t).call(this, t);
|
|
@@ -3749,7 +3754,7 @@ H = new WeakMap(), ne = new WeakMap(), I = new WeakMap(), D = new WeakMap(), F =
|
|
|
3749
3754
|
error: `No handler for "${e.type}".`
|
|
3750
3755
|
});
|
|
3751
3756
|
}, Ue = function(e, t) {
|
|
3752
|
-
u(this, F).has(e) || (u(this, F).add(e), u(this, F).size > 500 && u(this, F).delete(u(this, F).values().next().value), u(this,
|
|
3757
|
+
u(this, F).has(e) || (u(this, F).add(e), u(this, F).size > 500 && u(this, F).delete(u(this, F).values().next().value), u(this, j).post({
|
|
3753
3758
|
type: "APP_CHANNEL_PUBLISH",
|
|
3754
3759
|
message: {
|
|
3755
3760
|
type: t.error === void 0 ? "reply" : "reply-error",
|
|
@@ -3758,9 +3763,9 @@ H = new WeakMap(), ne = new WeakMap(), I = new WeakMap(), D = new WeakMap(), F =
|
|
|
3758
3763
|
}
|
|
3759
3764
|
}));
|
|
3760
3765
|
};
|
|
3761
|
-
const
|
|
3766
|
+
const H = "project", J = "notifications";
|
|
3762
3767
|
var X, re;
|
|
3763
|
-
const Ge = class Ge extends
|
|
3768
|
+
const Ge = class Ge extends $e {
|
|
3764
3769
|
/**
|
|
3765
3770
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
3766
3771
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -3816,12 +3821,30 @@ const Ge = class Ge extends Ce {
|
|
|
3816
3821
|
return u(this, re) ?? E(this, re, new Ns(Ss())), u(this, re);
|
|
3817
3822
|
}
|
|
3818
3823
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
3824
|
+
/**
|
|
3825
|
+
* Lists the caller's projects, each with their role in it. The discovery
|
|
3826
|
+
* call: everything else on this surface takes a projectId, and until this
|
|
3827
|
+
* method there was no way to find out which ids exist — a portfolio
|
|
3828
|
+
* dashboard had to be configured by hand. `ProjectWithRole` existed as a
|
|
3829
|
+
* type with no producer; this is the producer.
|
|
3830
|
+
*
|
|
3831
|
+
* @example
|
|
3832
|
+
* ```ts
|
|
3833
|
+
* const projects = await client.listProjects();
|
|
3834
|
+
* for (const { project, role } of projects) {
|
|
3835
|
+
* console.log(project.title, role?.name ?? 'no role');
|
|
3836
|
+
* }
|
|
3837
|
+
* ```
|
|
3838
|
+
*/
|
|
3839
|
+
async listProjects() {
|
|
3840
|
+
return await this.request("GET", H);
|
|
3841
|
+
}
|
|
3819
3842
|
/**
|
|
3820
3843
|
* Gets a project by ID. JWT-only — lives here because
|
|
3821
3844
|
* `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
|
|
3822
3845
|
*/
|
|
3823
3846
|
async getProject(t) {
|
|
3824
|
-
return await this.request("GET", `${
|
|
3847
|
+
return await this.request("GET", `${H}/${t}`);
|
|
3825
3848
|
}
|
|
3826
3849
|
/**
|
|
3827
3850
|
* Gets the full project data (users, roles, files, folders) for a project.
|
|
@@ -3830,7 +3853,7 @@ const Ge = class Ge extends Ce {
|
|
|
3830
3853
|
async getProjectData(t) {
|
|
3831
3854
|
return await this.request(
|
|
3832
3855
|
"GET",
|
|
3833
|
-
`${
|
|
3856
|
+
`${H}/${t}/data`
|
|
3834
3857
|
);
|
|
3835
3858
|
}
|
|
3836
3859
|
// ─── Account ──────────────────────────────────────────────────────
|
|
@@ -3855,7 +3878,7 @@ const Ge = class Ge extends Ce {
|
|
|
3855
3878
|
async checkPermission(t) {
|
|
3856
3879
|
return await this.request(
|
|
3857
3880
|
"GET",
|
|
3858
|
-
`${
|
|
3881
|
+
`${H}/permissions/check`,
|
|
3859
3882
|
{ query: t }
|
|
3860
3883
|
);
|
|
3861
3884
|
}
|
|
@@ -3864,7 +3887,7 @@ const Ge = class Ge extends Ce {
|
|
|
3864
3887
|
* single round-trip; results come back in the same order as `checks`.
|
|
3865
3888
|
*/
|
|
3866
3889
|
async checkPermissionBatch(t) {
|
|
3867
|
-
return (await this.request("POST", `${
|
|
3890
|
+
return (await this.request("POST", `${H}/permissions/check/batch`, {
|
|
3868
3891
|
body: JSON.stringify({ checks: t }),
|
|
3869
3892
|
contentType: "application/json"
|
|
3870
3893
|
})).results;
|
|
@@ -3976,7 +3999,7 @@ const Ge = class Ge extends Ce {
|
|
|
3976
3999
|
async subscribeToAutomation(t, s, r) {
|
|
3977
4000
|
return await this.request(
|
|
3978
4001
|
"POST",
|
|
3979
|
-
`${
|
|
4002
|
+
`${H}/${t}/events/hooks/${s}/subscription`,
|
|
3980
4003
|
{
|
|
3981
4004
|
body: JSON.stringify(r ?? {}),
|
|
3982
4005
|
contentType: "application/json"
|
|
@@ -3993,7 +4016,7 @@ const Ge = class Ge extends Ce {
|
|
|
3993
4016
|
async updateAutomationSubscription(t, s, r) {
|
|
3994
4017
|
return await this.request(
|
|
3995
4018
|
"PATCH",
|
|
3996
|
-
`${
|
|
4019
|
+
`${H}/${t}/events/hooks/${s}/subscription`,
|
|
3997
4020
|
{
|
|
3998
4021
|
body: JSON.stringify(r),
|
|
3999
4022
|
contentType: "application/json"
|
|
@@ -4027,10 +4050,10 @@ const Ge = class Ge extends Ce {
|
|
|
4027
4050
|
* ```
|
|
4028
4051
|
*/
|
|
4029
4052
|
async onNotification(t) {
|
|
4030
|
-
const s = await this.resolveAccessToken(), r = se(
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
);
|
|
4053
|
+
const s = await this.resolveAccessToken(), r = se(`${this.socketOrigin}/notifications`, {
|
|
4054
|
+
auth: { accessToken: s },
|
|
4055
|
+
transports: ["websocket"]
|
|
4056
|
+
});
|
|
4034
4057
|
return r.on(
|
|
4035
4058
|
"notification.created",
|
|
4036
4059
|
(i) => t({ type: "created", id: i == null ? void 0 : i.id })
|
|
@@ -4049,24 +4072,26 @@ const xs = {
|
|
|
4049
4072
|
MAX_FIELDS: 200,
|
|
4050
4073
|
MAX_KEY_LENGTH: 50,
|
|
4051
4074
|
MAX_VALUE_LENGTH: 50
|
|
4052
|
-
}, Is = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Ls = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, qs = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Us = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" },
|
|
4075
|
+
}, Is = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Ls = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, qs = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Us = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, Ds = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Fs = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, Ms = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, Hs = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, js = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
4053
4076
|
export {
|
|
4054
4077
|
Is as CDEManager,
|
|
4055
4078
|
Ns as ChannelClient,
|
|
4056
4079
|
mt as ChannelRoom,
|
|
4057
4080
|
Ls as ClashesManager,
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4081
|
+
Rs as CollabRoom,
|
|
4082
|
+
$e as EngineServicesClient,
|
|
4083
|
+
Cs as ExternalRoom,
|
|
4061
4084
|
qs as FileList,
|
|
4062
|
-
Us as
|
|
4063
|
-
Ds as
|
|
4085
|
+
Us as GISManager,
|
|
4086
|
+
Ds as GitHistoryManager,
|
|
4087
|
+
Fs as HelloWorld,
|
|
4064
4088
|
xs as METADATA_LIMITS,
|
|
4065
4089
|
tt as PlatformClient,
|
|
4066
|
-
|
|
4090
|
+
Ms as ProjectManager,
|
|
4067
4091
|
Ve as RequestError,
|
|
4068
4092
|
Ze as STORAGE_BATCH_MAX,
|
|
4069
|
-
|
|
4070
|
-
|
|
4093
|
+
Hs as TopicsManager,
|
|
4094
|
+
js as UIManager,
|
|
4071
4095
|
Ss as windowTransport
|
|
4072
4096
|
};
|
|
4097
|
+
//# sourceMappingURL=index.es.js.map
|