react-semaphor 0.1.468 → 0.1.470
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +110 -106
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{analyze-result-contract-kaCNxjA7.js → analyze-result-contract-B3agc2XU.js} +1 -1
- package/dist/chunks/{analyze-result-contract-CMwVg9w2.cjs → analyze-result-contract-OgPk-zGu.cjs} +1 -1
- package/dist/chunks/{common-types-tRK8fhXV.cjs → common-types-C1IM7gao.cjs} +1 -1
- package/dist/chunks/{common-types-BgI-ymBp.js → common-types-g_1fKJLK.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DjBmkS6v.js → dashboard-briefing-launcher-DEVbQCQE.js} +9 -9
- package/dist/chunks/{dashboard-briefing-launcher-Bo4GmnB7.cjs → dashboard-briefing-launcher-exfJnSop.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CstKugeB.cjs → dashboard-controls-8D1m_ECN.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CvrCyVPZ.js → dashboard-controls-DPK-CRWL.js} +9 -9
- package/dist/chunks/{dashboard-filter-value-compatibility-o-kufPZB.js → dashboard-filter-value-compatibility-BAaqJGjt.js} +78 -78
- package/dist/chunks/dashboard-filter-value-compatibility-CYrWe1U6.cjs +1 -0
- package/dist/chunks/{dashboard-input-contract-12mPNhCF.cjs → dashboard-input-contract-JFJZgenC.cjs} +1 -1
- package/dist/chunks/{dashboard-input-contract-Ciboc347.js → dashboard-input-contract-Vr_3ApfF.js} +1 -1
- package/dist/chunks/{dashboard-json-D9r_xere.js → dashboard-json-DVWLTmIJ.js} +7 -7
- package/dist/chunks/{dashboard-json-ZGqzmExU.cjs → dashboard-json-DhKOoHwK.cjs} +1 -1
- package/dist/chunks/edit-dashboard-visual-B6zidwTu.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-D64tmqA4.js → edit-dashboard-visual-CxEC3bPx.js} +7283 -7417
- package/dist/chunks/{editor-action-buttons-BXJlZl7z.cjs → editor-action-buttons-B3S00DsB.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-C2msc_en.js → editor-action-buttons-HfJ-Bohl.js} +6 -6
- package/dist/chunks/{index-CQN-X1jN.cjs → index-B4VxBoJg.cjs} +1 -1
- package/dist/chunks/index-DVBYvkj0.cjs +1404 -0
- package/dist/chunks/{index-DO4BESNy.js → index-oVXvCLH-.js} +9 -9
- package/dist/chunks/{index-B6cfDHwn.js → index-tsB3LfTQ.js} +33898 -33887
- package/dist/chunks/matrix-result-contract-DoU9diAh.js +822 -0
- package/dist/chunks/matrix-result-contract-SrzyG_KQ.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-OpY8xzdT.js → pivot-header-presentation-BW0Ay7WV.js} +2 -2
- package/dist/chunks/{pivot-header-presentation-DyV0iOZ_.cjs → pivot-header-presentation-DVBTHug2.cjs} +1 -1
- package/dist/chunks/{pivot-result-identity-CCMpd8ZA.js → pivot-result-identity-5v4hRVbc.js} +1 -1
- package/dist/chunks/{pivot-result-identity-gsOwOjHi.cjs → pivot-result-identity-DRUlTWUq.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-CEfU43GZ.cjs → pivot-result-lifecycle-DJgO2P0H.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-B38AZx4a.js → pivot-result-lifecycle-O_roVguV.js} +7 -7
- package/dist/chunks/{raw-temporal-contract-r_EMdR85.js → raw-temporal-contract-BEMf3avg.js} +1 -1
- package/dist/chunks/{raw-temporal-contract-UdblxoVB.cjs → raw-temporal-contract-D8YuxTAg.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-Dvy818KV.js → report-preferences-dialog-D-VpoQJz.js} +6 -6
- package/dist/chunks/{report-preferences-dialog-B89ypIJ-.cjs → report-preferences-dialog-DvNWNrlj.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-CcXUjpb-.js → report-runtime-context-DnNbpkGo.js} +1 -1
- package/dist/chunks/{report-runtime-context-CLtzrZdC.cjs → report-runtime-context-RFiWq4wK.cjs} +1 -1
- package/dist/chunks/{saved-temporal-bucket-format-hylaofsQ.js → saved-temporal-bucket-format-CygnBDO2.js} +24 -24
- package/dist/chunks/{saved-temporal-bucket-format-Ca4hUfTo.cjs → saved-temporal-bucket-format-DNMtD77o.cjs} +1 -1
- package/dist/chunks/{switch-8PklEEN1.js → switch-DnbD-yCM.js} +248 -233
- package/dist/chunks/{switch-DykyqM66.cjs → switch-NAbuOQNg.cjs} +2 -2
- package/dist/chunks/{temporal-bucket-BDRcWdVv.cjs → temporal-bucket-9Wz9Ds6H.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-Cc9fmx8s.js → temporal-bucket-CUKJktCl.js} +1 -1
- package/dist/chunks/{temporal-bucket-authoring-DjPFtRSF.js → temporal-bucket-authoring-CZoJV2L6.js} +3 -3
- package/dist/chunks/{temporal-bucket-authoring-C6sZAVqS.cjs → temporal-bucket-authoring-DSpzgXHc.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-vrOkax-r.cjs → temporal-bucket-contract-BD862TAa.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-DT4kU0VY.js → temporal-bucket-contract-Cno9TlYr.js} +1 -1
- package/dist/chunks/{token-types-DALtlgbG.cjs → token-types-CoHsSJ4E.cjs} +1 -1
- package/dist/chunks/{token-types-Z889rD6g.js → token-types-W3EHNW-D.js} +1 -1
- package/dist/chunks/{update-policy-Cyufdviq.cjs → update-policy-BGNXFgBU.cjs} +1 -1
- package/dist/chunks/{update-policy-Bu5Tw43R.js → update-policy-kRNJwwUV.js} +1 -1
- package/dist/chunks/{validators-DhTaCK1O.js → validators-B5t1s8oh.js} +274 -266
- package/dist/chunks/validators-DcshgK7w.cjs +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +4 -4
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +3 -3
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +3 -3
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +12 -12
- package/dist/index.cjs +1 -1
- package/dist/index.js +14 -14
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +3 -3
- package/dist/types/analytics-protocol.d.ts +69 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/main.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-filter-value-compatibility-Bnl2lsng.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-BzVDWVyZ.cjs +0 -172
- package/dist/chunks/index-DZdmd5AL.cjs +0 -1392
- package/dist/chunks/matrix-result-contract-C3cGHj_y.js +0 -598
- package/dist/chunks/matrix-result-contract-CkRVx693.cjs +0 -1
- package/dist/chunks/validators-DO-YuzgO.cjs +0 -1
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DVBYvkj0.cjs"),r=require("../chunks/common-types-C1IM7gao.cjs"),o=require("../chunks/report-preferences-dialog-DvNWNrlj.cjs");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as a, a as o } from "../chunks/index-
|
|
2
|
-
import { C as f, E } from "../chunks/common-types-
|
|
3
|
-
import { R as t } from "../chunks/report-preferences-dialog-
|
|
1
|
+
import { b as a, a as o } from "../chunks/index-tsB3LfTQ.js";
|
|
2
|
+
import { C as f, E } from "../chunks/common-types-g_1fKJLK.js";
|
|
3
|
+
import { R as t } from "../chunks/report-preferences-dialog-D-VpoQJz.js";
|
|
4
4
|
export {
|
|
5
5
|
f as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
a as DisplayFormatPreferencesFields,
|
|
@@ -188,6 +188,19 @@ export declare function getSemaphorConnectionCapabilities(connectionType: string
|
|
|
188
188
|
connectionId?: string;
|
|
189
189
|
}): SemaphorConnectionCapabilities;
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Returns the semantic discovery identity carried by a selected dataset.
|
|
193
|
+
*
|
|
194
|
+
* Historical selected entities sometimes stored the underlying physical table
|
|
195
|
+
* in `id`. That coordinate identifies execution, not the semantic dataset, and
|
|
196
|
+
* must not be promoted into the stronger `datasetId` contract.
|
|
197
|
+
*/
|
|
198
|
+
export declare function getSemaphorDatasetEntityId(entity: {
|
|
199
|
+
id?: unknown;
|
|
200
|
+
name?: unknown;
|
|
201
|
+
table?: unknown;
|
|
202
|
+
}): string | undefined;
|
|
203
|
+
|
|
191
204
|
/**
|
|
192
205
|
* Returns only an identity-strengthening dataset id. Some discovery adapters
|
|
193
206
|
* use the canonical dataset name as a UI entity id; echoing that same value as
|
|
@@ -245,6 +258,12 @@ export declare function isSemaphorDataAppCodegenSummary(value: unknown): value i
|
|
|
245
258
|
|
|
246
259
|
export declare function isSemaphorMatrixTimeGrain(value: unknown): value is SemaphorMatrixTimeGrain;
|
|
247
260
|
|
|
261
|
+
/**
|
|
262
|
+
* Classifies persisted selected-entity metadata. This is structural metadata
|
|
263
|
+
* handling; it does not inspect or parse authored SQL.
|
|
264
|
+
*/
|
|
265
|
+
export declare function isSemaphorPhysicalSourceEntity(value: unknown): boolean;
|
|
266
|
+
|
|
248
267
|
export declare function isSemaphorTimeGrain(value: unknown): value is SemaphorTimeGrain;
|
|
249
268
|
|
|
250
269
|
export declare type MatrixAxisLevelDescriptor = {
|
|
@@ -821,6 +840,13 @@ export declare function resolveMetricComparisonRequest(input: {
|
|
|
821
840
|
/** Stable result-instance identity shared by query producers and consumers. */
|
|
822
841
|
export declare function resolveMetricResultAlias(metric: MetricResultAliasInput): string;
|
|
823
842
|
|
|
843
|
+
/**
|
|
844
|
+
* Resolves one physical source from persisted structural identity hints.
|
|
845
|
+
* Qualified identity takes precedence over conflicting bare hints, while
|
|
846
|
+
* malformed, mutually conflicting, or ambiguous identity fails closed.
|
|
847
|
+
*/
|
|
848
|
+
export declare function resolveSemaphorPhysicalSourceEntity<T>(input: SemaphorPhysicalSourceResolutionInput<T>): SemaphorPhysicalSourceResolution<T>;
|
|
849
|
+
|
|
824
850
|
export declare function resolveTemporalContext(input: ResolveTemporalContextInput): ResolvedTemporalContext;
|
|
825
851
|
|
|
826
852
|
export declare type ResolveTemporalContextInput = {
|
|
@@ -3725,6 +3751,17 @@ export declare function semaphorPhysicalSourceCoordinatesAreCompatible(input: {
|
|
|
3725
3751
|
capabilities: Pick<SemaphorConnectionCapabilities, 'prefixLevels'>;
|
|
3726
3752
|
}): boolean;
|
|
3727
3753
|
|
|
3754
|
+
/**
|
|
3755
|
+
* Returns whether an allowed physical source contains every coordinate named
|
|
3756
|
+
* by the requested source. Unlike symmetric compatibility, a missing allowed
|
|
3757
|
+
* coordinate cannot satisfy a more-qualified request.
|
|
3758
|
+
*/
|
|
3759
|
+
export declare function semaphorPhysicalSourceCoordinatesCover(input: {
|
|
3760
|
+
requested: SemaphorSourceCoordinateInput;
|
|
3761
|
+
allowed: SemaphorSourceCoordinateInput;
|
|
3762
|
+
capabilities: Pick<SemaphorConnectionCapabilities, 'prefixLevels'>;
|
|
3763
|
+
}): boolean;
|
|
3764
|
+
|
|
3728
3765
|
export declare const semaphorPhysicalSourceRefSchema: z.ZodObject<{
|
|
3729
3766
|
kind: z.ZodLiteral<"physical">;
|
|
3730
3767
|
connectionId: z.ZodString;
|
|
@@ -3754,6 +3791,38 @@ export declare const semaphorPhysicalSourceRefSchema: z.ZodObject<{
|
|
|
3754
3791
|
dialect: z.ZodOptional<z.ZodEnum<["postgres", "mysql", "mssql", "snowflake", "clickhouse", "bigquery", "redshift", "duckdb", "sqlite", "unknown"]>>;
|
|
3755
3792
|
}, z.ZodTypeAny, "passthrough">>;
|
|
3756
3793
|
|
|
3794
|
+
export declare type SemaphorPhysicalSourceResolution<T> = {
|
|
3795
|
+
kind: 'resolved';
|
|
3796
|
+
basis: SemaphorPhysicalSourceResolutionBasis;
|
|
3797
|
+
entity: T;
|
|
3798
|
+
coordinates: SemaphorSourceCoordinateInput;
|
|
3799
|
+
} | {
|
|
3800
|
+
kind: 'unqualified';
|
|
3801
|
+
} | {
|
|
3802
|
+
kind: 'malformed';
|
|
3803
|
+
} | {
|
|
3804
|
+
kind: 'conflicting';
|
|
3805
|
+
} | {
|
|
3806
|
+
kind: 'ambiguous';
|
|
3807
|
+
basis: Exclude<SemaphorPhysicalSourceResolutionBasis, 'unqualified'>;
|
|
3808
|
+
} | {
|
|
3809
|
+
kind: 'not_found';
|
|
3810
|
+
basis: Exclude<SemaphorPhysicalSourceResolutionBasis, 'unqualified'>;
|
|
3811
|
+
coordinates?: SemaphorSourceCoordinateInput;
|
|
3812
|
+
} | {
|
|
3813
|
+
kind: 'incompatible_capabilities';
|
|
3814
|
+
};
|
|
3815
|
+
|
|
3816
|
+
export declare type SemaphorPhysicalSourceResolutionBasis = 'qualified' | 'bare' | 'unqualified';
|
|
3817
|
+
|
|
3818
|
+
export declare type SemaphorPhysicalSourceResolutionInput<T> = {
|
|
3819
|
+
entities: readonly T[];
|
|
3820
|
+
connectionType?: string;
|
|
3821
|
+
qualifiedHints?: ReadonlyArray<string | undefined>;
|
|
3822
|
+
bareHints?: ReadonlyArray<string | undefined>;
|
|
3823
|
+
coordinateHint?: SemaphorSourceCoordinateInput;
|
|
3824
|
+
};
|
|
3825
|
+
|
|
3757
3826
|
export declare type SemaphorPivotResultColumnIdentity = {
|
|
3758
3827
|
metricId: string;
|
|
3759
3828
|
/** Collision-safe identity for this configured metric instance. */
|
package/dist/types/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/common-types-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/common-types-C1IM7gao.cjs"),t=require("../chunks/token-types-CoHsSJ4E.cjs"),E=require("../chunks/pivot-result-identity-DRUlTWUq.cjs"),l=require("../chunks/report-runtime-context-RFiWq4wK.cjs");exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.LEGACY_CALCULATED_FIELD_ENTITY_MARKER=e.LEGACY_CALCULATED_FIELD_ENTITY_MARKER;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.getFieldRuntimeColumnName=e.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=e.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=e.hasCalculatedFormulaInputs;exports.hasSyntheticCalculatedFieldOwner=e.hasSyntheticCalculatedFieldOwner;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=t.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.resolveQueryColumnKeyMapEntry=E.resolveQueryColumnKeyMapEntry;exports.resolveUniqueQueryColumnKeyMapEntry=E.resolveUniqueQueryColumnKeyMapEntry;exports.DEFAULT_CALENDAR_CONTEXT=l.DEFAULT_CALENDAR_CONTEXT;
|
package/dist/types/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as s, C as E, D as C, E as l, L as r, P as A, g as t, d as _, h as T, e as o, b as u, c as L, i } from "../chunks/common-types-
|
|
2
|
-
import { D as n } from "../chunks/token-types-
|
|
3
|
-
import { r as d, a as F } from "../chunks/pivot-result-identity-
|
|
4
|
-
import { D as c } from "../chunks/report-runtime-context-
|
|
1
|
+
import { a as s, C as E, D as C, E as l, L as r, P as A, g as t, d as _, h as T, e as o, b as u, c as L, i } from "../chunks/common-types-g_1fKJLK.js";
|
|
2
|
+
import { D as n } from "../chunks/token-types-W3EHNW-D.js";
|
|
3
|
+
import { r as d, a as F } from "../chunks/pivot-result-identity-5v4hRVbc.js";
|
|
4
|
+
import { D as c } from "../chunks/report-runtime-context-DnNbpkGo.js";
|
|
5
5
|
export {
|
|
6
6
|
s as CALCULATED_FIELD_ENTITY_MARKER,
|
|
7
7
|
E as CONTROL_CARD_DEFAULT_VALUE,
|
package/dist/types/main.d.ts
CHANGED
|
@@ -6402,6 +6402,7 @@ declare interface TableActions {
|
|
|
6402
6402
|
updateColumnVisibility: (columnId: string, isVisible: boolean) => void;
|
|
6403
6403
|
updateColumnSizing: (sizing: ColumnSizingState) => void;
|
|
6404
6404
|
updatePageSize: (pageSize: number) => void;
|
|
6405
|
+
updateEnableDevModePagination: (enabled: boolean) => void;
|
|
6405
6406
|
showAllColumns: () => void;
|
|
6406
6407
|
hideAllColumns: () => void;
|
|
6407
6408
|
toggleSelectColumn: (isVisible: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var H=Object.defineProperty;var L=(e,n,i)=>n in e?H(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i;var N=(e,n,i)=>L(e,typeof n!="symbol"?n+"":n,i);const f=require("./validators-DO-YuzgO.cjs");require("./analyze-result-contract-CMwVg9w2.cjs");require("../value-format-preferences/index.cjs");function p(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function k(e){return p(e)&&typeof e.name=="string"}function F(e){return!p(e)||e.kind!=="semantic"&&e.kind!=="physical"||(e.kind==="semantic"?[e.datasetId,e.datasetName,e.connectionId]:[e.databaseName,e.schemaName]).some(i=>i!==void 0&&typeof i!="string")?!1:f.hasCompleteSemaphorSourceIdentity(e)}function v(e,n){var c,o;if((n==null?void 0:n.mode)!=="database"&&e.type==="dataset"&&"domainId"in e&&e.domainId){const s=e,d={kind:"semantic",domainId:s.domainId,datasetId:s.id,datasetName:s.name,connectionId:s.connectionId||(n==null?void 0:n.connectionId),label:s.label};return F(d)?f.canonicalizeSemaphorSourceIdentity(d):void 0}const i=e.connectionId||(n==null?void 0:n.connectionId),a=e.type==="dataset"&&"table"in e&&e.table?e.table:e.name;if(!i||!a)return;const t={kind:"physical",connectionId:i,connectionType:e.connectionType||(n==null?void 0:n.connectionType),tableName:a,databaseName:e.database||((c=n==null?void 0:n.dbSelection)==null?void 0:c.database),schemaName:e.schema||((o=n==null?void 0:n.dbSelection)==null?void 0:o.schema),dialect:e.dialect};return F(t)?t:void 0}function V(e,n){var s,d;const i=v(e,n);if(!i)return;const a=e.type==="dataset"&&"table"in e&&typeof e.table=="string"?e.table.trim():void 0,t=i.kind==="physical"?i.tableName:a,c=e.connectionId||(n==null?void 0:n.connectionId),o=t&&c?{connectionId:c,databaseName:e.database||((s=n==null?void 0:n.dbSelection)==null?void 0:s.database),schemaName:e.schema||((d=n==null?void 0:n.dbSelection)==null?void 0:d.schema),tableName:t}:void 0;return{source:i,...o?{executionTable:o}:{}}}function x(e){const n=p(e.dataSource)?e.dataSource:void 0;if(typeof e.sql=="string"&&e.sql.trim()){const o=[],s=Array.isArray(n==null?void 0:n.selectedEntities)?n.selectedEntities:[];for(const d of s){if(!k(d))continue;const r=V(d,n);r&&!o.some(T=>f.semaphorSourcesReferToSameDataset(T.source,r.source))&&o.push(r)}return{cardId:e.id,kind:"sql",pinnedCatalogSources:o}}if(!p(e.config))return{cardId:e.id,kind:"unconfigured"};const i=[],a=p(e.config.matrixIntent)?e.config.matrixIntent:void 0,t=e.type==="matrixTable"?(a==null?void 0:a.kind)==="matrix"?a.source:e.config.source:void 0;F(t)&&i.push(t);const c=p(e.config.joinPlan)?e.config.joinPlan:void 0;if(c){const o=Array.isArray(c.joins)?c.joins:[],s=[c.baseEntity];for(const d of o)p(d)&&s.push(d.source,d.target);for(const d of s){if(!k(d))continue;const r=v(d,n);r&&i.push(r)}}else if(e.type!=="matrixTable"){const o=Array.isArray(n==null?void 0:n.selectedEntities)?n.selectedEntities:[];if(o.length===1&&k(o[0])){const s=v(o[0],n);s&&i.push(s)}}if(!i.length&&!c&&e.type!=="matrixTable"){const o=e.config.queryBaseSource;F(o)&&i.push(o)}return{cardId:e.id,kind:"config",executableSources:f.mergeSemaphorSourcesByIdentity(i)}}function w(e,n){return(e.kind==="config"?e.executableSources:e.kind==="sql"?e.pinnedCatalogSources.map(a=>a.source):[]).some(a=>f.semaphorSourcesReferToSameDataset(a,n))}function U(e,n){if(e.kind==="config")return e.executableSources.find(i=>f.semaphorSourcesReferToSameDataset(i,n))}function W(e,n){var i;return(i=C(e,n))==null?void 0:i.source}function C(e,n){if(e.kind==="sql")return e.pinnedCatalogSources.find(i=>f.semaphorSourcesReferToSameDataset(i.source,n))}function R(e){const n=new Set;for(const i of[e.name,e.sourceField]){if(!i)continue;const a=f.normalizeAnalyticsCatalogName(i);if(!a)continue;n.add(a);const t=a.split("."),c=t[t.length-1];c&&n.add(c)}return n}function z(e,n){const i=f.normalizeAnalyticsCatalogDataType(e),a=f.normalizeAnalyticsCatalogDataType(n);return i==="unknown"||a==="unknown"?!1:(i==="date"||i==="datetime")&&(a==="date"||a==="datetime")?!0:i===a}function K(e,n){return f.semaphorSourcesReferToSameDataset(e.field.source,n.field.source)&&f.normalizeAnalyticsCatalogName(e.field.name)===f.normalizeAnalyticsCatalogName(n.field.name)&&f.normalizeAnalyticsCatalogName(e.field.sourceField||e.field.name)===f.normalizeAnalyticsCatalogName(n.field.sourceField||n.field.name)}function P(e,n){if(e.kind!=="field")return!1;const i=R(n),a=R(e.field);return z(n.dataType,e.field.dataType)&&[...a].some(t=>i.has(t))}function Y(e){const n=e.candidates.filter(i=>P(i,e.logicalValueField));return n.length===1?{status:"matched",target:n[0]}:n.length>1?{status:"ambiguous"}:{status:"notApplicable"}}function G(e){const n=[];for(const i of e.acceptedTargets)!z(e.logicalValueField.dataType,i.field.dataType)||n.some(a=>K(a,i))||n.push(i);return n.length===1?{status:"matched",target:n[0]}:n.length>1?{status:"ambiguous"}:{status:"notApplicable"}}const J=/\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i,Q=/\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i,X=/\bwhere\b/i;function B(e){return e!=null&&e.trim()?J.test(e)||Q.test(e):!1}function Z(e){return!(e!=null&&e.trim())||B(e)?null:X.test(e)?{helper:"{{ filters | and }}",description:"For queries with an existing WHERE clause."}:{helper:"{{ filters | where }}",description:"For queries without a WHERE clause."}}function ee(e){return(e.field.sourceField||e.field.name).trim()||void 0}function ne(e){if(e.inventory.kind!=="sql"||e.target.kind!=="field")return{status:"ineligible"};const n=C(e.inventory,e.target.field.source),i=ee(e.target);if(!n||!i)return{status:"ineligible"};if(n.executionTable){const o=[n.executionTable.databaseName,n.executionTable.schemaName,n.executionTable.tableName,i].filter(Boolean).join(".");return{status:"eligible",source:n.source,executionIdentifier:o}}if(e.inventory.pinnedCatalogSources.length!==1)return{status:"ineligible"};const a=f.normalizeAnalyticsCatalogName(i),t=(e.candidateTargets||[]).filter(o=>f.normalizeAnalyticsCatalogName(o.field.sourceField||o.field.name)===a),c=[];for(const o of t)c.some(s=>f.semaphorSourcesReferToSameDataset(s,o.field.source))||c.push(o.field.source);return c.length>1?{status:"ineligible"}:{status:"eligible",source:n.source,executionIdentifier:i}}class j extends Error{constructor(i){super(i.map(a=>a.message).join(" "));N(this,"issues");this.name="DashboardFilterMappingContractError",this.issues=i}}const ie={string:!0,number:!0,boolean:!0,date:!0,datetime:!0};function b(e){return typeof e=="string"&&e.trim().length>0}function m(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function I(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function te(e){if(!m(e))return!1;switch(e.kind){case"allSheets":return e.sheetKinds===void 0||I(e.sheetKinds)&&e.sheetKinds.every(n=>n==="dashboard"||n==="document");case"sheets":return I(e.sheetIds);case"cards":return I(e.cardIds);case"documentSections":return b(e.sheetId)&&I(e.sectionIds);default:return!1}}function re(e){return e==="shared"||e==="perSheet"||e==="perCard"||e==="perDocumentSection"}function se(e){return m(e)?b(e.id)&&b(e.column)&&b(e.dataType):!1}function oe(e,n,i,a){var s;if(!m(n)){a.push({code:"invalid_option_source",path:i,message:`${i} must be a semantic or physical option source.`,inputId:e});return}const t=n.source,c=[["labelField",n.labelField],["valueField",n.valueField],["searchField",n.searchField]];if(!m(t)||t.kind!=="semantic"&&t.kind!=="physical"||!f.hasCompleteSemaphorSourceIdentity(t)||!m(n.labelField)||!m(n.valueField)||n.searchField!==void 0&&!m(n.searchField)||n.disambiguationFields!==void 0&&(!Array.isArray(n.disambiguationFields)||!n.disambiguationFields.every(m))){a.push({code:"invalid_option_source",path:i,message:`${i} must contain a valid semantic or physical source and field references.`,inputId:e});return}for(const[d,r]of c)r!==void 0&&m(r)&&(!b(r.name)||r.source!==void 0&&!f.semaphorSourcesReferToSameDataset(r.source,t))&&a.push({code:"invalid_option_source",path:`${i}.${d}`,message:`${i}.${d} must be a named field belonging to the declared option source.`,inputId:e});for(const[d,r]of((s=n.disambiguationFields)==null?void 0:s.entries())||[])(!m(r)||!b(r.name)||r.source!==void 0&&!f.semaphorSourcesReferToSameDataset(r.source,t))&&a.push({code:"invalid_option_source",path:`${i}.disambiguationFields[${d}]`,message:`${i}.disambiguationFields[${d}] must be a named field belonging to the declared option source.`,inputId:e});const o=n.valueField;["string","number","boolean","date","datetime"].includes(String(o.dataType))||a.push({code:"invalid_option_source",path:`${i}.valueField.dataType`,message:`${i}.valueField.dataType must be a known option-value datatype.`,inputId:e})}function ae(e,n,i,a,t,c){var r;if(b(n.bindingId)||t.push({code:"invalid_binding_id",path:`${i}.bindingId`,message:`${i}.bindingId must be an opaque non-empty id.`,inputId:e,cardId:n.cardId}),((r=n.target)==null?void 0:r.kind)!=="field"){t.push({code:"unsupported_target",path:`${i}.target`,message:`${i}.target must be one direct field target.`,inputId:e,cardId:n.cardId,bindingId:n.bindingId});return}const o=n.target.field;if(!b(o==null?void 0:o.name)||!o.source||o.source.kind!=="semantic"&&o.source.kind!=="physical"||!f.hasCompleteSemaphorSourceIdentity(o.source)){t.push({code:"invalid_target_field",path:`${i}.target.field`,message:`${i}.target.field must have a name and a source-qualified semantic or physical identity.`,inputId:e,cardId:n.cardId,bindingId:n.bindingId});return}if(Object.prototype.hasOwnProperty.call(ie,o.dataType)||t.push({code:"unknown_target_data_type",path:`${i}.target.field.dataType`,message:`${i}.target.field.dataType must be known.`,inputId:e,cardId:n.cardId,bindingId:n.bindingId}),o.sourceField!==void 0&&!b(o.sourceField)&&t.push({code:"invalid_target_field",path:`${i}.target.field.sourceField`,message:`${i}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,inputId:e,cardId:n.cardId,bindingId:n.bindingId}),!c)return;const s=a.get(n.cardId);if(!s){t.push({code:"unknown_card",path:`${i}.cardId`,message:`${i}.cardId '${n.cardId}' does not exist.`,inputId:e,cardId:n.cardId,bindingId:n.bindingId});return}const d=x(s);(d.kind==="unconfigured"||!w(d,o.source))&&t.push({code:"unavailable_card_source",path:`${i}.target.field.source`,message:`${i}.target field source is not declared by card '${s.id}'.`,inputId:e,cardId:s.id,bindingId:n.bindingId})}function de(e,n,i,a,t,c){if(n===void 0)return;if(!m(n)||n.kind!=="cardMappings"||!Array.isArray(n.cards)){t.push({code:"invalid_application",path:i,message:`${i} must be a cardMappings application with a cards array.`,inputId:e});return}const o=new Set;n.cards.forEach((s,d)=>{const r=`${i}.cards[${d}]`;if(!b(s==null?void 0:s.cardId)){t.push({code:"unknown_card",path:`${r}.cardId`,message:`${r}.cardId is required.`,inputId:e});return}if(o.has(s.cardId)){t.push({code:"duplicate_card_application",path:`${r}.cardId`,message:`${i} contains more than one entry for card '${s.cardId}'.`,inputId:e,cardId:s.cardId});return}if(o.add(s.cardId),c&&!a.has(s.cardId)){t.push({code:"unknown_card",path:`${r}.cardId`,message:`${r}.cardId '${s.cardId}' does not exist.`,inputId:e,cardId:s.cardId});return}s.kind==="bound"?ae(e,s,r,a,t,c):s.kind!=="excluded"&&t.push({code:"invalid_application",path:r,message:`${r}.kind must be 'bound' or 'excluded'.`,inputId:e,cardId:s.cardId})})}function q({inputs:e,dashboardFilters:n,cards:i=[],validateCardTargets:a=!1}){const t=[],c=new Map((n||[]).map(r=>[r.id,r])),o=new Map(a?i.map(r=>[r.id,r]):[]),s=[],d=new Map;return e!=null&&!Array.isArray(e)?(t.push({code:"invalid_input",path:"dashboard.inputs",message:"dashboard.inputs must be an array when present."}),{ok:!1,inputs:s,issues:t}):((Array.isArray(e)?e:[]).forEach((r,T)=>{const u=`dashboard.inputs[${T}]`;if(!m(r)||r.kind!=="filter"&&r.kind!=="control"||!b(r.id)||!b(r.label)||!b(r.variableName)||!te(r.scope)||!re(r.runtimeScope)){t.push({code:"invalid_input",path:u,message:`${u} must be a complete filter or control Dashboard Input envelope.`,inputId:m(r)&&typeof r.id=="string"?r.id:void 0});return}if(r.kind==="control"&&!m(r.control)){t.push({code:"invalid_input",path:`${u}.control`,message:`${u}.control must be a control definition.`,inputId:r.id});return}const l=r;if(l.kind==="control"){s.push(l);return}const $=l.filter,g=l.filterReference,y=$!==void 0,E=!!g;if(y&&E){t.push({code:"both_filter_definitions",path:u,message:`${u} must contain either filter or filterReference, not both.`,inputId:l.id});return}if(!y&&!E){t.push({code:"missing_filter_definition",path:u,message:`${u} must contain filter or filterReference.`,inputId:l.id});return}if(y&&!se($)){t.push({code:"invalid_input",path:`${u}.filter`,message:`${u}.filter must be a complete dashboard filter definition.`,inputId:l.id});return}let h,_;if(y)h=$,_="embedded";else{if((g==null?void 0:g.kind)!=="dashboardFilter"){t.push({code:"invalid_filter_reference",path:`${u}.filterReference.kind`,message:`${u}.filterReference.kind must be 'dashboardFilter'.`,inputId:l.id});return}const D=typeof(g==null?void 0:g.filterId)=="string"?g.filterId:void 0;if(h=D?c.get(D):void 0,_="dashboardFilter",!h){t.push({code:"orphaned_filter_reference",path:`${u}.filterReference.filterId`,message:`${u}.filterReference cannot resolve dashboard filter '${D||""}'.`,inputId:l.id});return}if(h.kind==="global-date"){t.push({code:"global_date_reference",path:`${u}.filterReference`,message:`${u}.filterReference cannot reference the Global Date filter.`,inputId:l.id});return}const A=d.get(h.id);if(A){t.push({code:"duplicate_filter_reference",path:`${u}.filterReference.filterId`,message:`${u}.filterReference duplicates dashboard filter '${h.id}' already owned by Dashboard Input '${A}'.`,inputId:l.id});return}d.set(h.id,l.id)}if(!h)return;if(l.optionSource!==void 0&&oe(l.id,l.optionSource,`${u}.optionSource`,t),l.application&&h.kind==="global-date"){t.push({code:"global_date_reference",path:`${u}.application`,message:`${u}.application cannot map the Global Date filter.`,inputId:l.id});return}l.application&&l.scope.kind!=="allSheets"&&l.scope.kind!=="sheets"&&t.push({code:"unsupported_mapped_scope",path:`${u}.scope`,message:`${u}.scope must be allSheets or sheets when cardMappings are present.`,inputId:l.id}),de(l.id,l.application,`${u}.application`,o,t,a);const{filter:me,filterReference:be,compatibility:S,...O}=l;s.push({...O,filter:h,...y&&S?{compatibility:S}:{},...l.optionSource?{optionSource:l.optionSource}:{},definitionOrigin:_})}),t.length?{ok:!1,inputs:s,issues:t}:{ok:!0,inputs:s})}function ce(e){const n=q(e);if(!n.ok)throw new j(n.issues);return n.inputs}function le(e=()=>globalThis.crypto.randomUUID()){return e()}const ue={date:new Set(["between","not between","=","!=",">",">=","<","<=","is null","is not null"]),number:new Set(["between","not between","=","!=",">",">=","<","<=","in","not in","is null","is not null"]),string:new Set(["=","!=","in","not in","like","not like","is null","is not null"]),boolean:new Set(["=","!=","is null","is not null"])};function M(e){const n=f.normalizeAnalyticsCatalogDataType(e);return n==="number"||n==="boolean"?n:n==="date"||n==="datetime"?"date":"string"}function fe(e,n){return typeof n!="string"?!1:ue[M(e)].has(n)}exports.DashboardFilterMappingContractError=j;exports.buildDashboardCardSourceIndex=x;exports.createDashboardFilterBindingId=le;exports.dashboardCardFilterSourceInventoryContains=w;exports.dashboardFilterTargetMatchesLogicalValue=P;exports.dashboardFilterValueTypeForDataType=M;exports.findDashboardCardExecutableSource=U;exports.findDashboardCardPinnedCatalogSource=W;exports.findDashboardSqlPinnedCatalogSource=C;exports.getDashboardFilterSubscriptionHint=Z;exports.hasDashboardFilterSubscription=B;exports.isDashboardFilterOperationCompatible=fe;exports.normalizeDashboardInputs=q;exports.requireNormalizedDashboardInputs=ce;exports.resolveDashboardFilterAutomaticTarget=Y;exports.resolveDashboardFilterInheritedTarget=G;exports.resolveDashboardSqlFilterTarget=ne;
|