@thatopen/services 0.34.3 → 0.34.5
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/dist/cli.js +72 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/client.d.ts +30 -9
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2306 -2242
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8849,6 +8849,7 @@ class RequestError extends Error {
|
|
|
8849
8849
|
}
|
|
8850
8850
|
const FOLDER_PATH = "item/folder";
|
|
8851
8851
|
const ITEM_PATH = "item";
|
|
8852
|
+
const LOADED_AT_THE_LATEST_MS = 12e3;
|
|
8852
8853
|
const PROCESS_PATH = "processor";
|
|
8853
8854
|
const NPM_REGISTRY_PATH = "npm-registry";
|
|
8854
8855
|
const HIDDEN_PATH = "hidden";
|
|
@@ -9164,7 +9165,21 @@ class EngineServicesClient {
|
|
|
9164
9165
|
* by one".
|
|
9165
9166
|
*/
|
|
9166
9167
|
async listDocumentDescriptors(projectId) {
|
|
9167
|
-
|
|
9168
|
+
const asked = this.#descriptorsAsked.get(projectId);
|
|
9169
|
+
if (asked) return await asked;
|
|
9170
|
+
const request = this.#listDocumentDescriptors(projectId);
|
|
9171
|
+
this.#descriptorsAsked.set(projectId, request);
|
|
9172
|
+
try {
|
|
9173
|
+
return await request;
|
|
9174
|
+
} finally {
|
|
9175
|
+
this.#descriptorsAsked.delete(projectId);
|
|
9176
|
+
}
|
|
9177
|
+
}
|
|
9178
|
+
#descriptorsAsked = /* @__PURE__ */ new Map();
|
|
9179
|
+
async #listDocumentDescriptors(projectId) {
|
|
9180
|
+
return await this.#requestApi("GET", `${ITEM_PATH}/documents`, {
|
|
9181
|
+
query: { projectId }
|
|
9182
|
+
});
|
|
9168
9183
|
}
|
|
9169
9184
|
async exportProjectDocuments(projectId, options) {
|
|
9170
9185
|
if (options?.format === "csv") {
|
|
@@ -9629,9 +9644,64 @@ return main;`);
|
|
|
9629
9644
|
this.setBuiltInGlobals(globals);
|
|
9630
9645
|
await this.initBuiltInComponents(components, ...builtIns);
|
|
9631
9646
|
components.init();
|
|
9632
|
-
this
|
|
9647
|
+
if (globalThis.__thatOpenShellSaysLoaded && !this.#shellRelease) {
|
|
9648
|
+
this.#shellRelease = this.holdAppLoaded();
|
|
9649
|
+
}
|
|
9650
|
+
this.#setupDone = true;
|
|
9651
|
+
this.#reportLoaded();
|
|
9652
|
+
if (!this.#loadedReported) {
|
|
9653
|
+
const since = typeof performance !== "undefined" ? performance.now() : Date.now() - this.#bornAt;
|
|
9654
|
+
setTimeout(() => {
|
|
9655
|
+
this.#loadedHolds = 0;
|
|
9656
|
+
this.#reportLoaded();
|
|
9657
|
+
}, Math.max(0, LOADED_AT_THE_LATEST_MS - since));
|
|
9658
|
+
}
|
|
9633
9659
|
return { components };
|
|
9634
9660
|
}
|
|
9661
|
+
/**
|
|
9662
|
+
* 🔴 ONE LOADING SCREEN (Jesús 4-11: opening an app showed three, one after
|
|
9663
|
+
* the other). The platform keeps its own until the app says it is loaded,
|
|
9664
|
+
* and `setup` said so as soon as the components were made: the app's own
|
|
9665
|
+
* screens (its configuration, its viewer) then showed behind. Whatever is
|
|
9666
|
+
* still getting the app ready holds the word back with this, and lets it go
|
|
9667
|
+
* once it is: the platform's screen, the only one, stays until then.
|
|
9668
|
+
*
|
|
9669
|
+
* Returns the release; each is let go once. Held or not, the word goes 12 s
|
|
9670
|
+
* after this client was made at the latest, before the platform's own
|
|
9671
|
+
* deadline (15 s) calls the app dead.
|
|
9672
|
+
*/
|
|
9673
|
+
holdAppLoaded(maxMs = LOADED_AT_THE_LATEST_MS) {
|
|
9674
|
+
if (this.#loadedReported) return () => {
|
|
9675
|
+
};
|
|
9676
|
+
this.#loadedHolds++;
|
|
9677
|
+
let released = false;
|
|
9678
|
+
const release = () => {
|
|
9679
|
+
if (released) return;
|
|
9680
|
+
released = true;
|
|
9681
|
+
clearTimeout(timer);
|
|
9682
|
+
this.#loadedHolds--;
|
|
9683
|
+
this.#reportLoaded();
|
|
9684
|
+
};
|
|
9685
|
+
const timer = setTimeout(release, maxMs);
|
|
9686
|
+
return release;
|
|
9687
|
+
}
|
|
9688
|
+
/**
|
|
9689
|
+
* The app's shell saying it is ready to be looked at: the hold `setup` took
|
|
9690
|
+
* for it, let go. Nothing if it took none.
|
|
9691
|
+
*/
|
|
9692
|
+
appReady() {
|
|
9693
|
+
this.#shellRelease?.();
|
|
9694
|
+
}
|
|
9695
|
+
#shellRelease;
|
|
9696
|
+
#bornAt = Date.now();
|
|
9697
|
+
#setupDone = false;
|
|
9698
|
+
#loadedHolds = 0;
|
|
9699
|
+
#loadedReported = false;
|
|
9700
|
+
#reportLoaded() {
|
|
9701
|
+
if (this.#loadedReported || !this.#setupDone || this.#loadedHolds > 0) return;
|
|
9702
|
+
this.#loadedReported = true;
|
|
9703
|
+
this.context.appEventOrchestrator?.appLoaded?.();
|
|
9704
|
+
}
|
|
9635
9705
|
/**
|
|
9636
9706
|
* Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
|
|
9637
9707
|
* @param code - Numeric error code.
|