@thatopen/services 0.34.4 → 0.35.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/dist/cli.js +111 -13
- package/dist/cli.js.map +1 -1
- package/dist/core/app-cache.d.ts +32 -0
- package/dist/core/app-cache.test.d.ts +1 -0
- package/dist/core/client.d.ts +27 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +2367 -2259
- package/dist/index.es.js.map +1 -1
- package/dist/types/context.d.ts +6 -0
- package/package.json +4 -4
- package/src/cli/templates/app/package.json +4 -4
- package/src/cli/templates/cloud-component/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT THIS APP SAW LAST TIME, to open on at once and correct afterwards
|
|
3
|
+
* (Antonio, 5-11).
|
|
4
|
+
*
|
|
5
|
+
* In the platform, the page around the app keeps it (the app's frame has no
|
|
6
|
+
* storage of its own) and hands it over with the token, before the bundle runs:
|
|
7
|
+
* `window.__THATOPEN_CONTEXT__.cache`. Writing sends it back to the page for the
|
|
8
|
+
* next time. Outside the platform (a standalone page, a sandbox, a test) it is
|
|
9
|
+
* kept in memory, so the same code works there and simply starts empty.
|
|
10
|
+
*
|
|
11
|
+
* Keys: `documents`, `files` and `projectData` are the project's listings, filled
|
|
12
|
+
* by this client whenever a fresh answer arrives (`{ projectId, value, at }`).
|
|
13
|
+
* An app's own keys start with `app:` and are kept apart per app by the page.
|
|
14
|
+
*/
|
|
15
|
+
export interface CachedAnswer<T> {
|
|
16
|
+
projectId: string;
|
|
17
|
+
value: T;
|
|
18
|
+
/** When the answer arrived, in ms since the epoch. */
|
|
19
|
+
at: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class AppCache {
|
|
22
|
+
#private;
|
|
23
|
+
/** What was kept under `key`, or undefined. */
|
|
24
|
+
get<T = unknown>(key: string): T | undefined;
|
|
25
|
+
/** Kept for the next time this app opens in this project (structured-cloneable values, bytes too). */
|
|
26
|
+
set(key: string, value: unknown): void;
|
|
27
|
+
delete(key: string): void;
|
|
28
|
+
/** One of the project's listings as it was last answered, if it is this project's. */
|
|
29
|
+
answer<T>(key: 'documents' | 'files' | 'projectData', projectId: string): CachedAnswer<T> | undefined;
|
|
30
|
+
/** @internal The client keeping a fresh listing. */
|
|
31
|
+
keepAnswer(key: 'documents' | 'files' | 'projectData', projectId: string, value: unknown): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/core/client.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { CreateHiddenItemResult, CreateHiddenItemsBatchResult, HiddenFileEntity,
|
|
|
8
8
|
import { HiddenFileSignedUrlBatchEntry, ItemFoldersBatchEntry, ItemVersionsBatchEntry, VersionMetadataBatchEntry, VersionMetadataBatchRequest } from '../types/batch';
|
|
9
9
|
import { ThatOpenContext } from '../types/context';
|
|
10
10
|
import { NpmCredentials } from '../types/npm';
|
|
11
|
+
import { AppCache } from './app-cache';
|
|
11
12
|
|
|
12
13
|
declare global {
|
|
13
14
|
interface Window {
|
|
@@ -30,7 +31,7 @@ type DocumentDescriptors = {
|
|
|
30
31
|
* Avoids hard-coupling to `@thatopen/components` at the public API level.
|
|
31
32
|
*/
|
|
32
33
|
export interface ComponentsLike {
|
|
33
|
-
get
|
|
34
|
+
get(c: new (...args: any[]) => any): any;
|
|
34
35
|
init(): void;
|
|
35
36
|
}
|
|
36
37
|
/** Properties for creating a new item (file, component, or app). */
|
|
@@ -160,6 +161,13 @@ export declare class EngineServicesClient {
|
|
|
160
161
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
161
162
|
*/
|
|
162
163
|
readonly context: ThatOpenContext;
|
|
164
|
+
/**
|
|
165
|
+
* What this app saw last time, to open on at once and correct afterwards
|
|
166
|
+
* ({@link AppCache}): kept by the platform page, or in memory outside it. The
|
|
167
|
+
* project's listings (`documents`, `files`, `projectData`) are kept here
|
|
168
|
+
* whenever a fresh answer arrives; an app keeps its own under `app:` keys.
|
|
169
|
+
*/
|
|
170
|
+
readonly cache: AppCache;
|
|
163
171
|
/**
|
|
164
172
|
* Creates a client from the platform context injected into
|
|
165
173
|
* `window.__THATOPEN_CONTEXT__` by the That Open Platform.
|
|
@@ -575,6 +583,24 @@ export declare class EngineServicesClient {
|
|
|
575
583
|
}[]): Promise<{
|
|
576
584
|
components: TComponents;
|
|
577
585
|
}>;
|
|
586
|
+
/**
|
|
587
|
+
* 🔴 ONE LOADING SCREEN (Jesús 4-11: opening an app showed three, one after
|
|
588
|
+
* the other). The platform keeps its own until the app says it is loaded,
|
|
589
|
+
* and `setup` said so as soon as the components were made: the app's own
|
|
590
|
+
* screens (its configuration, its viewer) then showed behind. Whatever is
|
|
591
|
+
* still getting the app ready holds the word back with this, and lets it go
|
|
592
|
+
* once it is: the platform's screen, the only one, stays until then.
|
|
593
|
+
*
|
|
594
|
+
* Returns the release; each is let go once. Held or not, the word goes 12 s
|
|
595
|
+
* after this client was made at the latest, before the platform's own
|
|
596
|
+
* deadline (15 s) calls the app dead.
|
|
597
|
+
*/
|
|
598
|
+
holdAppLoaded(maxMs?: number): () => void;
|
|
599
|
+
/**
|
|
600
|
+
* The app's shell saying it is ready to be looked at: the hold `setup` took
|
|
601
|
+
* for it, let go. Nothing if it took none.
|
|
602
|
+
*/
|
|
603
|
+
appReady(): void;
|
|
578
604
|
/**
|
|
579
605
|
* Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
|
|
580
606
|
* @param code - Numeric error code.
|