@holistics/anfra-sdk 0.8.0 → 0.9.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 +7 -3
- package/dist/api.d.ts +4 -1341
- package/dist/api.js +7 -3
- package/dist/app.d.ts +15 -5
- package/dist/app.js +36 -7
- package/dist/{bridge-BmbS9J4V.d.ts → bridge-DUKdREoK.d.ts} +7 -2
- package/dist/common.d.ts +2 -2
- package/dist/host.d.ts +2 -2
- package/dist/host.js +43 -20
- package/dist/types-DznT0m7F.d.ts +2238 -0
- package/package.json +1 -1
- package/dist/types-IR4TNw-M.d.ts +0 -645
package/README.md
CHANGED
|
@@ -70,6 +70,10 @@ font without it falls back.
|
|
|
70
70
|
`Anfra.datasets` describes what there is to query. For TypeScript, `@holistics/anfra-sdk/ambient` declares the
|
|
71
71
|
global.
|
|
72
72
|
|
|
73
|
+
`Anfra.lineage({ parent: 'orders', child: 'amount' })` traces fields through the repo's catalog, each named
|
|
74
|
+
by its parent and its name in it: what each is built from, as a diagram to draw (`results[i].diagram`), or
|
|
75
|
+
why it could not be (`results[i].error`). It reads the catalog the host last ingested (`anfra ingest`).
|
|
76
|
+
|
|
73
77
|
A definition can mark its parts, so a host's inspect panel can show them as a tree and find them on
|
|
74
78
|
the page:
|
|
75
79
|
|
|
@@ -104,7 +108,7 @@ const mounted = mountDataApp({
|
|
|
104
108
|
baseHref: '/appserve/files/sales/', // where its relative URLs resolve
|
|
105
109
|
datasets,
|
|
106
110
|
user,
|
|
107
|
-
backend: coreApiBackend(client, { datasets }), // queries, field suggestions and exports, as core ops
|
|
111
|
+
backend: coreApiBackend(client, { datasets }), // queries, field suggestions and exports, as core ops; lineage as core.lineage
|
|
108
112
|
render: true, // let it save PNGs and PDFs of itself (off by default)
|
|
109
113
|
});
|
|
110
114
|
// mounted.setInspecting(true) to receive inspection snapshots; mounted.render({ format: 'pdf' }) to
|
|
@@ -112,14 +116,14 @@ const mounted = mountDataApp({
|
|
|
112
116
|
```
|
|
113
117
|
|
|
114
118
|
`mountDataApp` puts the definition in an iframe with `sandbox="allow-scripts"`, as its `srcdoc`,
|
|
115
|
-
with the frame bootstrap and the provisioned data ahead of it. The bootstrap's Backend forwards each call to the host over postMessage; the host answers it with the Backend it was given. An export's file is saved from the host's page, by following its link: the frame can't download. A Backend without `exportQuery` makes a host that can't export, and its frames see `Anfra.features.export` false.
|
|
119
|
+
with the frame bootstrap and the provisioned data ahead of it. The bootstrap's Backend forwards each call to the host over postMessage; the host answers it with the Backend it was given. An export's file is saved from the host's page, by following its link: the frame can't download. A Backend without `exportQuery` makes a host that can't export, and its frames see `Anfra.features.export` false; likewise a Backend without `lineage`, and `Anfra.features.lineage`.
|
|
116
120
|
|
|
117
121
|
## The boundary
|
|
118
122
|
|
|
119
123
|
A Data App definition can come from any author, often an agent, which may not think of security while building an analysis. So the SDK guards it for its author, and makes the safe way the easy one:
|
|
120
124
|
|
|
121
125
|
- Its frame has an opaque origin. Its own requests to the API are cross-origin, which `anfra serve` refuses, and carry no credentials on a platform that has them.
|
|
122
|
-
- The bridge answers only the Backend's methods, `submitQuery`, `fieldSuggestions` and `
|
|
126
|
+
- The bridge answers only the Backend's methods, `submitQuery`, `fieldSuggestions`, `exportQuery` and the optional `lineage`, and the two a rendering needs, the renderer's code and saving its file. Nothing else of the API is reachable from a frame.
|
|
123
127
|
- `@holistics/anfra-sdk/app` imports only `common`: the script injected into a frame carries no API client. A test on the built frame script holds this.
|
|
124
128
|
|
|
125
129
|
## Development
|