@malloy-publisher/sdk 0.4.1 → 0.5.1
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/{DocumentStorage-BiFqO15i.es.js → DocumentStorage-DkwqA8SA.es.js} +2284 -2319
- package/dist/{DocumentStorage-CMyLifsz.cjs.js → DocumentStorage-mMn5SZ1c.cjs.js} +29 -29
- package/dist/{RenderedResult-CvrmYyr5.es.js → RenderedResult-CTD2Ej2S.es.js} +100 -80
- package/dist/{RenderedResult-CZzE8wv-.cjs.js → RenderedResult-GukOadCi.cjs.js} +27 -7
- package/dist/ServerProvider-CC9ein5-.cjs.js +1 -0
- package/dist/{ServerProvider-BWOEKg0O.es.js → ServerProvider-IzXlqSVe.es.js} +572 -553
- package/dist/builder/index.cjs.js +54 -49
- package/dist/builder/index.es.js +4124 -3521
- package/dist/client/api.d.ts +54 -2
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/Dashboard/TileCard.d.ts +7 -3
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +15 -4
- package/dist/components/DashboardBuilder/controls.d.ts +8 -6
- package/dist/components/DashboardBuilder/document.d.ts +19 -5
- package/dist/components/DashboardBuilder/malloyText.d.ts +0 -30
- package/dist/components/DashboardBuilder/malloyTree.d.ts +232 -0
- package/dist/components/DashboardBuilder/preview.d.ts +17 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +23 -28
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +12 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +5 -5
- package/dist/theme/resolveTheme.d.ts +1 -1
- package/dist/theme/types.d.ts +12 -2
- package/package.json +1 -1
- package/src/components/Dashboard/TileCard.tsx +8 -4
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +4 -5
- package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +356 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +116 -25
- package/src/components/DashboardBuilder/FilterDialog.tsx +19 -6
- package/src/components/DashboardBuilder/TileFrame.tsx +11 -2
- package/src/components/DashboardBuilder/TileMenu.tsx +6 -0
- package/src/components/DashboardBuilder/__test__/inventory.ts +367 -0
- package/src/components/DashboardBuilder/controls.spec.ts +53 -3
- package/src/components/DashboardBuilder/controls.ts +9 -7
- package/src/components/DashboardBuilder/document.ts +17 -5
- package/src/components/DashboardBuilder/invariants.spec.ts +297 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +27 -66
- package/src/components/DashboardBuilder/malloyText.ts +4 -109
- package/src/components/DashboardBuilder/malloyTree.spec.ts +362 -0
- package/src/components/DashboardBuilder/malloyTree.ts +954 -0
- package/src/components/DashboardBuilder/preview.spec.ts +18 -0
- package/src/components/DashboardBuilder/preview.ts +24 -6
- package/src/components/DashboardBuilder/readDocument.spec.ts +312 -21
- package/src/components/DashboardBuilder/readDocument.ts +144 -165
- package/src/components/DashboardBuilder/scannerShapes.spec.ts +550 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +955 -21
- package/src/components/DashboardBuilder/spliceDocument.ts +509 -119
- package/src/components/DashboardBuilder/statementExtent.spec.ts +606 -0
- package/src/components/RenderedResult/RenderedResult.tsx +21 -1
- package/src/components/given/GivensPanel.tsx +15 -3
- package/src/theme/buildTableCssVars.spec.ts +3 -0
- package/src/theme/buildTableCssVars.ts +6 -0
- package/src/theme/defaults.ts +16 -12
- package/src/theme/resolveTheme.spec.ts +14 -7
- package/src/theme/resolveTheme.ts +14 -8
- package/src/theme/types.ts +12 -2
- package/tsconfig.spec.json +5 -1
- package/dist/ServerProvider-Cc489A3f.cjs.js +0 -1
package/dist/client/api.d.ts
CHANGED
|
@@ -609,6 +609,12 @@ export interface Connection {
|
|
|
609
609
|
* @memberof Connection
|
|
610
610
|
*/
|
|
611
611
|
'fingerprint'?: string;
|
|
612
|
+
/**
|
|
613
|
+
* Optional, opaque entity tag for this connection\'s configuration, owned by whoever wrote the connection. The server stores it verbatim, returns it verbatim, and never derives, validates or interprets it; it has no meaning to Publisher itself. It exists so that a writer distributing this connection to several Publishers can tell which of them are still holding the configuration it last sent. The writer computes a tag over the configuration it is about to send, sends the two together, and compares the tag each server reports against the one it would send now — the same equality-only comparison an HTTP ETag supports, and no other operation is defined on it. A server that reports a different tag, or none, has not been given that configuration. Distinct from `fingerprint`, which identifies the DATA a connection reaches and deliberately excludes credentials so it survives rotation. This identifies the CONFIGURATION, credentials included, which is what makes it able to distinguish a server holding a rotated-away password from one holding the current one — a distinction no read can otherwise make, since credentials are never returned. The two change independently and neither substitutes for the other. It is returned on reads, because a writer that cannot read it back cannot compare it. Choose the value with that in mind: a digest over configuration that includes credentials does not reveal them, but it COMMITS to them, and a reader who can see the other inputs has a preimage with only the secret missing. If the connection is readable by anyone you would not hand the credential to, use a keyed digest, or keep this tag out of the reach of that reader. A write that does not carry a tag CLEARS it, rather than inheriting the stored one. The tag describes the configuration the writer that set it sent; an update that replaces that configuration without supplying a tag has invalidated it. This is also what keeps a writer convergent when it stops sending tags — it pushes its own config, the stale tag is dropped, and its next comparison agrees, where an inherited tag would differ from a config that writer itself just sent and make it re-push on every poll.
|
|
614
|
+
* @type {string}
|
|
615
|
+
* @memberof Connection
|
|
616
|
+
*/
|
|
617
|
+
'configEtag'?: string;
|
|
612
618
|
/**
|
|
613
619
|
* Per-query metadata: a flat bag of string properties attached to the statements a query issues, for the backend\'s own reporting — cost attribution, workload classification, tracing. Each backend applies it through a per-query mechanism: Snowflake a per-statement `QUERY_TAG` (the bag as JSON, so its properties are queryable in `QUERY_HISTORY`) — except on a `storage=` build, whose read goes through DuckDB\'s query-passthrough and so sets the tag for the SESSION, which means the driver\'s own connection probes carry the build\'s bag too, BigQuery per-job `labels` (queryable in `INFORMATION_SCHEMA.JOBS`), and every other backend a leading SQL comment (`-- team=\"finance\"`, visible in query history / `pg_stat_activity`). It never affects results, and it is excluded from connection fingerprints and from build identity, so changing a property never re-addresses or rebuilds anything. The contract, which every backend can render and which the connector enforces at dispatch: property names are ASCII alphanumerics and underscore (<=128 chars), values are printable ASCII without `\"` (<=256 chars), and a bag holds at most 20 properties. Declare a name starting with a LETTER: BigQuery drops a name it cannot fit to its label grammar while other backends keep it. Layers, most specific wins per property: connection default < package `queryMetadata` < model-file `## queryMetadata.*` < source `#@ queryMetadata.*` < per-request `queryMetadata`. The `materialization.` spellings of the package and model-file layers are deprecated and still read; where a file declares both, the canonical one wins per property. The publisher\'s own context (`class`, `environment`, `package`, `model`, `source`, `trigger`, `run_id`, `query_id`, `version`) is applied on top and cannot be overwritten — it is what the server is actually doing, and a caller must not be able to relabel it. Those names are also RESERVED against a MODEL-SIDE declaration: a package block, a model file or a `#@ persist` annotation declaring one has it DROPPED rather than attached. Context only overwrites a name it has a value for, and a served query has no `source`, `trigger` or `run_id` — so a declared one would otherwise ride interactive traffic and read, in the backend\'s own history, exactly like a build. A connection default and a per-request bag are not covered: a request setting `queryClass` is a caller describing its own call, while a model-side declaration rides every query against that source, including ones its author never sees. Put no secrets or personal data here: a tag is visible to anyone who can read the backend\'s query history, and on a backend with no native tag mechanism it is visible in the statement text.
|
|
614
620
|
* @type {{ [key: string]: string; }}
|
|
@@ -2222,7 +2228,7 @@ export interface Package {
|
|
|
2222
2228
|
*/
|
|
2223
2229
|
'exploresWarnings'?: Array<string>;
|
|
2224
2230
|
/**
|
|
2225
|
-
* Non-fatal findings collected when the package loaded, none of which stop the model compiling or the package loading. Render-tag findings: a render annotation (e.g. `# big_value`, `# currency` or `# colspan`) the renderer cannot apply as written, either malformed for the field it sits on, so it renders as \"[object Object]\" or an inline error at query time, or inert where it sits and silently ignored. Materialization findings: a `storage=` source not served from storage, a `#@ persist` source that was not recognized as materializable, a persist-target collision, and materialization-config problems that degrade attribution. Discovery findings: a model listed in `explores` whose export closure surfaces no sources or named queries, so it lists as empty and renders a blank page. Dashboard findings: a `dashboards/` file whose `# artifact` tag does not parse or does not describe a dashboard, a tile or suggest query that does not resolve, a `# drill` naming a destination that is not a dashboard, and a dashboard held back from the listing because its entry file is not in `explores`. Two dashboard findings are about Publisher rather than about the package: one when a file carrying an artifact tag could not be read and so is not served at all, and one when the lint stops early, in which case the list must be read as incomplete rather than as a clean package. Server-computed and read-only: ignored on create/update requests and only returned in responses. Present only when there are such findings. **Almost every `#@ preaggregate` that cannot be honored REJECTS A PUBLISH — a 400 at publish or PATCH — and fails a load thereafter.** The two access-modifier violations are the exception: they warn at BOTH gates and appear in this array. See the split below. Rejected are a `#@ preaggregate` anywhere but on a measure; a `#@ preaggregate` with no `grain=`; a grain naming anything but a dimension the base source itself declares, which rules out an inline time truncation such as `order_time.day`; a measure that cannot be correctly re-aggregated to a coarser grain, whether because its aggregate has no exact merge function (`count(distinct)`, `median`, percentiles, `mode`, and `avg` until it is decomposed) or because it carries its own filter, an ungrouping (`all`, `exclude`), or a required group-by; a measure whose expression cannot be POSITIVELY classified as re-aggregatable, which fails closed rather than being guessed at; a base source with a FAN-OUT join (`join_many` or `join_cross`), which can multiply rows, while a `join_one` is permitted and a measure aggregating through one is served normally; a base source that already fails persist eligibility (unbound parameters, `given` references, `#(authorize)` gates); `sharing=` or `schedule=` at the resource level; and a synthesized rollup name that collides with an existing model object. WARNED rather than rejected, at publish and at load alike, is a `#@ preaggregate` on a measure the source does not publicly expose, or a grain naming a hidden dimension — a rollup STORES its grain and each measure\'s partial, and the stored table is served under the base\'s name without the source\'s field visibility applying to it. Each names the measure and the fix. Refusing rather than silently dropping the measure is the deliberate choice. A dropped measure is not served from the rollup at ANY grain, so the declaration would have no effect whatsoever while still reading as applied — and the build cost of the rollup would still be paid. An author who writes `#@ preaggregate` on a measure that cannot be rolled up has made a modeling mistake, and an error is where a mistake belongs. The same verdict is enforced at LOAD for every violation EXCEPT the two access-modifier ones, so a package whose declarations stopped being honorable does not load at all: it is absent from its environment and reported in `ServerStatus.loadErrors`. Worth knowing because whether a measure can be re-aggregated is derived from the compiled model, so a Malloy version change can in principle reclassify a measure that published cleanly long before. That surfaces as a package that stops loading rather than as a package quietly serving without its rollups — louder, and deliberately so, since the alternative is paying for rollups that answer nothing. The two access-modifier violations are the deliberate exception, and for two reasons rather than a lesser severity. They WARN at publish and at load alike and appear in this array. First, a package annotating a hidden field published and loaded before this rule existed — refusing it would stop an already-published package from doing either because a new validation was added, which is not a thing a server upgrade may do. Second, the refusal was unfollowable: an annotation INHERITED onto a source that then hides the measure raises it, while that source produces no plan at all and nothing is exposed, so the advice to make the field public or drop the annotation asks an author to give up either the hiding or the rollup over a model that was already safe. Warning is safe here and would not be for the others: what keeps a hidden field out of a rollup is that the planner refuses to plan one at all, so no table is built and nothing can be served whether or not anyone reads the message. For the other violations the refusal IS the enforcement, which is why they stay fatal.
|
|
2231
|
+
* Non-fatal findings collected when the package loaded, none of which stop the model compiling or the package loading. Render-tag findings: a render annotation (e.g. `# big_value`, `# currency` or `# colspan`) the renderer cannot apply as written, either malformed for the field it sits on, so it renders as \"[object Object]\" or an inline error at query time, or inert where it sits and silently ignored. Materialization findings: a `storage=` source not served from storage, a `#@ persist` source that was not recognized as materializable, a `#@ persist` REFUSED by the compile-time eligibility gate (one entry per `BuildPlan.refusedSources` member, carrying that gate\'s own message), a persist-target collision, and materialization-config problems that degrade attribution. A refusal is the one materialization finding the build plan cannot also be read for: a refused `storage`/`colocated` source is ABSENT from `BuildPlan.sources`, so nothing there records that the annotation was written at all. Discovery findings: a model listed in `explores` whose export closure surfaces no sources or named queries, so it lists as empty and renders a blank page. Dashboard findings: a `dashboards/` file whose `# artifact` tag does not parse or does not describe a dashboard, a tile or suggest query that does not resolve, a `# drill` naming a destination that is not a dashboard, and a dashboard held back from the listing because its entry file is not in `explores`. Two dashboard findings are about Publisher rather than about the package: one when a file carrying an artifact tag could not be read and so is not served at all, and one when the lint stops early, in which case the list must be read as incomplete rather than as a clean package. Server-computed and read-only: ignored on create/update requests and only returned in responses. Present only when there are such findings. **Almost every `#@ preaggregate` that cannot be honored REJECTS A PUBLISH — a 400 at publish or PATCH — and fails a load thereafter.** The two access-modifier violations are the exception: they warn at BOTH gates and appear in this array. See the split below. Rejected are a `#@ preaggregate` anywhere but on a measure; a `#@ preaggregate` with no `grain=`; a grain naming anything but a dimension the base source itself declares, which rules out an inline time truncation such as `order_time.day`; a measure that cannot be correctly re-aggregated to a coarser grain, whether because its aggregate has no exact merge function (`count(distinct)`, `median`, percentiles, `mode`, and `avg` until it is decomposed) or because it carries its own filter, an ungrouping (`all`, `exclude`), or a required group-by; a measure whose expression cannot be POSITIVELY classified as re-aggregatable, which fails closed rather than being guessed at; a base source with a FAN-OUT join (`join_many` or `join_cross`), which can multiply rows, while a `join_one` is permitted and a measure aggregating through one is served normally; a base source that already fails persist eligibility (unbound parameters, `given` references, `#(authorize)` gates); `sharing=` or `schedule=` at the resource level; and a synthesized rollup name that collides with an existing model object. WARNED rather than rejected, at publish and at load alike, is a `#@ preaggregate` on a measure the source does not publicly expose, or a grain naming a hidden dimension — a rollup STORES its grain and each measure\'s partial, and the stored table is served under the base\'s name without the source\'s field visibility applying to it. Each names the measure and the fix. Refusing rather than silently dropping the measure is the deliberate choice. A dropped measure is not served from the rollup at ANY grain, so the declaration would have no effect whatsoever while still reading as applied — and the build cost of the rollup would still be paid. An author who writes `#@ preaggregate` on a measure that cannot be rolled up has made a modeling mistake, and an error is where a mistake belongs. The same verdict is enforced at LOAD for every violation EXCEPT the two access-modifier ones, so a package whose declarations stopped being honorable does not load at all: it is absent from its environment and reported in `ServerStatus.loadErrors`. Worth knowing because whether a measure can be re-aggregated is derived from the compiled model, so a Malloy version change can in principle reclassify a measure that published cleanly long before. That surfaces as a package that stops loading rather than as a package quietly serving without its rollups — louder, and deliberately so, since the alternative is paying for rollups that answer nothing. The two access-modifier violations are the deliberate exception, and for two reasons rather than a lesser severity. They WARN at publish and at load alike and appear in this array. First, a package annotating a hidden field published and loaded before this rule existed — refusing it would stop an already-published package from doing either because a new validation was added, which is not a thing a server upgrade may do. Second, the refusal was unfollowable: an annotation INHERITED onto a source that then hides the measure raises it, while that source produces no plan at all and nothing is exposed, so the advice to make the field public or drop the annotation asks an author to give up either the hiding or the rollup over a model that was already safe. Warning is safe here and would not be for the others: what keeps a hidden field out of a rollup is that the planner refuses to plan one at all, so no table is built and nothing can be served whether or not anyone reads the message. For the other violations the refusal IS the enforcement, which is why they stay fatal.
|
|
2226
2232
|
* @type {Array<PackageWarningsInner>}
|
|
2227
2233
|
* @memberof Package
|
|
2228
2234
|
*/
|
|
@@ -2503,6 +2509,18 @@ export interface PersistSourcePlan {
|
|
|
2503
2509
|
* @memberof PersistSourcePlan
|
|
2504
2510
|
*/
|
|
2505
2511
|
'sql': string;
|
|
2512
|
+
/**
|
|
2513
|
+
* The source\'s declared `#@ persist partition=` columns, resolved against its public projection and reported in the author\'s order, which is the order the stored table\'s directories nest in. Absent or empty means the table is written unpartitioned, which is the default and what every source built before this field existed means. A layout, not an access control. Every term the build strips from a source is re-applied when the artifact is read whether or not its column is partitioned, so a list omitting the column a caller is scoped by costs a full scan and never widens what that caller sees. Consumers should not infer isolation from it. `partition=` requires `storage=`; declared without one it is a publish refusal rather than an ignored key, so this is empty for every colocated source.
|
|
2514
|
+
* @type {Array<string>}
|
|
2515
|
+
* @memberof PersistSourcePlan
|
|
2516
|
+
*/
|
|
2517
|
+
'partition'?: Array<string>;
|
|
2518
|
+
/**
|
|
2519
|
+
* The source\'s extend-block `where:` conjuncts that reference a given — the terms Malloy leaves OUT of the build and that must be re-applied, with the caller\'s own values, whenever the artifact is read. Absent or empty means the artifact is the whole relation and needs no re-application. Reported so a consumer that supplies its own serve bindings can tell that this artifact is under-filtered on its own, and which givens a reader has to bind for it to be served correctly. The publisher\'s own serve path re-derives these from the compiled model rather than from here.
|
|
2520
|
+
* @type {Array<StrippedTerm>}
|
|
2521
|
+
* @memberof PersistSourcePlan
|
|
2522
|
+
*/
|
|
2523
|
+
'strippedTerms'?: Array<StrippedTerm>;
|
|
2506
2524
|
/**
|
|
2507
2525
|
* The source\'s declared `#@ persist ... refresh=...` value, reported verbatim; null = unset (which means \"full\"). Read and VALIDATED by the publisher, no longer an inert pass-through: a value outside {\"full\", \"incremental\"} is a publish rejection, and `refresh=\"incremental\"` additionally requires a `watermark=` naming one output dimension (see `annotationFields`). An incremental source advances its serving table by a bounded delta in place instead of being rebuilt, so the mode also governs the build path — which is why it is validated rather than passed through.
|
|
2508
2526
|
* @type {string}
|
|
@@ -3019,7 +3037,7 @@ export interface RefusedSource {
|
|
|
3019
3037
|
*/
|
|
3020
3038
|
'tier': RefusedSourceTierEnum;
|
|
3021
3039
|
/**
|
|
3022
|
-
* The bounded refusal reason. Only `free_parameter`, `given`, `
|
|
3040
|
+
* The bounded refusal reason. Only the compile-time reasons can appear here — `free_parameter`, `authorize`, `partition`, the four that name where a given the build could not strip sits (`given_in_persisted_query`, `dynamic_projection`, `dynamic_join`, `dynamic_joined_where`), the three that name an unusable `partition=` (`partition_without_storage`, `partition_column_unknown`, `partition_column_not_public`), `merge_key_scope_unresolved` (a `merge_key=` whose caller scope cannot be expressed over the stored table\'s own columns), and `preaggregate_over_dynamic_source` (a rollup whose base is scoped by a given, which has no read-time re-application to put the term back) — those being the only reasons the two compile-time eligibility asserts this collection is computed from produce. `given_in_persisted_query` is raised by BOTH gates, for one condition: the BUILD would substitute a given\'s value, so the artifact holds one caller\'s slice. On colocated that is a build that runs and lies; on a storage destination the same placement also leaves nothing for the read to re-apply. A given in the source\'s extend block is neither — it is left out of the build and applied per caller at read — and is admitted on both tiers. `given` is retained for records that already carry it and is no longer produced. It was the storage tier\'s blanket refusal of any given reference, and the positional reasons above replaced it: where a given sits decides the outcome, so a single reason covering every placement can no longer be raised. `not_duckdb_portable` is decided against the post-build captured schema, which does not exist at compile time, and `public_surface_unknown` is raised by the build-time narrowing of a stored table to the source\'s public columns; both are listed only because they share the enum the runtime eligibility metric uses.
|
|
3023
3041
|
* @type {string}
|
|
3024
3042
|
* @memberof RefusedSource
|
|
3025
3043
|
*/
|
|
@@ -3040,6 +3058,15 @@ export type RefusedSourceTierEnum = typeof RefusedSourceTierEnum[keyof typeof Re
|
|
|
3040
3058
|
export declare const RefusedSourceReasonEnum: {
|
|
3041
3059
|
readonly FreeParameter: "free_parameter";
|
|
3042
3060
|
readonly Given: "given";
|
|
3061
|
+
readonly GivenInPersistedQuery: "given_in_persisted_query";
|
|
3062
|
+
readonly DynamicProjection: "dynamic_projection";
|
|
3063
|
+
readonly DynamicJoin: "dynamic_join";
|
|
3064
|
+
readonly DynamicJoinedWhere: "dynamic_joined_where";
|
|
3065
|
+
readonly PartitionWithoutStorage: "partition_without_storage";
|
|
3066
|
+
readonly PartitionColumnUnknown: "partition_column_unknown";
|
|
3067
|
+
readonly PartitionColumnNotPublic: "partition_column_not_public";
|
|
3068
|
+
readonly MergeKeyScopeUnresolved: "merge_key_scope_unresolved";
|
|
3069
|
+
readonly PreaggregateOverDynamicSource: "preaggregate_over_dynamic_source";
|
|
3043
3070
|
readonly Authorize: "authorize";
|
|
3044
3071
|
readonly Partition: "partition";
|
|
3045
3072
|
readonly NotDuckdbPortable: "not_duckdb_portable";
|
|
@@ -3483,6 +3510,25 @@ export interface StartWatchRequest {
|
|
|
3483
3510
|
*/
|
|
3484
3511
|
'environmentName': string;
|
|
3485
3512
|
}
|
|
3513
|
+
/**
|
|
3514
|
+
* One `where:` conjunct a storage build leaves out of the artifact and the read puts back. Its `code` is the author\'s verbatim expression, which is what a serve shape re-emits; `givens` are the names that expression reads, which is what the shape must declare for it to compile.
|
|
3515
|
+
* @export
|
|
3516
|
+
* @interface StrippedTerm
|
|
3517
|
+
*/
|
|
3518
|
+
export interface StrippedTerm {
|
|
3519
|
+
/**
|
|
3520
|
+
* The author\'s verbatim filter expression, e.g. `org_id = $ORG_ID`.
|
|
3521
|
+
* @type {string}
|
|
3522
|
+
* @memberof StrippedTerm
|
|
3523
|
+
*/
|
|
3524
|
+
'code': string;
|
|
3525
|
+
/**
|
|
3526
|
+
* The given names this term reads, in first-seen order. A reader must bind these for the term to apply; binding none applies each given\'s declared default, as a live query would.
|
|
3527
|
+
* @type {Array<string>}
|
|
3528
|
+
* @memberof StrippedTerm
|
|
3529
|
+
*/
|
|
3530
|
+
'givens': Array<string>;
|
|
3531
|
+
}
|
|
3486
3532
|
/**
|
|
3487
3533
|
*
|
|
3488
3534
|
* @export
|
|
@@ -3851,6 +3897,12 @@ export interface TrinoConnection {
|
|
|
3851
3897
|
* @interface UpdateConnectionRequest
|
|
3852
3898
|
*/
|
|
3853
3899
|
export interface UpdateConnectionRequest {
|
|
3900
|
+
/**
|
|
3901
|
+
* The writer\'s opaque tag for the configuration this update produces. Declared here because the rest of this body is a hand-picked subset of `Connection` rather than a partial of it, and a writer that could not send the tag on the endpoint it rotates credentials through could only ever clear it — an update that omits the tag drops the stored one, since the configuration that tag described has been replaced. See the field on `Connection` for what it is and how it is compared.
|
|
3902
|
+
* @type {string}
|
|
3903
|
+
* @memberof UpdateConnectionRequest
|
|
3904
|
+
*/
|
|
3905
|
+
'configEtag'?: string;
|
|
3854
3906
|
/**
|
|
3855
3907
|
*
|
|
3856
3908
|
* @type {ConnectionProxy}
|
package/dist/client/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-CC9ein5-.cjs.js");exports.AttachedDatabaseTypeEnum=e.AttachedDatabaseTypeEnum;exports.AzureConnectionAuthTypeEnum=e.AzureConnectionAuthTypeEnum;exports.CompileProblemSeverityEnum=e.CompileProblemSeverityEnum;exports.CompileRequestScopeEnum=e.CompileRequestScopeEnum;exports.CompileResultStatusEnum=e.CompileResultStatusEnum;exports.Configuration=e.Configuration;exports.ConnectionProxyTypeEnum=e.ConnectionProxyTypeEnum;exports.ConnectionStatusStatusEnum=e.ConnectionStatusStatusEnum;exports.ConnectionTypeEnum=e.ConnectionTypeEnum;exports.ConnectionsApi=e.ConnectionsApi;exports.ConnectionsApiAxiosParamCreator=e.ConnectionsApiAxiosParamCreator;exports.ConnectionsApiFactory=e.ConnectionsApiFactory;exports.ConnectionsApiFp=e.ConnectionsApiFp;exports.ConnectionsTestApi=e.ConnectionsTestApi;exports.ConnectionsTestApiAxiosParamCreator=e.ConnectionsTestApiAxiosParamCreator;exports.ConnectionsTestApiFactory=e.ConnectionsTestApiFactory;exports.ConnectionsTestApiFp=e.ConnectionsTestApiFp;exports.DashboardsApi=e.DashboardsApi;exports.DashboardsApiAxiosParamCreator=e.DashboardsApiAxiosParamCreator;exports.DashboardsApiFactory=e.DashboardsApiFactory;exports.DashboardsApiFp=e.DashboardsApiFp;exports.DataAppFitEnum=e.DataAppFitEnum;exports.DataAppsApi=e.DataAppsApi;exports.DataAppsApiAxiosParamCreator=e.DataAppsApiAxiosParamCreator;exports.DataAppsApiFactory=e.DataAppsApiFactory;exports.DataAppsApiFp=e.DataAppsApiFp;exports.DatabaseTypeEnum=e.DatabaseTypeEnum;exports.DatabasesApi=e.DatabasesApi;exports.DatabasesApiAxiosParamCreator=e.DatabasesApiAxiosParamCreator;exports.DatabasesApiFactory=e.DatabasesApiFactory;exports.DatabasesApiFp=e.DatabasesApiFp;exports.EnvironmentsApi=e.EnvironmentsApi;exports.EnvironmentsApiAxiosParamCreator=e.EnvironmentsApiAxiosParamCreator;exports.EnvironmentsApiFactory=e.EnvironmentsApiFactory;exports.EnvironmentsApiFp=e.EnvironmentsApiFp;exports.ExecuteNotebookCellBypassFiltersEnum=e.ExecuteNotebookCellBypassFiltersEnum;exports.FilterTypeEnum=e.FilterTypeEnum;exports.FreshnessFallbackEnum=e.FreshnessFallbackEnum;exports.GivenControlEnum=e.GivenControlEnum;exports.LedgerEntryStrategyEnum=e.LedgerEntryStrategyEnum;exports.LogMessageSeverityEnum=e.LogMessageSeverityEnum;exports.ManifestEntryFreshnessFallbackEnum=e.ManifestEntryFreshnessFallbackEnum;exports.ManifestEntryOriginEnum=e.ManifestEntryOriginEnum;exports.ManifestEntryRefreshEnum=e.ManifestEntryRefreshEnum;exports.MaterializationActionActionEnum=e.MaterializationActionActionEnum;exports.MaterializationStatus=e.MaterializationStatus;exports.MaterializationsApi=e.MaterializationsApi;exports.MaterializationsApiAxiosParamCreator=e.MaterializationsApiAxiosParamCreator;exports.MaterializationsApiFactory=e.MaterializationsApiFactory;exports.MaterializationsApiFp=e.MaterializationsApiFp;exports.ModelsApi=e.ModelsApi;exports.ModelsApiAxiosParamCreator=e.ModelsApiAxiosParamCreator;exports.ModelsApiFactory=e.ModelsApiFactory;exports.ModelsApiFp=e.ModelsApiFp;exports.NotebookCellResultTypeEnum=e.NotebookCellResultTypeEnum;exports.NotebookCellTypeEnum=e.NotebookCellTypeEnum;exports.NotebooksApi=e.NotebooksApi;exports.NotebooksApiAxiosParamCreator=e.NotebooksApiAxiosParamCreator;exports.NotebooksApiFactory=e.NotebooksApiFactory;exports.NotebooksApiFp=e.NotebooksApiFp;exports.PackageEmbeddingIndexStatusEnum=e.PackageEmbeddingIndexStatusEnum;exports.PackageManifestBindingStatusEnum=e.PackageManifestBindingStatusEnum;exports.PackageQueryableSourcesEnum=e.PackageQueryableSourcesEnum;exports.PackageScopeEnum=e.PackageScopeEnum;exports.PackageStorageServeBindingsInnerOriginEnum=e.PackageStorageServeBindingsInnerOriginEnum;exports.PackageWarningsInnerSeverityEnum=e.PackageWarningsInnerSeverityEnum;exports.PackagesApi=e.PackagesApi;exports.PackagesApiAxiosParamCreator=e.PackagesApiAxiosParamCreator;exports.PackagesApiFactory=e.PackagesApiFactory;exports.PackagesApiFp=e.PackagesApiFp;exports.PersistSourcePlanOriginEnum=e.PersistSourcePlanOriginEnum;exports.PostgresConnectionSslmodeEnum=e.PostgresConnectionSslmodeEnum;exports.PublisherApi=e.PublisherApi;exports.PublisherApiAxiosParamCreator=e.PublisherApiAxiosParamCreator;exports.PublisherApiFactory=e.PublisherApiFactory;exports.PublisherApiFp=e.PublisherApiFp;exports.QueryClass=e.QueryClass;exports.QueryResultQueryRowLimitSourceEnum=e.QueryResultQueryRowLimitSourceEnum;exports.QueryResultServedFromEnum=e.QueryResultServedFromEnum;exports.Realization=e.Realization;exports.RefusedSourceReasonEnum=e.RefusedSourceReasonEnum;exports.RefusedSourceTierEnum=e.RefusedSourceTierEnum;exports.RunContextTriggerEnum=e.RunContextTriggerEnum;exports.S3ConnectionProviderEnum=e.S3ConnectionProviderEnum;exports.ServerProvider=e.ServerProvider;exports.ServerStatusOperationalStateEnum=e.ServerStatusOperationalStateEnum;exports.ThemeDefaultModeEnum=e.ThemeDefaultModeEnum;exports.WatchModeApi=e.WatchModeApi;exports.WatchModeApiAxiosParamCreator=e.WatchModeApiAxiosParamCreator;exports.WatchModeApiFactory=e.WatchModeApiFactory;exports.WatchModeApiFp=e.WatchModeApiFp;exports.globalQueryClient=e.globalQueryClient;exports.useServer=e.useServer;
|
package/dist/client/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, a as i, C as o, b as n, c as t, aC as r, e as p, f as u, d as A, O as m, I as c, K as E, J as l, X as C, U as y, W as P, V as F, $ as b, Y as g, _ as d, Z as S, D as k, a3 as M, a0 as h, a2 as x, a1 as v, h as D, a7 as T, a4 as R, a6 as f, a5 as z, ab as N, a8 as Q, aa as W, a9 as B, ap as O, F as I, i as L, G as q, L as w, j, k as G, M as H, l as J, ag as K, m as U, af as V, ac as X, ae as Y, ad as Z, ak as _, ah as $, aj as aa, ai as sa, n as ea, N as ia, ao as oa, al as na, an as ta, am as ra, q as pa, p as ua, o as Aa, P as ma, r as ca, s as Ea, at as la, aq as Ca, as as ya, ar as Pa, t as Fa, v as ba, ax as ga, au as da, aw as Sa, av as ka, Q as Ma, w as ha, x as xa, R as va, z as Da, y as Ta, B as Ra, E as fa, S as za, H as Na, T as Qa, aB as Wa, ay as Ba, aA as Oa, az as Ia, g as La, u as qa } from "../ServerProvider-
|
|
1
|
+
import { A as e, a as i, C as o, b as n, c as t, aC as r, e as p, f as u, d as A, O as m, I as c, K as E, J as l, X as C, U as y, W as P, V as F, $ as b, Y as g, _ as d, Z as S, D as k, a3 as M, a0 as h, a2 as x, a1 as v, h as D, a7 as T, a4 as R, a6 as f, a5 as z, ab as N, a8 as Q, aa as W, a9 as B, ap as O, F as I, i as L, G as q, L as w, j, k as G, M as H, l as J, ag as K, m as U, af as V, ac as X, ae as Y, ad as Z, ak as _, ah as $, aj as aa, ai as sa, n as ea, N as ia, ao as oa, al as na, an as ta, am as ra, q as pa, p as ua, o as Aa, P as ma, r as ca, s as Ea, at as la, aq as Ca, as as ya, ar as Pa, t as Fa, v as ba, ax as ga, au as da, aw as Sa, av as ka, Q as Ma, w as ha, x as xa, R as va, z as Da, y as Ta, B as Ra, E as fa, S as za, H as Na, T as Qa, aB as Wa, ay as Ba, aA as Oa, az as Ia, g as La, u as qa } from "../ServerProvider-IzXlqSVe.es.js";
|
|
2
2
|
export {
|
|
3
3
|
e as AttachedDatabaseTypeEnum,
|
|
4
4
|
i as AzureConnectionAuthTypeEnum,
|
|
@@ -5,9 +5,13 @@ import { ReactNode } from 'react';
|
|
|
5
5
|
* draws a stand-in tile when it has no server to run one, draws the same card
|
|
6
6
|
* the reader does rather than restating its geometry.
|
|
7
7
|
*
|
|
8
|
-
* The instance theme's
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The instance theme's `cardBorder`, not MUI's `divider` and not the `border`
|
|
9
|
+
* a table's gridlines take: the renderer card's edge is this same value, and a
|
|
10
|
+
* card that agrees with the theme everywhere except its outline still reads as
|
|
11
|
+
* a different card. Both surfaces moved together when the edge was darkened;
|
|
12
|
+
* either one left behind is a dashboard whose tiles are outlined two ways.
|
|
13
|
+
*
|
|
14
|
+
* Radius stays on the host's
|
|
11
15
|
* `shape.borderRadius`, which the renderer card is pointed at too. The
|
|
12
16
|
* background is `theme.tile`, the value the renderer card paints — left unset,
|
|
13
17
|
* on a theme whose page is also white the composite tiles lost the tint that
|
|
@@ -17,11 +17,22 @@ import { DashboardEventHandler } from '../Dashboard/telemetry';
|
|
|
17
17
|
* editor (its value is written into each tile's query) but reaches the package
|
|
18
18
|
* only when the file is saved into it.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type DashboardEditorProps = ({
|
|
21
|
+
/** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
|
|
22
|
+
resourceUri: string;
|
|
23
|
+
/** The dashboard's slug, as listed by the dashboards endpoint. */
|
|
24
|
+
dashboard: string;
|
|
25
|
+
} | {
|
|
26
|
+
/** @deprecated Pass `resourceUri` and `dashboard` instead. */
|
|
21
27
|
environmentName: string;
|
|
28
|
+
/** @deprecated Pass `resourceUri` and `dashboard` instead. */
|
|
22
29
|
packageName: string;
|
|
23
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Pass `resourceUri` and `dashboard` instead. The
|
|
32
|
+
* dashboard's slug: `overview`, not `dashboards/overview.malloy`.
|
|
33
|
+
*/
|
|
24
34
|
dashboardName: string;
|
|
35
|
+
}) & {
|
|
25
36
|
/** Leave the editor: the host's "Done editing". Absent, no such button. */
|
|
26
37
|
onExit?: () => void;
|
|
27
38
|
/**
|
|
@@ -38,5 +49,5 @@ export interface DashboardEditorProps {
|
|
|
38
49
|
* without this a host cannot tell whether leaving costs anything.
|
|
39
50
|
*/
|
|
40
51
|
onDirtyChange?: (dirty: boolean) => void;
|
|
41
|
-
}
|
|
42
|
-
export declare function DashboardEditor(
|
|
52
|
+
};
|
|
53
|
+
export declare function DashboardEditor(props: DashboardEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -126,12 +126,14 @@ export interface MappingRow {
|
|
|
126
126
|
/**
|
|
127
127
|
* Which tiles can take a binding, and why the others cannot.
|
|
128
128
|
*
|
|
129
|
-
* A binding is a
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
129
|
+
* A binding is a `where:` the splice writer can locate and own: a `+ {
|
|
130
|
+
* where: … }` refinement on a `reference` tile, or a `where:` statement in an
|
|
131
|
+
* `inline` tile's own first stage — `TreeStage.wheres` in `malloyTree`, which
|
|
132
|
+
* is the parse tree's answer rather than a depth count. Both forms are
|
|
133
|
+
* declarations this file owns and the reader reads back. An `inherited` tile is declared on the
|
|
134
|
+
* model's source, which the builder never writes, so it is the one kind this
|
|
135
|
+
* excludes, and so is an `opaque` one: its body has no single block a binding
|
|
136
|
+
* belongs in, which the reader can see before a save is ever attempted.
|
|
135
137
|
*/
|
|
136
138
|
export declare const canBind: (tile: DashboardTile) => boolean;
|
|
137
139
|
/** The mapping a control has NOW, one row per tile, for the dialog to open on. */
|
|
@@ -97,15 +97,24 @@ export interface DashboardDrill {
|
|
|
97
97
|
/**
|
|
98
98
|
* Where a tile's view is declared, and therefore what the builder may edit.
|
|
99
99
|
*
|
|
100
|
-
*
|
|
100
|
+
* Four forms, all of them found in dashboards that ship in this repository, and
|
|
101
101
|
* the distinction decides which affordances a tile gets:
|
|
102
102
|
*
|
|
103
103
|
* - `reference` — `view: revenue_trend is sales_by_month` in this file. Fully
|
|
104
104
|
* editable: the layout tags sit above that line and the builder owns them.
|
|
105
105
|
* - `inline` — `view: order_tile is { aggregate: order_count }` in this file.
|
|
106
|
-
* Its tags are editable for the same reason
|
|
107
|
-
*
|
|
108
|
-
*
|
|
106
|
+
* Its tags are editable for the same reason, and so is a FILTER: a binding is
|
|
107
|
+
* a depth-1 `where:` statement in the body's own first stage rather than a `+
|
|
108
|
+
* { … }` refinement, but it is still a declaration this file owns and the
|
|
109
|
+
* reader reads back — see {@link DashboardTile.filters} and BINDING_CLAUSE in
|
|
110
|
+
* readDocument.ts. The QUERY otherwise is not editable, because authoring a
|
|
111
|
+
* query body is a separate feature; the body is never rewritten beyond its
|
|
112
|
+
* binding lines, so the rest of it cannot be damaged.
|
|
113
|
+
* - `opaque` — declared in this file, in a body the builder does not rewrite: a
|
|
114
|
+
* `->` pipeline from a named view, or a chained `vx + { … } + { … }` where no
|
|
115
|
+
* one block is where a binding belongs. Its TAGS are ordinary `#` lines here,
|
|
116
|
+
* so its label, colspan and position are editable like any other tile's; only
|
|
117
|
+
* a FILTER has nowhere to go, and `why` says which shape it is.
|
|
109
118
|
* - `inherited` — not declared in this file at all, as in a dashboard whose only
|
|
110
119
|
* tile is `orders -> by_brand` against an imported source. Nothing about it is
|
|
111
120
|
* editable here, because its tags live on the model's own view and the builder
|
|
@@ -116,6 +125,9 @@ export type TileDeclaration = {
|
|
|
116
125
|
from: string;
|
|
117
126
|
} | {
|
|
118
127
|
kind: "inline";
|
|
128
|
+
} | {
|
|
129
|
+
kind: "opaque";
|
|
130
|
+
why: string;
|
|
119
131
|
} | {
|
|
120
132
|
kind: "inherited";
|
|
121
133
|
};
|
|
@@ -136,7 +148,9 @@ export interface DashboardTile {
|
|
|
136
148
|
source: string;
|
|
137
149
|
declaration: TileDeclaration;
|
|
138
150
|
/**
|
|
139
|
-
* Given bindings
|
|
151
|
+
* Given bindings: a `+ { where: … }` refinement on a `reference` tile, or a
|
|
152
|
+
* depth-1 `where:` statement in an `inline` tile's own first stage — see
|
|
153
|
+
* {@link TileDeclaration}.
|
|
140
154
|
*
|
|
141
155
|
* `op` is the comparison, and absent means `~`, which is how a `filter<…>`
|
|
142
156
|
* given binds. A plain `date` or `number` given is a VALUE, not a filter,
|
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
export declare const isIdentifier: (text: string) => boolean;
|
|
2
|
-
/** A one-line `<keyword>: <name> is <rest>` declaration. */
|
|
3
|
-
export interface DeclarationAt {
|
|
4
|
-
line: number;
|
|
5
|
-
/** Everything after `is`, trimmed: a base view, an expression, or `{`. */
|
|
6
|
-
rest: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* The `<keyword>:` declarations under `source: <owner>`, in file order. The
|
|
10
|
-
* body of a source ends at the next top-level declaration or `##` line.
|
|
11
|
-
*/
|
|
12
|
-
export declare function declarationsUnder(lines: string[], owner: string, keyword: "view" | "dimension"): Map<string, DeclarationAt>;
|
|
13
|
-
/** The line declaring `<keyword>: <name> is`, or -1. */
|
|
14
|
-
export declare function declarationLine(lines: string[], keyword: "view" | "source", name: string): number;
|
|
15
2
|
/** The line carrying the model-level `## artifact` tag, or -1. */
|
|
16
3
|
export declare const artifactLine: (lines: string[]) => number;
|
|
17
|
-
/** A `given:` declaration: its line, and the block header when it is in one. */
|
|
18
|
-
export interface GivenAt {
|
|
19
|
-
line: number;
|
|
20
|
-
blockHeader?: number;
|
|
21
|
-
/** `NAME :: type is default`, as written. */
|
|
22
|
-
declaration: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Every `given:` declaration, by name, in both spellings Malloy accepts:
|
|
26
|
-
*
|
|
27
|
-
* given: CATEGORY :: filter<string> is f'' // one per line
|
|
28
|
-
*
|
|
29
|
-
* given: // a block
|
|
30
|
-
* CATEGORY :: filter<string> is f''
|
|
31
|
-
* SINCE :: date is @2023-01-01
|
|
32
|
-
*/
|
|
33
|
-
export declare function givenDeclarations(lines: string[]): Map<string, GivenAt>;
|
|
34
4
|
/** A tile expression's steps: `orders -> by_brand + { limit: 2 }`. */
|
|
35
5
|
export interface TileSteps {
|
|
36
6
|
source: string;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where everything in a dashboard file IS, according to Malloy's own parser.
|
|
3
|
+
*
|
|
4
|
+
* The only module that touches the parse tree. The reader and the writer both
|
|
5
|
+
* locate through it, which is what makes a reader/writer disagreement about
|
|
6
|
+
* where a declaration starts or ends impossible rather than unlikely — the
|
|
7
|
+
* defect class that every hand-written scan here kept reintroducing.
|
|
8
|
+
*
|
|
9
|
+
* The rule the rest of the builder follows: LOCATORS come from this module,
|
|
10
|
+
* RECOGNIZERS may read text over a span this module bounded, and EMITTERS take
|
|
11
|
+
* positions only from a span or a token here. Nothing outside re-derives
|
|
12
|
+
* Malloy's grammar from raw text.
|
|
13
|
+
*
|
|
14
|
+
* Node identity is by ACCESSOR, never `constructor.name`: `@malloydata/malloy`
|
|
15
|
+
* is a peerDependency, so the host bundler minifies it and every class name
|
|
16
|
+
* becomes a single letter. Accessor and token names are properties, which
|
|
17
|
+
* minifiers leave alone.
|
|
18
|
+
*/
|
|
19
|
+
/** A half-open range of UTF-16 offsets into the source text. */
|
|
20
|
+
export interface Span {
|
|
21
|
+
start: number;
|
|
22
|
+
end: number;
|
|
23
|
+
}
|
|
24
|
+
/** Anything the writer has to find again: where it is, and on which line. */
|
|
25
|
+
export interface Positioned {
|
|
26
|
+
span: Span;
|
|
27
|
+
/** 0-based, to index the `lines` array the tag scan still works in. */
|
|
28
|
+
line: number;
|
|
29
|
+
}
|
|
30
|
+
/** A `field <op> $GIVEN` comparison: the only filter shape the builder owns. */
|
|
31
|
+
export interface TreeBinding {
|
|
32
|
+
field: string;
|
|
33
|
+
op: string;
|
|
34
|
+
given: string;
|
|
35
|
+
}
|
|
36
|
+
/** One entry of a `where:` clause list, whether or not the builder owns it. */
|
|
37
|
+
export interface TreeClause extends Positioned {
|
|
38
|
+
binding?: TreeBinding;
|
|
39
|
+
/**
|
|
40
|
+
* Every `$GIVEN` this clause references, binding or not. A clause the
|
|
41
|
+
* builder does not own that names a given is what makes binding that given
|
|
42
|
+
* again a double filter, and the tree says so exactly — a scan for `$NAME`
|
|
43
|
+
* could be fooled by an apostrophe in a comment, and was.
|
|
44
|
+
*/
|
|
45
|
+
givens: string[];
|
|
46
|
+
}
|
|
47
|
+
/** A `where:` statement, with its clauses located individually. */
|
|
48
|
+
export interface TreeWhere extends Positioned {
|
|
49
|
+
clauses: TreeClause[];
|
|
50
|
+
}
|
|
51
|
+
/** A `{ … }` query-properties block: a view body, or a `+ { … }` refinement. */
|
|
52
|
+
export interface TreeStage {
|
|
53
|
+
/** The whole block, both braces included. */
|
|
54
|
+
span: Span;
|
|
55
|
+
/** Just after `{`, and at `}` — where a first or last statement goes. */
|
|
56
|
+
openEnd: number;
|
|
57
|
+
closeStart: number;
|
|
58
|
+
statements: Positioned[];
|
|
59
|
+
/** This block's OWN `where:`s. A nested `nest:`'s never appear here. */
|
|
60
|
+
wheres: TreeWhere[];
|
|
61
|
+
/** The indent a sibling statement sits at, for anything inserted. */
|
|
62
|
+
indent: string;
|
|
63
|
+
/** True when `{ … }` is written on one line, which changes how we insert. */
|
|
64
|
+
oneLine: boolean;
|
|
65
|
+
}
|
|
66
|
+
export type TreeViewBody =
|
|
67
|
+
/** `view: v is base` or `view: v is base + { … }`. */
|
|
68
|
+
{
|
|
69
|
+
kind: "reference";
|
|
70
|
+
from: string;
|
|
71
|
+
fromSpan: Span;
|
|
72
|
+
refinement?: TreeStage;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `view: v is { … }`, or the first stage of `{ … } -> { … }`. Only the
|
|
76
|
+
* first stage is ever the tile's own, so `pipeline` says a later one
|
|
77
|
+
* follows and nothing may be appended to the end of the declaration.
|
|
78
|
+
*/
|
|
79
|
+
| {
|
|
80
|
+
kind: "inline";
|
|
81
|
+
stage: TreeStage;
|
|
82
|
+
pipeline?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** `view: v is a -> b`, and anything else: read, never rewritten. */
|
|
85
|
+
| {
|
|
86
|
+
kind: "unsupported";
|
|
87
|
+
why: string;
|
|
88
|
+
};
|
|
89
|
+
export interface TreeView extends Positioned {
|
|
90
|
+
name: string;
|
|
91
|
+
/** `name is <expr>` — this entry alone, not the `view:` statement. */
|
|
92
|
+
span: Span;
|
|
93
|
+
/** The whole `view: …` statement, its `#` tag block included. */
|
|
94
|
+
statement: Span;
|
|
95
|
+
/** The `#` tag lines of that statement, in order. */
|
|
96
|
+
tags: Array<{
|
|
97
|
+
line: number;
|
|
98
|
+
text: string;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* How many views the one `view:` statement declares. Above 1 it is a
|
|
102
|
+
* comma-separated list, which the writer refuses to restructure.
|
|
103
|
+
*/
|
|
104
|
+
siblings: number;
|
|
105
|
+
body: TreeViewBody;
|
|
106
|
+
}
|
|
107
|
+
export interface TreeDimension extends Positioned {
|
|
108
|
+
name: string;
|
|
109
|
+
expression: string;
|
|
110
|
+
statement: Span;
|
|
111
|
+
tags: Array<{
|
|
112
|
+
line: number;
|
|
113
|
+
text: string;
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
export interface TreeSource extends Positioned {
|
|
117
|
+
name: string;
|
|
118
|
+
/** What it extends, as written — `orders`, or `` `odd name` ``. */
|
|
119
|
+
base: string;
|
|
120
|
+
/**
|
|
121
|
+
* The `source: …` statement, from the start of its line. Its `#` tag block
|
|
122
|
+
* is NOT included: the parser puts a source's annotations outside the rule's
|
|
123
|
+
* own range, and this type has no `tags` field to hold them either. A caller
|
|
124
|
+
* that wants them walks up from `line` with {@link ParsedMalloy.blockStart}.
|
|
125
|
+
*/
|
|
126
|
+
statement: Span;
|
|
127
|
+
/** The `extend { … }` block, when it has one. */
|
|
128
|
+
properties?: TreeStage;
|
|
129
|
+
views: TreeView[];
|
|
130
|
+
dimensions: TreeDimension[];
|
|
131
|
+
/** Source-level `where:`s, which are the source's own and not a tile's. */
|
|
132
|
+
wheres: TreeWhere[];
|
|
133
|
+
}
|
|
134
|
+
export interface TreeGiven extends Positioned {
|
|
135
|
+
name: string;
|
|
136
|
+
/** `NAME :: type is default`, as written. */
|
|
137
|
+
declaration: string;
|
|
138
|
+
statement: Span;
|
|
139
|
+
tags: Array<{
|
|
140
|
+
line: number;
|
|
141
|
+
text: string;
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* The line of the `given:` keyword, when this is one entry of a block
|
|
145
|
+
* rather than a one-line declaration. Removing the last entry of a block
|
|
146
|
+
* has to take the header with it.
|
|
147
|
+
*/
|
|
148
|
+
blockHeader?: number;
|
|
149
|
+
}
|
|
150
|
+
export interface TreeImport extends Positioned {
|
|
151
|
+
/** The path, with its quotes stripped. */
|
|
152
|
+
from: string;
|
|
153
|
+
/** The `{ a, b }` selection, when there is one. */
|
|
154
|
+
names?: string[];
|
|
155
|
+
statement: Span;
|
|
156
|
+
}
|
|
157
|
+
export interface ParsedMalloy {
|
|
158
|
+
text: string;
|
|
159
|
+
/** 0-based line -> offset of its first character. */
|
|
160
|
+
lineStarts: number[];
|
|
161
|
+
imports: TreeImport[];
|
|
162
|
+
sources: TreeSource[];
|
|
163
|
+
givens: TreeGiven[];
|
|
164
|
+
/** The comment token on `line`, if the line ends with one. */
|
|
165
|
+
trailingComment(line: number): Span | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* The first comment that starts inside `span`, of either token kind. A
|
|
168
|
+
* writer deleting a range wider than one node's own text asks this before
|
|
169
|
+
* it does, because a comment is trivia to the parser: it sits outside every
|
|
170
|
+
* span, so neither gate can see it go.
|
|
171
|
+
*/
|
|
172
|
+
commentIn(span: Span): Span | undefined;
|
|
173
|
+
/** Every comment in the file, in order, `//` and `--` and `/* … *\/`. */
|
|
174
|
+
comments: Span[];
|
|
175
|
+
/**
|
|
176
|
+
* Whether `line` is comment rather than code — including a line in the
|
|
177
|
+
* middle of a `/* … *\/`, whose text is prose however it begins.
|
|
178
|
+
*/
|
|
179
|
+
commentLine(line: number): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The `#`/comment block immediately above `line`, stopping at a blank line —
|
|
182
|
+
* the unit that travels with a declaration when it moves.
|
|
183
|
+
*/
|
|
184
|
+
blockStart(line: number): number;
|
|
185
|
+
}
|
|
186
|
+
export interface ParseRefusal {
|
|
187
|
+
ok: false;
|
|
188
|
+
reason: string;
|
|
189
|
+
line?: number;
|
|
190
|
+
}
|
|
191
|
+
export type ParseResult = {
|
|
192
|
+
ok: true;
|
|
193
|
+
parsed: ParsedMalloy;
|
|
194
|
+
} | ParseRefusal;
|
|
195
|
+
export declare const parseRefused: (r: ParseResult) => r is ParseRefusal;
|
|
196
|
+
/**
|
|
197
|
+
* Parse `text`, or refuse.
|
|
198
|
+
*
|
|
199
|
+
* A file with ANY syntax error is refused rather than edited. ANTLR recovers
|
|
200
|
+
* from an error by inventing structure: measured on a file with one, the tree
|
|
201
|
+
* reports a view that is not there, a range that runs backwards, and drops
|
|
202
|
+
* every declaration after the error — all without raising anything a caller
|
|
203
|
+
* could notice. An edit located in that tree deletes real code, and neither
|
|
204
|
+
* the read-back gate nor the parse gate can see it. The server cannot compile
|
|
205
|
+
* such a file either, so the way out of one is the code editor, not this.
|
|
206
|
+
*/
|
|
207
|
+
export declare function parseMalloy(text: string): Promise<ParseResult>;
|
|
208
|
+
/** One of the translator's complaints. */
|
|
209
|
+
export interface MalloyProblem {
|
|
210
|
+
code?: string;
|
|
211
|
+
message?: string;
|
|
212
|
+
}
|
|
213
|
+
/** One parse of one file, stopped at the parse step. */
|
|
214
|
+
export interface Translation {
|
|
215
|
+
problems: MalloyProblem[];
|
|
216
|
+
parse?: {
|
|
217
|
+
root?: unknown;
|
|
218
|
+
tokenStream?: unknown;
|
|
219
|
+
malloyVersion?: string;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The ONE place the translator's shape is written down. `@malloydata/malloy` is
|
|
224
|
+
* a peer dependency, so nothing here can import its types and every caller has
|
|
225
|
+
* to hand-type a cast; a second copy is a second thing to miss when the shape
|
|
226
|
+
* upstream moves.
|
|
227
|
+
*
|
|
228
|
+
* The translation stops at the first step. A document with imports comes back
|
|
229
|
+
* asking for urls, by which point it has been parsed and nothing has been
|
|
230
|
+
* resolved -- so callers see every syntax error and none of the semantic ones.
|
|
231
|
+
*/
|
|
232
|
+
export declare function translate(text: string, url: string): Promise<Translation>;
|
|
@@ -56,5 +56,22 @@ export interface PreviewTileQuery {
|
|
|
56
56
|
* `where: brand ~ f'Nike'`, from `values` and the declaration's type; with no
|
|
57
57
|
* value yet it is left out, which is what an empty filter means. A binding to
|
|
58
58
|
* a given neither side knows is left out too.
|
|
59
|
+
*
|
|
60
|
+
* An inline tile takes the SAME path as a reference: `view: x is { … }` names
|
|
61
|
+
* a view on the extension exactly as `view: x is base_view` does, so
|
|
62
|
+
* `source -> x + { where: … }` runs it refined. Without this, a bound control
|
|
63
|
+
* on an inline tile — most tiles in practice — looked like it did nothing in
|
|
64
|
+
* the live editor, and sent no given at all once saved.
|
|
65
|
+
*
|
|
66
|
+
* ADDITIVE, though, where a reference is exact. A reference tile refines its
|
|
67
|
+
* BASE view, which carries no bindings, so the preview is what the writer is
|
|
68
|
+
* about to produce. An inline tile has no base to name: `x` is the saved view,
|
|
69
|
+
* whose body already holds whatever bindings were saved into it, and this runs
|
|
70
|
+
* against the package's own model rather than the edited text. So adding a
|
|
71
|
+
* binding previews correctly, while REMOVING one leaves the saved `where:`
|
|
72
|
+
* filtering and CHANGING one applies the old and the new together, until the
|
|
73
|
+
* file is saved. Previewing those exactly would need the body re-emitted
|
|
74
|
+
* without its bindings, which this builder deliberately does not do: it
|
|
75
|
+
* splices, and never writes a view's body out from the document.
|
|
59
76
|
*/
|
|
60
77
|
export declare function previewTileQuery(document: DashboardDocument, tile: DashboardTile, runnable: ReadonlySet<string>, values?: ReadonlyMap<string, GivenValue>): PreviewTileQuery;
|