@malloy-publisher/sdk 0.7.0 → 0.8.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.
@@ -450,7 +450,7 @@ export interface CompileRequest {
450
450
  */
451
451
  'source'?: string;
452
452
  /**
453
- * What the source means, and how far the check reaches. \"append\" (default, the historical behavior) appends the source to the model in the URL and compiles it in that namespace — right for NEW definitions; an edit to an existing definition collides (\"Cannot redefine\"), and diagnostic positions land in the concatenated virtual file. \"file\" compiles the source AS that model, replacing its on-disk content for the check — validates an edit before saving, at true file coordinates. \"package\" runs the same worker compiler and file selection as reload over every .malloy and .malloynb file, without swapping the result into the served package; with a source, importers compile against the replacement. Package diagnostics can name files hidden from discovery. No rows or SQL are returned, and caller-provided source remains subject to authorize gates. includeSql is not available at \"package\". An invalid value is rejected with a 400 naming the valid set.
453
+ * What the source means, and how far the check reaches. \"append\" (default) appends the source to the model in the URL and compiles it in that namespace — right for NEW definitions; an edit to an existing definition collides (\"Cannot redefine\"), and diagnostic positions land in the concatenated virtual file. \"file\" compiles the source AS that model, replacing its on-disk content for the check — validates an edit before saving, at true file coordinates. \"package\" runs the same worker compiler and file selection as reload over every .malloy and .malloynb file, without swapping the result into the served package; with a source, importers compile against the replacement. Package diagnostics can name files hidden from discovery. No rows or SQL are returned, and caller-provided source remains subject to authorize gates. includeSql is not available at \"package\". \"append\" text is checked against the model\'s PUBLISHED surface, so it may not declare its own data roots: import, connection.table(…), connection.sql(…), given:, ##! compiler flags and the raw-SQL function forms (name!type(…), sql_number, sql_string and the rest of that family) are refused with a 400. Those belong in a model file, so validate text declaring them at \"file\" or \"package\", which are not restricted. \"append\" text must also stand alone as top-level Malloy: a bare view:, dimension: or measure:, and anything that only parses as a continuation of the model\'s last statement, is refused with a 400, because the check reads the submitted text by itself. Wrap a view body in a top-level query:, or a field in a throwaway source: check is <source> extend { … }. Compiling at \"append\" also requires the model named in the URL to load: a model that does not compile is a 400 carrying that model\'s own problems, and a model that does not exist is a 400 that deliberately says only that it could not be loaded. An invalid scope value is rejected with a 400 naming the valid set.
454
454
  * @type {string}
455
455
  * @memberof CompileRequest
456
456
  */
@@ -1510,6 +1510,31 @@ export interface GivenSuggest {
1510
1510
  */
1511
1511
  'givenNames'?: Array<string>;
1512
1512
  }
1513
+ /**
1514
+ * A join to a given-scoped source, declared on a persisted source and read per caller through the joined source\'s own artifact.
1515
+ * @export
1516
+ * @interface JoinedTerms
1517
+ */
1518
+ export interface JoinedTerms {
1519
+ /**
1520
+ * The join\'s alias as the author wrote it. Dotted for a join reached through another such join (`grant.team`).
1521
+ * @type {string}
1522
+ * @memberof JoinedTerms
1523
+ */
1524
+ 'alias': string;
1525
+ /**
1526
+ * The joined source\'s name — itself a persisted source.
1527
+ * @type {string}
1528
+ * @memberof JoinedTerms
1529
+ */
1530
+ 'source': string;
1531
+ /**
1532
+ * The joined source\'s own stripped terms, which its binding re-applies with the caller\'s values.
1533
+ * @type {Array<StrippedTerm>}
1534
+ * @memberof JoinedTerms
1535
+ */
1536
+ 'terms': Array<StrippedTerm>;
1537
+ }
1513
1538
  /**
1514
1539
  * One incremental source\'s `covered_through` boundary: the table it belongs to, the boundary itself, and the source definition it was measured under. Reported on the manifest entry of every incrementally refreshed source. A caller that owns the ledger stores each one and returns it verbatim in `BuildInstructions.ledger` on the next run — only the publisher derives these values. A returned entry is validated at create time: one naming a table the run does not instruct, or whose `sourceEntityId` is no longer the source\'s, is a 400. After a publish or rollback that changes the source, delete the entry (the source seeds) or set `reseed`.
1515
1540
  * @export
@@ -2522,6 +2547,12 @@ export interface PersistSourcePlan {
2522
2547
  * @memberof PersistSourcePlan
2523
2548
  */
2524
2549
  'strippedTerms'?: Array<StrippedTerm>;
2550
+ /**
2551
+ * The joins declared on this source whose TARGET is scoped by a given — one entry per such join, naming the joined source and the terms its own artifact re-applies. Absent or empty means no field of this source reads a caller-scoped join. These terms are not stripped from THIS artifact: a join is not part of a persist source\'s build, so this table holds the same rows with or without it. They are what makes a field reading through the join answer per caller (a visibility dimension that null-checks a grant table, say), and they are applied only by the joined source\'s own binding. So a reader serving this artifact must bind the joined source too; without it, the join cannot be re-emitted and any query reading through the alias must be served live.
2552
+ * @type {Array<JoinedTerms>}
2553
+ * @memberof PersistSourcePlan
2554
+ */
2555
+ 'joinedTerms'?: Array<JoinedTerms>;
2525
2556
  /**
2526
2557
  * 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.
2527
2558
  * @type {string}
@@ -3440,6 +3471,12 @@ export interface SourceFailure {
3440
3471
  * @memberof SourceFailure
3441
3472
  */
3442
3473
  'storageDestinationName'?: string;
3474
+ /**
3475
+ * True when the materialization-eligibility gate refused this source, so the build was never attempted and `reason` is the gate\'s message. A refusal is a property of the model, not of the run: retrying returns the same answer until the model changes, unlike a warehouse or compile failure, which may clear on its own. Absent for every other failure.
3476
+ * @type {boolean}
3477
+ * @memberof SourceFailure
3478
+ */
3479
+ 'refused'?: boolean;
3443
3480
  }
3444
3481
  /**
3445
3482
  *
@@ -13,6 +13,12 @@ interface DataAppViewerProps {
13
13
  * height changes; we listen and resize the iframe to match so embedded
14
14
  * dashboards don't get a nested scrollbar.
15
15
  *
16
+ * When those two origins differ, the worker serving the app must name this
17
+ * SPA's origin in `PUBLISHER_FRAME_ANCESTORS`. The server's default is
18
+ * `frame-ancestors 'self'`, which permits only its own origin, so a
19
+ * cross-origin embed is refused by the browser and the iframe renders blank
20
+ * with nothing logged server-side. A same-origin deployment needs no setting.
21
+ *
16
22
  * Full-screen apps (e.g. slide decks) can opt out of content-height sizing
17
23
  * with `<meta name="publisher:fit" content="viewport">`, surfaced as
18
24
  * `DataApp.fit === "viewport"`. The iframe then fills the available viewport
@@ -33,7 +33,38 @@ export interface MaterializationMetadata {
33
33
  trigger?: "ON_DEMAND" | "SCHEDULER";
34
34
  sourcesBuilt?: number;
35
35
  sourcesReused?: number;
36
+ /**
37
+ * Persist sources the eligibility gate refused, so the run skipped them and
38
+ * they serve live. Absent when the run refused nothing; the refused sources
39
+ * themselves are named in `refusedSources`, beside this count.
40
+ */
41
+ sourcesRefused?: number;
42
+ /**
43
+ * The sources auto-run refused, keyed by sourceID. An orchestrated run
44
+ * reports its refusals in the manifest's `failures` instead, marked
45
+ * `refused`; {@link refusedSourcesOf} reads both.
46
+ */
47
+ refusedSources?: Record<string, {
48
+ name: string;
49
+ message: string;
50
+ }>;
51
+ }
52
+ /** One source a run did not build because the eligibility gate refused it. */
53
+ export interface RunRefusal {
54
+ name: string;
55
+ message: string;
36
56
  }
57
+ /**
58
+ * Every source the run refused, from either place a run records one: the
59
+ * metadata list auto-run writes, and the `failures` an orchestrated run marks
60
+ * `refused`. Sorted by name so the list reads the same on every render.
61
+ */
62
+ export declare function refusedSourcesOf(materialization: Materialization): RunRefusal[];
63
+ /**
64
+ * The run's source counts, joined by `separator`. Refused sources are named
65
+ * only when there are some, so a clean run reads as it always has.
66
+ */
67
+ export declare function sourcesSummary(meta: MaterializationMetadata, separator: string): string;
37
68
  export declare function parseMetadata(materialization: Materialization): MaterializationMetadata;
38
69
  /** Human label for how a run was initiated. */
39
70
  export declare function triggerLabel(meta: MaterializationMetadata): "Scheduled" | "Manual";