@ms-cloudpack/common-types-browser 0.5.0 → 0.5.2
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/index.d.ts +25 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,35 +1,60 @@
|
|
|
1
1
|
export {}; // Make this a module
|
|
2
2
|
|
|
3
|
+
/** Client-side context object for a Cloudpack session, used for API requests and telemetry. */
|
|
3
4
|
export interface PageSessionContext {
|
|
5
|
+
/** UUID for the current session */
|
|
4
6
|
sessionId: string;
|
|
7
|
+
/** API server URL */
|
|
5
8
|
apiUrl: string;
|
|
9
|
+
/** Session version used to trigger reloads */
|
|
6
10
|
currentSequence: number;
|
|
11
|
+
/** Bundle server URL */
|
|
7
12
|
bundleServerUrl: string;
|
|
13
|
+
/** Requested URL */
|
|
14
|
+
requestPath: string;
|
|
8
15
|
}
|
|
9
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Input for `window.__cloudpack.bootstrap` function defined by `app-server`'s `bootstrap.inline.ts`.
|
|
19
|
+
* It's set by `app-server`'s `renderBootstrapRoute` function.
|
|
20
|
+
*/
|
|
10
21
|
export interface BootstrapInput {
|
|
22
|
+
/** Strings of inline JS scripts, to be added as script tag contents */
|
|
11
23
|
inlineScripts: string[];
|
|
24
|
+
/** URL for the Cloudpack overlay, to be added as a script tag */
|
|
12
25
|
overlayScript?: string;
|
|
26
|
+
/** Import map to be added to the page */
|
|
13
27
|
importMap: {
|
|
14
28
|
imports: Record<string, string>;
|
|
15
29
|
scopes?: Record<string, Record<string, string>>;
|
|
16
30
|
};
|
|
31
|
+
/** Client-side context object for a Cloudpack session */
|
|
17
32
|
pageSessionContext: PageSessionContext;
|
|
33
|
+
/** Additional entry module import paths, to be added as script tags */
|
|
18
34
|
entryScripts?: string[];
|
|
19
35
|
}
|
|
20
36
|
|
|
21
37
|
declare global {
|
|
22
38
|
interface Window {
|
|
23
39
|
__cloudpack?: {
|
|
40
|
+
/** Get page load time for telemetry (defined in `getPageLoadTime.inline.ts`) */
|
|
24
41
|
getPageLoadTime?: () => Promise<number>;
|
|
42
|
+
/** Get cache hit ratio for telemetry (defined in `getBrowserCacheRatio.inline.ts`) */
|
|
25
43
|
getBrowserCacheRatio?: () => {
|
|
26
44
|
ratio: number;
|
|
27
45
|
hit: number;
|
|
28
46
|
total: number;
|
|
29
47
|
};
|
|
48
|
+
/** Set up a Cloudpack app in side-loading scenarios (defined in `bootstrap.inline.ts`) */
|
|
30
49
|
bootstrap?: (input: BootstrapInput) => void;
|
|
50
|
+
|
|
51
|
+
/** Whether the bootstrap script has run (defined in `bootstrap.inline.ts`). */
|
|
52
|
+
hasBootstrapRun?: boolean;
|
|
53
|
+
|
|
54
|
+
/** Client-side context object for a Cloudpack session (defined by the app server while rendering HTML routes) */
|
|
31
55
|
pageSessionContext?: PageSessionContext;
|
|
32
56
|
};
|
|
57
|
+
/** Track uncaught errors (defined in `errorHandler.inline.ts` and read by the overlay) */
|
|
33
58
|
__pageErrors: {
|
|
34
59
|
uncaughtErrors: ErrorEvent[];
|
|
35
60
|
uncaughtRejections: PromiseRejectionEvent[];
|