@malloy-publisher/sdk 0.0.236 → 0.0.237
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/client/api.d.ts +3 -3
- package/dist/{core-Rj_4rRnA.es.js → core-BSRgt1mG.es.js} +1 -1
- package/dist/{core-C-aiDDhx.cjs.js → core-BaoOGXpy.cjs.js} +1 -1
- package/dist/{index-DPfNLAv1.es.js → index-CjLRzHfD.es.js} +254 -236
- package/dist/{index-DJW7yQLF.cjs.js → index-yyP-Baz8.cjs.js} +64 -64
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +32 -31
- package/dist/utils/pageEmbed.d.ts +20 -0
- package/package.json +1 -1
- package/src/components/PageViewer/PageViewer.tsx +14 -6
- package/src/index.ts +4 -0
- package/src/utils/pageEmbed.ts +35 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-yyP-Baz8.cjs.js"),r=require("./ServerProvider-CXg4bBm6.cjs.js");exports.AnalyzePackageButton=e.AnalyzePackageButton;exports.BrowserWorkbookStorage=e.BrowserWorkbookStorage;exports.ConnectionExplorer=e.ConnectionExplorer;exports.DOC_LINKS=e.DOC_LINKS;exports.DimensionFilter=e.DimensionFilter;exports.EmbeddedQueryResult=e.EmbeddedQueryResult;exports.Environment=e.Environment;exports.EnvironmentMaterializations=e.EnvironmentMaterializations;exports.Home=e.Home;exports.Loading=e.Loading;exports.Materializations=e.Materializations;exports.Model=e.Model;exports.ModelExplorer=e.ModelExplorer;exports.ModelExplorerDialog=e.ModelExplorerDialog;exports.Models=e.Models;exports.Notebook=e.Notebook;exports.Package=e.Package;exports.Packages=e.Packages;exports.PageViewer=e.PageViewer;exports.QueryResult=e.QueryResult;exports.RenderedResult=e.RenderedResult;exports.ResultContainer=e.ResultContainer;exports.SourceExplorerComponent=e.SourceExplorerComponent;exports.SourcesExplorer=e.SourcesExplorer;exports.Workbook=e.Workbook;exports.WorkbookList=e.WorkbookList;exports.WorkbookManager=e.WorkbookManager;exports.WorkbookStorageProvider=e.WorkbookStorageProvider;exports.buildMalloyExplicitTheme=e.buildMalloyExplicitTheme;exports.buildTableCssVars=e.buildTableCssVars;exports.buildVegaThemeOverride=e.buildVegaThemeOverride;exports.createEmbeddedQueryResult=e.createEmbeddedQueryResult;exports.encodeResourceUri=e.encodeResourceUri;exports.extractDimensionSpecs=e.extractDimensionSpecs;exports.extractSourceFromQuery=e.extractSourceFromQuery;exports.generateFilterClause=e.generateFilterClause;exports.getDimensionKey=e.getDimensionKey;exports.getJoinedSources=e.getJoinedSources;exports.injectWhereClause=e.injectWhereClause;exports.makeDimensionKey=e.makeDimensionKey;exports.packageFileUrl=e.packageFileUrl;exports.parseAllSourceInfos=e.parseAllSourceInfos;exports.parseDimensionFilterAnnotation=e.parseDimensionFilterAnnotation;exports.parseNotebookFilterAnnotation=e.parseNotebookFilterAnnotation;exports.parseResourceUri=e.parseResourceUri;exports.readChartAnnotations=e.readChartAnnotations;exports.useDimensionFilters=e.useDimensionFilters;exports.useDimensionFiltersFromSpec=e.useDimensionFiltersFromSpec;exports.useDimensionFiltersQuery=e.useDimensionFiltersQuery;exports.useDimensionalFilterRangeData=e.useDimensionalFilterRangeData;exports.useGivensForm=e.useGivensForm;exports.useModelData=e.useModelData;exports.useModelGivens=e.useModelGivens;exports.useRawQueryData=e.useRawQueryData;exports.useRouterClickHandler=e.useRouterClickHandler;exports.DEFAULT_THEME=r.DEFAULT_THEME;exports.ServerProvider=r.ServerProvider;exports.ThemeProvider=r.ThemeProvider;exports.resolveMode=r.resolveMode;exports.resolveTheme=r.resolveTheme;exports.usePublisherTheme=r.usePublisherTheme;exports.useServer=r.useServer;
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as s,
|
|
2
|
-
import { aF as
|
|
1
|
+
import { A as s, U as o, C as r, a9 as i, D as n, I as t, E as l, q as u, H as d, L as m, M as c, r as k, t as p, v as g, F as D, N as E, B as F, P as b, G as S, Q as v, R as M, K as R, x, S as y, W as C, O as P, V as T, T as h, a3 as A, a4 as Q, a5 as W, J as H, a8 as L, g as U, i as G, j as K, $ as N, k as V, l as f, a0 as w, p as z, m as B, n as I, o as O, a7 as _, a6 as j, X as q, Y as J, Z as X, _ as Y, a2 as Z, y as $, a1 as ee, u as ae, e as se } from "./index-CjLRzHfD.es.js";
|
|
2
|
+
import { aF as re, S as ie, aH as ne, aG as te, aE as le, aq as ue, u as de } from "./ServerProvider-BupI3Smf.es.js";
|
|
3
3
|
export {
|
|
4
4
|
s as AnalyzePackageButton,
|
|
5
5
|
o as BrowserWorkbookStorage,
|
|
6
6
|
r as ConnectionExplorer,
|
|
7
|
-
|
|
7
|
+
re as DEFAULT_THEME,
|
|
8
8
|
i as DOC_LINKS,
|
|
9
9
|
n as DimensionFilter,
|
|
10
10
|
t as EmbeddedQueryResult,
|
|
@@ -15,19 +15,19 @@ export {
|
|
|
15
15
|
c as Materializations,
|
|
16
16
|
k as Model,
|
|
17
17
|
p as ModelExplorer,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
g as ModelExplorerDialog,
|
|
19
|
+
D as Models,
|
|
20
20
|
E as Notebook,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
F as Package,
|
|
22
|
+
b as Packages,
|
|
23
23
|
S as PageViewer,
|
|
24
24
|
v as QueryResult,
|
|
25
25
|
M as RenderedResult,
|
|
26
26
|
R as ResultContainer,
|
|
27
|
-
|
|
27
|
+
ie as ServerProvider,
|
|
28
28
|
x as SourceExplorerComponent,
|
|
29
29
|
y as SourcesExplorer,
|
|
30
|
-
|
|
30
|
+
ne as ThemeProvider,
|
|
31
31
|
C as Workbook,
|
|
32
32
|
P as WorkbookList,
|
|
33
33
|
T as WorkbookManager,
|
|
@@ -37,29 +37,30 @@ export {
|
|
|
37
37
|
W as buildVegaThemeOverride,
|
|
38
38
|
H as createEmbeddedQueryResult,
|
|
39
39
|
L as encodeResourceUri,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
U as extractDimensionSpecs,
|
|
41
|
+
G as extractSourceFromQuery,
|
|
42
|
+
K as generateFilterClause,
|
|
43
|
+
N as getDimensionKey,
|
|
44
44
|
V as getJoinedSources,
|
|
45
45
|
f as injectWhereClause,
|
|
46
46
|
w as makeDimensionKey,
|
|
47
|
-
z as
|
|
48
|
-
B as
|
|
49
|
-
I as
|
|
50
|
-
O as
|
|
51
|
-
_ as
|
|
52
|
-
|
|
53
|
-
te as
|
|
54
|
-
|
|
55
|
-
q as
|
|
56
|
-
J as
|
|
57
|
-
X as
|
|
58
|
-
Y as
|
|
59
|
-
Z as
|
|
60
|
-
$ as
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ae as
|
|
64
|
-
|
|
47
|
+
z as packageFileUrl,
|
|
48
|
+
B as parseAllSourceInfos,
|
|
49
|
+
I as parseDimensionFilterAnnotation,
|
|
50
|
+
O as parseNotebookFilterAnnotation,
|
|
51
|
+
_ as parseResourceUri,
|
|
52
|
+
j as readChartAnnotations,
|
|
53
|
+
te as resolveMode,
|
|
54
|
+
le as resolveTheme,
|
|
55
|
+
q as useDimensionFilters,
|
|
56
|
+
J as useDimensionFiltersFromSpec,
|
|
57
|
+
X as useDimensionFiltersQuery,
|
|
58
|
+
Y as useDimensionalFilterRangeData,
|
|
59
|
+
Z as useGivensForm,
|
|
60
|
+
$ as useModelData,
|
|
61
|
+
ee as useModelGivens,
|
|
62
|
+
ue as usePublisherTheme,
|
|
63
|
+
ae as useRawQueryData,
|
|
64
|
+
se as useRouterClickHandler,
|
|
65
|
+
de as useServer
|
|
65
66
|
};
|
|
@@ -22,3 +22,23 @@ export declare function isPublisherResizeMessage(data: unknown): data is Publish
|
|
|
22
22
|
* with the page's root-relative `resource`.
|
|
23
23
|
*/
|
|
24
24
|
export declare function serverBaseUrl(server: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Absolute URL of a file inside a package, as Publisher serves it:
|
|
27
|
+
* `<data origin>/environments/<env>/packages/<pkg>/<path>`.
|
|
28
|
+
*
|
|
29
|
+
* The one home for this string. Both the page viewer's iframe and the
|
|
30
|
+
* "this is not a model" page point at it, and hand-building it in each place is
|
|
31
|
+
* how the two drift.
|
|
32
|
+
*
|
|
33
|
+
* `path` is relative to the package's `public/` directory and is inserted as
|
|
34
|
+
* given, since it may contain slashes. A leading `public/` is dropped, because
|
|
35
|
+
* the served path does not include it and a caller passing a path a reader typed
|
|
36
|
+
* would otherwise produce `public/public/<file>`, which 404s. The server's own
|
|
37
|
+
* redirect drops it for the same reason.
|
|
38
|
+
*/
|
|
39
|
+
export declare function packageFileUrl({ server, environmentName, packageName, path, }: {
|
|
40
|
+
server: string;
|
|
41
|
+
environmentName: string;
|
|
42
|
+
packageName: string;
|
|
43
|
+
path: string;
|
|
44
|
+
}): string;
|
package/package.json
CHANGED
|
@@ -5,7 +5,10 @@ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
|
5
5
|
import { useServer } from "../ServerProvider";
|
|
6
6
|
import { MONO_FONT_FAMILY } from "../styles";
|
|
7
7
|
import { parseResourceUri } from "../../utils/formatting";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
isPublisherResizeMessage,
|
|
10
|
+
packageFileUrl,
|
|
11
|
+
} from "../../utils/pageEmbed";
|
|
9
12
|
|
|
10
13
|
interface PageViewerProps {
|
|
11
14
|
resourceUri: string;
|
|
@@ -47,11 +50,16 @@ export default function PageViewer({ resourceUri }: PageViewerProps) {
|
|
|
47
50
|
const packageName = parsed?.packageName ?? "";
|
|
48
51
|
const pagePath = parsed?.pagePath ?? "";
|
|
49
52
|
|
|
50
|
-
const standaloneUrl = useMemo(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const standaloneUrl = useMemo(
|
|
54
|
+
() =>
|
|
55
|
+
packageFileUrl({
|
|
56
|
+
server,
|
|
57
|
+
environmentName,
|
|
58
|
+
packageName,
|
|
59
|
+
path: pagePath,
|
|
60
|
+
}),
|
|
61
|
+
[server, environmentName, packageName, pagePath],
|
|
62
|
+
);
|
|
55
63
|
|
|
56
64
|
// Use the /pages endpoint to grab the <title> for the header. Any error
|
|
57
65
|
// here (older Publisher without /pages, transient network blip, 5xx) is
|
package/src/index.ts
CHANGED
|
@@ -5,4 +5,8 @@ export * from "./hooks";
|
|
|
5
5
|
export { useRawQueryData } from "./hooks/useRawQueryData";
|
|
6
6
|
export * from "./theme";
|
|
7
7
|
export * from "./utils/formatting";
|
|
8
|
+
// How a package's own files are addressed. Exported because a host that renders
|
|
9
|
+
// its own "this path is not a model" state has to point at the URL that does
|
|
10
|
+
// serve the file, and this is the one place that string is built.
|
|
11
|
+
export { packageFileUrl } from "./utils/pageEmbed";
|
|
8
12
|
export * from "./constants/docLinks";
|
package/src/utils/pageEmbed.ts
CHANGED
|
@@ -44,3 +44,38 @@ export function isPublisherResizeMessage(
|
|
|
44
44
|
export function serverBaseUrl(server: string): string {
|
|
45
45
|
return server.replace(/\/api\/v0\/?$/, "");
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Absolute URL of a file inside a package, as Publisher serves it:
|
|
50
|
+
* `<data origin>/environments/<env>/packages/<pkg>/<path>`.
|
|
51
|
+
*
|
|
52
|
+
* The one home for this string. Both the page viewer's iframe and the
|
|
53
|
+
* "this is not a model" page point at it, and hand-building it in each place is
|
|
54
|
+
* how the two drift.
|
|
55
|
+
*
|
|
56
|
+
* `path` is relative to the package's `public/` directory and is inserted as
|
|
57
|
+
* given, since it may contain slashes. A leading `public/` is dropped, because
|
|
58
|
+
* the served path does not include it and a caller passing a path a reader typed
|
|
59
|
+
* would otherwise produce `public/public/<file>`, which 404s. The server's own
|
|
60
|
+
* redirect drops it for the same reason.
|
|
61
|
+
*/
|
|
62
|
+
export function packageFileUrl({
|
|
63
|
+
server,
|
|
64
|
+
environmentName,
|
|
65
|
+
packageName,
|
|
66
|
+
path,
|
|
67
|
+
}: {
|
|
68
|
+
server: string;
|
|
69
|
+
environmentName: string;
|
|
70
|
+
packageName: string;
|
|
71
|
+
path: string;
|
|
72
|
+
}): string {
|
|
73
|
+
const relative = path.startsWith("public/")
|
|
74
|
+
? path.slice("public/".length)
|
|
75
|
+
: path;
|
|
76
|
+
return (
|
|
77
|
+
`${serverBaseUrl(server)}/environments/${encodeURIComponent(
|
|
78
|
+
environmentName,
|
|
79
|
+
)}/packages/${encodeURIComponent(packageName)}/` + relative
|
|
80
|
+
);
|
|
81
|
+
}
|