@malloy-publisher/sdk 0.4.1 → 0.5.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.
Files changed (59) hide show
  1. package/dist/{DocumentStorage-BiFqO15i.es.js → DocumentStorage-B04sZ5Ie.es.js} +2284 -2319
  2. package/dist/{DocumentStorage-CMyLifsz.cjs.js → DocumentStorage-B_MMJ0Ot.cjs.js} +29 -29
  3. package/dist/{RenderedResult-CvrmYyr5.es.js → RenderedResult-BB7eokcf.es.js} +100 -80
  4. package/dist/{RenderedResult-CZzE8wv-.cjs.js → RenderedResult-DVuGhatg.cjs.js} +27 -7
  5. package/dist/ServerProvider-D-jjzfE5.cjs.js +1 -0
  6. package/dist/{ServerProvider-BWOEKg0O.es.js → ServerProvider-Do-GBvpn.es.js} +492 -481
  7. package/dist/builder/index.cjs.js +54 -49
  8. package/dist/builder/index.es.js +4124 -3521
  9. package/dist/client/api.d.ts +14 -1
  10. package/dist/client/index.cjs.js +1 -1
  11. package/dist/client/index.es.js +1 -1
  12. package/dist/components/Dashboard/TileCard.d.ts +7 -3
  13. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +15 -4
  14. package/dist/components/DashboardBuilder/controls.d.ts +8 -6
  15. package/dist/components/DashboardBuilder/document.d.ts +19 -5
  16. package/dist/components/DashboardBuilder/malloyText.d.ts +0 -30
  17. package/dist/components/DashboardBuilder/malloyTree.d.ts +232 -0
  18. package/dist/components/DashboardBuilder/preview.d.ts +17 -0
  19. package/dist/components/DashboardBuilder/readDocument.d.ts +23 -28
  20. package/dist/components/DashboardBuilder/spliceDocument.d.ts +12 -0
  21. package/dist/index.cjs.js +1 -1
  22. package/dist/index.es.js +5 -5
  23. package/dist/theme/resolveTheme.d.ts +1 -1
  24. package/dist/theme/types.d.ts +12 -2
  25. package/package.json +1 -1
  26. package/src/components/Dashboard/TileCard.tsx +8 -4
  27. package/src/components/DashboardBuilder/BuilderToolbar.tsx +4 -5
  28. package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +356 -0
  29. package/src/components/DashboardBuilder/DashboardEditor.tsx +116 -25
  30. package/src/components/DashboardBuilder/FilterDialog.tsx +19 -6
  31. package/src/components/DashboardBuilder/TileFrame.tsx +11 -2
  32. package/src/components/DashboardBuilder/TileMenu.tsx +6 -0
  33. package/src/components/DashboardBuilder/__test__/inventory.ts +367 -0
  34. package/src/components/DashboardBuilder/controls.spec.ts +53 -3
  35. package/src/components/DashboardBuilder/controls.ts +9 -7
  36. package/src/components/DashboardBuilder/document.ts +17 -5
  37. package/src/components/DashboardBuilder/invariants.spec.ts +297 -0
  38. package/src/components/DashboardBuilder/malloyText.spec.ts +27 -66
  39. package/src/components/DashboardBuilder/malloyText.ts +4 -109
  40. package/src/components/DashboardBuilder/malloyTree.spec.ts +362 -0
  41. package/src/components/DashboardBuilder/malloyTree.ts +954 -0
  42. package/src/components/DashboardBuilder/preview.spec.ts +18 -0
  43. package/src/components/DashboardBuilder/preview.ts +24 -6
  44. package/src/components/DashboardBuilder/readDocument.spec.ts +312 -21
  45. package/src/components/DashboardBuilder/readDocument.ts +144 -165
  46. package/src/components/DashboardBuilder/scannerShapes.spec.ts +550 -0
  47. package/src/components/DashboardBuilder/spliceDocument.spec.ts +955 -21
  48. package/src/components/DashboardBuilder/spliceDocument.ts +509 -119
  49. package/src/components/DashboardBuilder/statementExtent.spec.ts +606 -0
  50. package/src/components/RenderedResult/RenderedResult.tsx +21 -1
  51. package/src/components/given/GivensPanel.tsx +15 -3
  52. package/src/theme/buildTableCssVars.spec.ts +3 -0
  53. package/src/theme/buildTableCssVars.ts +6 -0
  54. package/src/theme/defaults.ts +16 -12
  55. package/src/theme/resolveTheme.spec.ts +14 -7
  56. package/src/theme/resolveTheme.ts +14 -8
  57. package/src/theme/types.ts +12 -2
  58. package/tsconfig.spec.json +5 -1
  59. package/dist/ServerProvider-Cc489A3f.cjs.js +0 -1
@@ -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; }}
@@ -3019,7 +3025,7 @@ export interface RefusedSource {
3019
3025
  */
3020
3026
  'tier': RefusedSourceTierEnum;
3021
3027
  /**
3022
- * The bounded refusal reason. Only `free_parameter`, `given`, `authorize` and `partition` can appear here — those are the only reasons the two compile-time eligibility asserts this collection is computed from produce. `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.
3028
+ * The bounded refusal reason. Only `free_parameter`, `given`, `given_in_persisted_query`, `authorize` and `partition` can appear here — those are the only reasons the two compile-time eligibility asserts this collection is computed from produce. `given_in_persisted_query` is the colocated refusal for a given the BUILD would substitute (one inside the persisted query, as opposed to the source\'s extend block, where it is applied per caller at read); `given` is the storage refusal, which covers either placement. `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
3029
  * @type {string}
3024
3030
  * @memberof RefusedSource
3025
3031
  */
@@ -3040,6 +3046,7 @@ export type RefusedSourceTierEnum = typeof RefusedSourceTierEnum[keyof typeof Re
3040
3046
  export declare const RefusedSourceReasonEnum: {
3041
3047
  readonly FreeParameter: "free_parameter";
3042
3048
  readonly Given: "given";
3049
+ readonly GivenInPersistedQuery: "given_in_persisted_query";
3043
3050
  readonly Authorize: "authorize";
3044
3051
  readonly Partition: "partition";
3045
3052
  readonly NotDuckdbPortable: "not_duckdb_portable";
@@ -3851,6 +3858,12 @@ export interface TrinoConnection {
3851
3858
  * @interface UpdateConnectionRequest
3852
3859
  */
3853
3860
  export interface UpdateConnectionRequest {
3861
+ /**
3862
+ * 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.
3863
+ * @type {string}
3864
+ * @memberof UpdateConnectionRequest
3865
+ */
3866
+ 'configEtag'?: string;
3854
3867
  /**
3855
3868
  *
3856
3869
  * @type {ConnectionProxy}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-Cc489A3f.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-D-jjzfE5.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;
@@ -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-BWOEKg0O.es.js";
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-Do-GBvpn.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 border, not MUI's `divider`: the renderer card's edge is
9
- * this same value, and a card that agrees with the theme everywhere except its
10
- * outline still reads as a different card. Radius stays on the host's
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 interface DashboardEditorProps {
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
- /** The dashboard's slug: `overview`, not `dashboards/overview.malloy`. */
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({ environmentName, packageName, dashboardName, onExit, onEvent, onDirtyChange, }: DashboardEditorProps): import("react/jsx-runtime").JSX.Element;
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 `+ { where: … }` refinement on the tile's declaration, so the
130
- * tile has to BE a declaration this file owns that the reader will read back.
131
- * That is the `reference` form only: an `inherited` tile is declared on the
132
- * model's source, and an `inline` tile's body is a query, not a reference, so a
133
- * refinement written onto it would not come back and the round-trip gate would
134
- * refuse the whole save. Better to refuse the tick.
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
- * Three forms, all of them found in dashboards that ship in this repository, and
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; its QUERY is not, because
107
- * authoring a query body is a separate feature. The projection holds: the body
108
- * is never rewritten, so it cannot be damaged.
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, emitted as a `+ { where: … }` refinement on the view.
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;
@@ -1,4 +1,5 @@
1
1
  import { DashboardDocument, LocalGiven } from './document';
2
+ import { ParsedMalloy } from './malloyTree';
2
3
  /**
3
4
  * Read a `dashboards/*.malloy` file into a {@link DashboardDocument}.
4
5
  *
@@ -7,10 +8,10 @@ import { DashboardDocument, LocalGiven } from './document';
7
8
  * in the browser and in a unit test alike, which is what lets the suite open
8
9
  * every dashboard in the repository as a regression gate.
9
10
  *
10
- * Structure comes from the parser's symbol tree, which covers imports (including
11
- * the items of a named list), sources, views and dimensions, each with a source
12
- * RANGE. Content comes from the text inside those ranges, and tags from
13
- * `parseAnnotation` over the block above each declaration.
11
+ * Structure comes from Malloy's own parse tree, through `malloyTree`: imports,
12
+ * sources, views, dimensions, givens and every `where:` clause, each with an
13
+ * exact span. Tags come from `parseAnnotation` over the `#` block above a
14
+ * declaration, which is `malloy-tag`'s grammar rather than Malloy's.
14
15
  *
15
16
  * Reading tags from the text rather than from the server, which serves them
16
17
  * already attached, is deliberate. The splice writer has to LOCATE a tag in
@@ -43,7 +44,7 @@ export type ReadResult = {
43
44
  * does not typecheck, in a codebase where most code never notices.
44
45
  */
45
46
  export declare const readFailed: (result: ReadResult) => result is ReadFailure;
46
- /** A `#`/`//` block above a declaration, and where it sits. */
47
+ /** A `#`/comment block above a declaration, and where it sits. */
47
48
  export interface Block {
48
49
  /** 0-based line of the first line in the block. */
49
50
  start: number;
@@ -57,23 +58,22 @@ export interface Block {
57
58
  }>;
58
59
  }
59
60
  /**
60
- * The comment-and-tag block immediately above `declLine`.
61
+ * The comment-and-tag block immediately above `declLine`, up to the blank line
62
+ * that is the author's own separator. Validated against the bundled dashboard,
63
+ * where it collects `revenue_trend`'s three tags and the fourteen-line comment
64
+ * explaining its colspan, then stops at the blank line above — which is the
65
+ * right unit to carry when that tile moves.
61
66
  *
62
- * Scans upward while lines are `#` tags or `//` comments and STOPS AT A BLANK
63
- * LINE. Validated against the bundled dashboard, where it collects
64
- * `revenue_trend`'s three tags and the fourteen-line comment explaining its
65
- * colspan, then stops at the blank line above — which is the right unit to carry
66
- * when that tile moves.
67
- *
68
- * A blank line is the author's own separator, which is why it is the boundary
69
- * rather than a count or a heuristic about comment content.
70
- */
71
- export declare function blockAbove(lines: string[], declLine: number): Block;
72
- /**
73
- * One `where: <field> <op> $<GIVEN>` clause. Exported for the writer, which
74
- * has to find the same clauses in order to replace them and nothing else.
67
+ * WHERE the block starts comes from `parsed`, which takes its comments from the
68
+ * lexer, and not from a scan for `//` here. Malloy spells a comment three ways
69
+ * — `//`, `--` and `/* … *\/` — and this walked upward looking only for the
70
+ * first. The other two stopped it early while the parser read straight past
71
+ * them, so a `#` tag above one was visible to the reader and invisible to the
72
+ * writer, which then wrote a SECOND copy of the tag below the comment. The
73
+ * reader picks the lower one up and the read-back gate is satisfied, so the
74
+ * file quietly ends up carrying two.
75
75
  */
76
- export declare const BINDING_CLAUSE: RegExp;
76
+ export declare function blockAbove(parsed: ParsedMalloy, lines: string[], declLine: number): Block;
77
77
  /**
78
78
  * A tag object, as `parseAnnotation` returns it. Only the reads this file makes.
79
79
  */
@@ -86,10 +86,7 @@ type ParseTags = (lines: string[]) => {
86
86
  tag?: TagLike | null;
87
87
  };
88
88
  /**
89
- * `given:` declarations, which the parser's symbol tree does not cover at all —
90
- * its types are query, unnamed_query, explore, field, join, import and
91
- * import_item. So these are read as text, in BOTH spellings Malloy accepts and
92
- * this repository uses:
89
+ * `given:` declarations, in BOTH spellings Malloy accepts:
93
90
  *
94
91
  * given: CATEGORY :: filter<string> is f'' // one per line
95
92
  *
@@ -97,10 +94,8 @@ type ParseTags = (lines: string[]) => {
97
94
  * CATEGORY :: filter<string> is f''
98
95
  * SINCE :: date is @2023-01-01
99
96
  *
100
- * The one-line form is what `givens.malloy` and the docs write and what the
101
- * builder emits; the block form is read so a file written the other way still
102
- * opens. Either way the tags above a declaration are its control contract.
97
+ * Either way the `#` tags above a declaration are its control contract.
103
98
  */
104
- export declare function localGivens(lines: string[], parse: ParseTags): LocalGiven[] | undefined;
99
+ export declare function localGivens(parsed: ParsedMalloy, lines: string[], parse: ParseTags): LocalGiven[] | undefined;
105
100
  export declare function readDashboardDocument(sourceText: string): Promise<ReadResult>;
106
101
  export {};
@@ -1,4 +1,16 @@
1
1
  import { DashboardDocument, DashboardTile } from './document';
2
+ /**
3
+ * The syntax errors Malloy's own parser reports for `text`, as a multiset of
4
+ * messages.
5
+ *
6
+ * The first `translate()` is enough and is all we want: a document with
7
+ * imports comes back NOT final, asking for the urls it needs, and by then the
8
+ * parse has already happened while nothing has been resolved. So this sees
9
+ * every syntax error and none of the semantic ones, which are not this
10
+ * writer's business -- a dashboard referring to a source in a file we decline
11
+ * to hand over is not damage we caused.
12
+ */
13
+ export declare function syntaxErrors(text: string): Promise<string[]>;
2
14
  /**
3
15
  * Write a change back into a `dashboards/*.malloy` file by PATCHING it.
4
16
  *