react-semaphor 0.1.333 → 0.1.335

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 (60) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +68 -232
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +3 -3
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +435 -391
  7. package/dist/chunks/{braces-BxHNQOYk.js → braces-BLa_lORs.js} +1 -1
  8. package/dist/chunks/{braces-4vZnfI1o.js → braces-Q86XHDaD.js} +1 -1
  9. package/dist/chunks/{calendar-preferences-dialog-mY0L4X0S.js → calendar-preferences-dialog-Bm7ji3k9.js} +1 -1
  10. package/dist/chunks/{calendar-preferences-dialog-Cxj1zuet.js → calendar-preferences-dialog-Cocogo9H.js} +3 -3
  11. package/dist/chunks/catalog-field-grounding-DmT7aGUA.js +191 -0
  12. package/dist/chunks/catalog-field-grounding-VgVzDd25.js +1 -0
  13. package/dist/chunks/{chevrons-up-down-CIlNtntj.js → chevrons-up-down-BBTZ5pAY.js} +1 -1
  14. package/dist/chunks/{chevrons-up-down-oh0-U32g.js → chevrons-up-down-CYuWasy_.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-ih3HDp3Q.js → dashboard-briefing-launcher-BtqtLx1-.js} +1 -1
  16. package/dist/chunks/{dashboard-briefing-launcher-BQXscUvQ.js → dashboard-briefing-launcher-DF4CoaRn.js} +4 -4
  17. package/dist/chunks/{dashboard-controls-Dje4oqXJ.js → dashboard-controls-0VMAeMoa.js} +1 -1
  18. package/dist/chunks/{dashboard-controls-UN6XyI0w.js → dashboard-controls-B5U-VUxs.js} +6 -6
  19. package/dist/chunks/{dashboard-json-CahEbpAw.js → dashboard-json-CqbLOfnr.js} +1 -1
  20. package/dist/chunks/{dashboard-json-BB2frqlS.js → dashboard-json-Hmc0Ri5z.js} +2 -2
  21. package/dist/chunks/{edit-dashboard-visual-B9QNMn1k.js → edit-dashboard-visual-C0EDM0QB.js} +3 -3
  22. package/dist/chunks/{edit-dashboard-visual-2xDuubCd.js → edit-dashboard-visual-D4VVu-QQ.js} +1302 -1302
  23. package/dist/chunks/{index-DMilTFOG.js → index-DE0vIuYG.js} +238 -238
  24. package/dist/chunks/{index-zqZLz4DH.js → index-DzyUhzV3.js} +30507 -30454
  25. package/dist/chunks/{palette-B78b9bL_.js → palette-B9AbDw0n.js} +1 -1
  26. package/dist/chunks/{palette-BzcTKXSo.js → palette-DalASD28.js} +1 -1
  27. package/dist/chunks/{resource-management-panel-CR87UhdL.js → resource-management-panel-C4YydU9I.js} +3 -3
  28. package/dist/chunks/{resource-management-panel-BiDjNUl9.js → resource-management-panel-P9iNqBM1.js} +1 -1
  29. package/dist/chunks/{switch-DionLwdI.js → switch-BAYfpAEb.js} +1968 -2009
  30. package/dist/chunks/switch-CyRoZr5T.js +173 -0
  31. package/dist/chunks/{use-create-flow-overlay-state-UWfoDonf.js → use-create-flow-overlay-state-CbhjxI3W.js} +1 -1
  32. package/dist/chunks/{use-create-flow-overlay-state-BYZywwZQ.js → use-create-flow-overlay-state-P1LMwQ89.js} +3 -3
  33. package/dist/chunks/{use-visual-utils-Ce_aCega.js → use-visual-utils-CV6_-y4p.js} +1 -1
  34. package/dist/chunks/{use-visual-utils-rqBoCLlu.js → use-visual-utils-lB-3Zk0b.js} +2 -2
  35. package/dist/chunks/validators-BuaRUBQI.js +561 -0
  36. package/dist/chunks/validators-x74uYpnG.js +2 -0
  37. package/dist/dashboard/index.cjs +1 -1
  38. package/dist/dashboard/index.js +1 -1
  39. package/dist/dashboard-authoring/index.cjs +3 -3
  40. package/dist/dashboard-authoring/index.js +378 -377
  41. package/dist/data-app-builder/index.cjs +1 -1
  42. package/dist/data-app-builder/index.js +1 -1
  43. package/dist/data-app-builder-browser-runtime/index.cjs +1 -1
  44. package/dist/data-app-builder-browser-runtime/index.js +4 -9
  45. package/dist/data-app-sdk/index.cjs +1 -1
  46. package/dist/data-app-sdk/index.js +1 -1
  47. package/dist/index.cjs +1 -1
  48. package/dist/index.js +7 -7
  49. package/dist/surfboard/index.cjs +1 -1
  50. package/dist/surfboard/index.js +2 -2
  51. package/dist/types/analytics-protocol.d.ts +90 -0
  52. package/dist/types/briefings.d.ts +12 -0
  53. package/dist/types/dashboard-authoring.d.ts +14 -0
  54. package/dist/types/data-app-builder.d.ts +14 -0
  55. package/dist/types/data-app-sdk.d.ts +14 -0
  56. package/dist/types/main.d.ts +16 -0
  57. package/package.json +1 -1
  58. package/dist/chunks/switch-aSDkK5PS.js +0 -173
  59. package/dist/chunks/validators-DDAweCzB.js +0 -371
  60. package/dist/chunks/validators-odlRJblR.js +0 -2
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DMilTFOG.js");exports.DataAppBuilder=e.DataAppBuilder;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DE0vIuYG.js");exports.DataAppBuilder=e.DataAppBuilder;
@@ -1,4 +1,4 @@
1
- import { b as r } from "../chunks/index-zqZLz4DH.js";
1
+ import { b as r } from "../chunks/index-DzyUhzV3.js";
2
2
  export {
3
3
  r as DataAppBuilder
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=async(r="semaphor-browser-runtime")=>{if(r!=="semaphor-browser-runtime")throw new Error("Custom browser runtime specifiers are not supported in the bundled App Builder. Install or link semaphor-browser-runtime.");return import(r)};exports.loadSemaphorBrowserRuntime=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=async(r="semaphor-browser-runtime")=>{throw new Error("The in-browser Data App runtime is not bundled. Use the Local Bridge runtime.")};exports.loadSemaphorBrowserRuntime=e;
@@ -1,13 +1,8 @@
1
- const e = async (r = "semaphor-browser-runtime") => {
2
- if (r !== "semaphor-browser-runtime")
3
- throw new Error(
4
- "Custom browser runtime specifiers are not supported in the bundled App Builder. Install or link semaphor-browser-runtime."
5
- );
6
- return import(
7
- /* @vite-ignore */
8
- r
1
+ const r = async (e = "semaphor-browser-runtime") => {
2
+ throw new Error(
3
+ "The in-browser Data App runtime is not bundled. Use the Local Bridge runtime."
9
4
  );
10
5
  };
11
6
  export {
12
- e as loadSemaphorBrowserRuntime
7
+ r as loadSemaphorBrowserRuntime
13
8
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../chunks/index-BxM99sFL.js"),u=require("react"),P=require("react/jsx-runtime"),K=require("../chunks/validators-odlRJblR.js");function x(t){var e;return{version:1,kind:"metric",id:t.id,label:t.label,source:k(t),metric:t.metric,metrics:t.metrics,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,dimensions:(e=t.dimensions)==null?void 0:e.map(o=>m(o,"dimension")),comparison:L(t.comparison),inputs:g(t.inputs),limit:t.limit}}function R(t){if("sort"in t)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!N(t))throw new Error("useSemaphorRecords needs at least one field, dimension, or measure.");const e=F(t.fields,t.dimensions,t.measures);return{version:1,kind:"records",id:t.id,label:t.label,source:k(t),fields:e,measures:t.measures,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,orderBy:t.orderBy,inputs:g(t.inputs),limit:t.limit}}function q(t){return{version:1,kind:"inputOptions",id:t.id,label:t.label,source:k(t),field:m(t.field,"dimension"),search:t.search,limit:t.limit}}function O(t){if("toAnalyticsInput"in t){const e=t.toAnalyticsInput();return{inputId:e.inputId,field:e.field}}return{inputId:t.inputId,field:t.field}}function U(t){const e=g(t);return e.length>0?e:void 0}function M(t){return(t||[]).map(V)}function A(t){return M(t).filter(e=>e.isActive)}function w(t){return t.kind==="filter"?{inputId:t.id,kind:t.kind,label:t.label,field:m(t.field,"dimension"),operator:t.operator||"in",source:t.source}:{inputId:t.id,kind:t.kind,label:t.label}}function $(t=[]){return t.map(e=>typeof e=="object"?e:{label:String(e),value:e})}function S(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t.trim().length>0:!0}function V(t){return"toAnalyticsInput"in t?t.toAnalyticsInput():"kind"in t&&"isActive"in t?t:{...t,kind:"filter",isActive:S(t.value),value:t.value}}function k(t){if("source"in t&&t.source)return t.source;const e=t.datasetName||t.dataset;if(!e)throw new Error("Semaphor data app source needs datasetName or dataset.");return{kind:"semantic",domainId:t.domainId,datasetName:e,datasetId:t.datasetId,connectionId:t.connectionId,label:t.sourceLabel}}function N(t){var e,o,n;return!!((e=t.fields)!=null&&e.length||(o=t.dimensions)!=null&&o.length||(n=t.measures)!=null&&n.length)}function j(t){return!!(t!=null&&t.length)}function F(t,e,o){const n=[],r=new Set,a=i=>{const l=`${i.role||""}:${i.name}`;r.has(l)||(r.add(l),n.push(i))};return j(t)&&t.map(i=>m(i)).forEach(a),e==null||e.map(i=>m(i,"dimension")).forEach(a),o==null||o.map(i=>m(i,"measure")).forEach(a),n}function m(t,e){return typeof t=="string"?e?{name:t,role:e}:{name:t}:{...t,role:t.role||e}}function g(t){return(t||[]).map(O)}function L(t){if(!(!t||t==="none"))return typeof t=="object"?t:t==="same_period_last_year"?{kind:"previous_year"}:{kind:t}}function B(){return{executeMetric:(t,e)=>y(t,e),executeRecords:(t,e)=>y(t,e),executeInputOptions:(t,e)=>y(t,e)}}async function y(t,e){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const o=await fetch(G(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,resultShape:t.kind})}),n=await z(o);if(!o.ok||n.error)throw new Error(n.error||`Semaphor Data App execution failed with status ${o.status}.`);return n}async function z(t){const e=await t.text().catch(()=>"");if(!e.trim())return t.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(e)}catch{return t.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:e}:{error:Q(t,e),details:e}}}function Q(t,e){const o=t.statusText?` ${t.statusText}`:"",n=e.replace(/\s+/g," ").trim();return n?`Semaphor Data App execution failed with status ${t.status}${o}: ${n.slice(0,240)}`:`Semaphor Data App execution failed with status ${t.status}${o}.`}function G(t){const e=J(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/execute`:`${e}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function J(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return T.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const D=u.createContext({});function _(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function C(){return u.useContext(D)}function W({token:t,apiBaseUrl:e,executor:o,children:n}){var d;const r=_(),a=((d=r==null?void 0:r.authToken)==null?void 0:d.accessToken)||t,i=(r==null?void 0:r.dataApiBaseUrl)||(r==null?void 0:r.apiBaseUrl)||e,l=u.useMemo(()=>B(),[]),s=o||l,p=u.useMemo(()=>({token:a,apiBaseUrl:i,executor:s}),[i,s,a]);return P.jsx(D.Provider,{value:p,children:n})}const I={value:null},H={records:[]},v={options:[]};function X(t){const e=A(t.inputs);try{const o=x(t),n=b(o);return n?{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}:{intent:o,error:null,activeInputs:e,queryKey:c(o,e),idleData:I}}catch(o){const n=h(o);return{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}}}function Y(t){const e=A(t.inputs),o=H;try{const n=R(t),r=b(n);return r?{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}:{intent:n,error:null,activeInputs:e,queryKey:c(n,e),idleData:o}}catch(n){const r=h(n);return{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}}}function Z(t){try{const e=q(t),o=b(e);return o?{error:o,queryKey:c(void 0,void 0,o),idleData:v}:{intent:e,error:null,queryKey:c(e),idleData:v}}catch(e){const o=h(e);return{error:o,queryKey:c(void 0,void 0,o),idleData:v}}}function h(t){return t instanceof Error?t:new Error(String(t))}function b(t){const e=K.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const o=e.errors.map(n=>n.path?`${n.code} at ${n.path}: ${n.message}`:`${n.code}: ${n.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${o}`)}function c(t,e,o){return JSON.stringify({intent:t,activeInputs:e,error:o==null?void 0:o.message})}function tt(t){const[e,o]=u.useState(t.defaultValue),n=Object.prototype.hasOwnProperty.call(t,"value"),r=n?t.value:e,a=u.useMemo(()=>$(t.options),[t.options]),i=u.useCallback(s=>{var d;const p=s;(d=t.onValueChange)==null||d.call(t,p),n||o(p)},[n,t]),l=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const s=w(t);return{id:t.id,kind:t.kind,label:t.label,field:s.field,operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0,value:r,options:a,isActive:S(r),setValue:i,clear:l,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:t.kind,label:t.label,value:r,isActive:S(r),operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0})}},[l,a,i,t,r])}function et(t){const e=u.useMemo(()=>X(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeMetric(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,value:(r==null?void 0:r.value)??null,metrics:r==null?void 0:r.metrics,comparisonValue:r==null?void 0:r.comparisonValue,delta:r==null?void 0:r.delta,deltaPercent:r==null?void 0:r.deltaPercent,records:r==null?void 0:r.records,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function rt(t){const e=u.useMemo(()=>Y(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeRecords(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,records:(r==null?void 0:r.records)||[],columns:r==null?void 0:r.columns,rowCount:r==null?void 0:r.rowCount,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function nt(t){const e=u.useMemo(()=>Z(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeInputOptions(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,options:(r==null?void 0:r.options)||[],status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function E(t,e,o,n){const r=C(),a=u.useRef(e),i=u.useRef(n),[l,s]=u.useState({status:"idle",data:o,error:null});return a.current=e,i.current=n,u.useEffect(()=>{let p;try{p=a.current({...r,activeInputs:i.current})}catch(f){s({status:"error",data:o,error:h(f)});return}if(!p){s({status:"idle",data:o,error:null});return}let d=!1;return s(f=>({status:"loading",data:f.data,error:null})),p.then(f=>{d||s({status:"success",data:f,error:null})}).catch(f=>{d||s({status:"error",data:o,error:h(f)})}),()=>{d=!0}},[o,t,r]),l}exports.SemaphorDataAppContext=D;exports.SemaphorDataAppProvider=W;exports.createSemaphorDataAppExecutor=B;exports.hasSemaphorInputValue=S;exports.normalizeSemaphorInputOptions=$;exports.readWindowRuntime=_;exports.toSemaphorActiveInputSnapshots=A;exports.toSemaphorInputBinding=O;exports.toSemaphorInputBindings=U;exports.toSemaphorInputOptionsIntent=q;exports.toSemaphorInputSnapshots=M;exports.toSemaphorInputSpec=w;exports.toSemaphorMetricIntent=x;exports.toSemaphorRecordsIntent=R;exports.useSemaphorDataAppRuntime=C;exports.useSemaphorInput=tt;exports.useSemaphorInputOptions=nt;exports.useSemaphorMetric=et;exports.useSemaphorRecords=rt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../chunks/index-BxM99sFL.js"),u=require("react"),P=require("react/jsx-runtime"),K=require("../chunks/validators-x74uYpnG.js");function x(t){var e;return{version:1,kind:"metric",id:t.id,label:t.label,source:k(t),metric:t.metric,metrics:t.metrics,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,dimensions:(e=t.dimensions)==null?void 0:e.map(o=>m(o,"dimension")),comparison:L(t.comparison),inputs:g(t.inputs),limit:t.limit}}function R(t){if("sort"in t)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!N(t))throw new Error("useSemaphorRecords needs at least one field, dimension, or measure.");const e=F(t.fields,t.dimensions,t.measures);return{version:1,kind:"records",id:t.id,label:t.label,source:k(t),fields:e,measures:t.measures,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,orderBy:t.orderBy,inputs:g(t.inputs),limit:t.limit}}function q(t){return{version:1,kind:"inputOptions",id:t.id,label:t.label,source:k(t),field:m(t.field,"dimension"),search:t.search,limit:t.limit}}function O(t){if("toAnalyticsInput"in t){const e=t.toAnalyticsInput();return{inputId:e.inputId,field:e.field}}return{inputId:t.inputId,field:t.field}}function U(t){const e=g(t);return e.length>0?e:void 0}function M(t){return(t||[]).map(V)}function A(t){return M(t).filter(e=>e.isActive)}function w(t){return t.kind==="filter"?{inputId:t.id,kind:t.kind,label:t.label,field:m(t.field,"dimension"),operator:t.operator||"in",source:t.source}:{inputId:t.id,kind:t.kind,label:t.label}}function $(t=[]){return t.map(e=>typeof e=="object"?e:{label:String(e),value:e})}function S(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t.trim().length>0:!0}function V(t){return"toAnalyticsInput"in t?t.toAnalyticsInput():"kind"in t&&"isActive"in t?t:{...t,kind:"filter",isActive:S(t.value),value:t.value}}function k(t){if("source"in t&&t.source)return t.source;const e=t.datasetName||t.dataset;if(!e)throw new Error("Semaphor data app source needs datasetName or dataset.");return{kind:"semantic",domainId:t.domainId,datasetName:e,datasetId:t.datasetId,connectionId:t.connectionId,label:t.sourceLabel}}function N(t){var e,o,n;return!!((e=t.fields)!=null&&e.length||(o=t.dimensions)!=null&&o.length||(n=t.measures)!=null&&n.length)}function j(t){return!!(t!=null&&t.length)}function F(t,e,o){const n=[],r=new Set,a=i=>{const l=`${i.role||""}:${i.name}`;r.has(l)||(r.add(l),n.push(i))};return j(t)&&t.map(i=>m(i)).forEach(a),e==null||e.map(i=>m(i,"dimension")).forEach(a),o==null||o.map(i=>m(i,"measure")).forEach(a),n}function m(t,e){return typeof t=="string"?e?{name:t,role:e}:{name:t}:{...t,role:t.role||e}}function g(t){return(t||[]).map(O)}function L(t){if(!(!t||t==="none"))return typeof t=="object"?t:t==="same_period_last_year"?{kind:"previous_year"}:{kind:t}}function B(){return{executeMetric:(t,e)=>y(t,e),executeRecords:(t,e)=>y(t,e),executeInputOptions:(t,e)=>y(t,e)}}async function y(t,e){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const o=await fetch(G(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,resultShape:t.kind})}),n=await z(o);if(!o.ok||n.error)throw new Error(n.error||`Semaphor Data App execution failed with status ${o.status}.`);return n}async function z(t){const e=await t.text().catch(()=>"");if(!e.trim())return t.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(e)}catch{return t.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:e}:{error:Q(t,e),details:e}}}function Q(t,e){const o=t.statusText?` ${t.statusText}`:"",n=e.replace(/\s+/g," ").trim();return n?`Semaphor Data App execution failed with status ${t.status}${o}: ${n.slice(0,240)}`:`Semaphor Data App execution failed with status ${t.status}${o}.`}function G(t){const e=J(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/execute`:`${e}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function J(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return T.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const D=u.createContext({});function _(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function C(){return u.useContext(D)}function W({token:t,apiBaseUrl:e,executor:o,children:n}){var d;const r=_(),a=((d=r==null?void 0:r.authToken)==null?void 0:d.accessToken)||t,i=(r==null?void 0:r.dataApiBaseUrl)||(r==null?void 0:r.apiBaseUrl)||e,l=u.useMemo(()=>B(),[]),s=o||l,p=u.useMemo(()=>({token:a,apiBaseUrl:i,executor:s}),[i,s,a]);return P.jsx(D.Provider,{value:p,children:n})}const I={value:null},H={records:[]},v={options:[]};function X(t){const e=A(t.inputs);try{const o=x(t),n=b(o);return n?{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}:{intent:o,error:null,activeInputs:e,queryKey:c(o,e),idleData:I}}catch(o){const n=h(o);return{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}}}function Y(t){const e=A(t.inputs),o=H;try{const n=R(t),r=b(n);return r?{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}:{intent:n,error:null,activeInputs:e,queryKey:c(n,e),idleData:o}}catch(n){const r=h(n);return{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}}}function Z(t){try{const e=q(t),o=b(e);return o?{error:o,queryKey:c(void 0,void 0,o),idleData:v}:{intent:e,error:null,queryKey:c(e),idleData:v}}catch(e){const o=h(e);return{error:o,queryKey:c(void 0,void 0,o),idleData:v}}}function h(t){return t instanceof Error?t:new Error(String(t))}function b(t){const e=K.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const o=e.errors.map(n=>n.path?`${n.code} at ${n.path}: ${n.message}`:`${n.code}: ${n.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${o}`)}function c(t,e,o){return JSON.stringify({intent:t,activeInputs:e,error:o==null?void 0:o.message})}function tt(t){const[e,o]=u.useState(t.defaultValue),n=Object.prototype.hasOwnProperty.call(t,"value"),r=n?t.value:e,a=u.useMemo(()=>$(t.options),[t.options]),i=u.useCallback(s=>{var d;const p=s;(d=t.onValueChange)==null||d.call(t,p),n||o(p)},[n,t]),l=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const s=w(t);return{id:t.id,kind:t.kind,label:t.label,field:s.field,operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0,value:r,options:a,isActive:S(r),setValue:i,clear:l,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:t.kind,label:t.label,value:r,isActive:S(r),operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0})}},[l,a,i,t,r])}function et(t){const e=u.useMemo(()=>X(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeMetric(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,value:(r==null?void 0:r.value)??null,metrics:r==null?void 0:r.metrics,comparisonValue:r==null?void 0:r.comparisonValue,delta:r==null?void 0:r.delta,deltaPercent:r==null?void 0:r.deltaPercent,records:r==null?void 0:r.records,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function rt(t){const e=u.useMemo(()=>Y(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeRecords(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,records:(r==null?void 0:r.records)||[],columns:r==null?void 0:r.columns,rowCount:r==null?void 0:r.rowCount,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function nt(t){const e=u.useMemo(()=>Z(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeInputOptions(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,options:(r==null?void 0:r.options)||[],status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function E(t,e,o,n){const r=C(),a=u.useRef(e),i=u.useRef(n),[l,s]=u.useState({status:"idle",data:o,error:null});return a.current=e,i.current=n,u.useEffect(()=>{let p;try{p=a.current({...r,activeInputs:i.current})}catch(f){s({status:"error",data:o,error:h(f)});return}if(!p){s({status:"idle",data:o,error:null});return}let d=!1;return s(f=>({status:"loading",data:f.data,error:null})),p.then(f=>{d||s({status:"success",data:f,error:null})}).catch(f=>{d||s({status:"error",data:o,error:h(f)})}),()=>{d=!0}},[o,t,r]),l}exports.SemaphorDataAppContext=D;exports.SemaphorDataAppProvider=W;exports.createSemaphorDataAppExecutor=B;exports.hasSemaphorInputValue=S;exports.normalizeSemaphorInputOptions=$;exports.readWindowRuntime=_;exports.toSemaphorActiveInputSnapshots=A;exports.toSemaphorInputBinding=O;exports.toSemaphorInputBindings=U;exports.toSemaphorInputOptionsIntent=q;exports.toSemaphorInputSnapshots=M;exports.toSemaphorInputSpec=w;exports.toSemaphorMetricIntent=x;exports.toSemaphorRecordsIntent=R;exports.useSemaphorDataAppRuntime=C;exports.useSemaphorInput=tt;exports.useSemaphorInputOptions=nt;exports.useSemaphorMetric=et;exports.useSemaphorRecords=rt;
@@ -1,7 +1,7 @@
1
1
  import { j as $ } from "../chunks/index-CuHybtft.js";
2
2
  import { createContext as w, useContext as O, useMemo as p, useState as x, useCallback as h, useRef as b, useEffect as _ } from "react";
3
3
  import { jsx as B } from "react/jsx-runtime";
4
- import { v as T } from "../chunks/validators-DDAweCzB.js";
4
+ import { v as T } from "../chunks/validators-BuaRUBQI.js";
5
5
  function K(t) {
6
6
  var r;
7
7
  return {
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DMilTFOG.js"),d=require("./chunks/common-types-C73-Ud1-.js"),P=require("./chunks/calendar-preferences-dialog-mY0L4X0S.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-aSDkK5PS.js"),C=require("react"),N=require("./chunks/resource-management-panel-BiDjNUl9.js"),y=require("./types/index.cjs"),_=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const r=require("./chunks/dashboard-briefing-launcher-ih3HDp3Q.js"),S=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");require("./chunks/index-BxM99sFL.js");function R(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const n in o)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(o,n);Object.defineProperty(i,n,u.get?u:{enumerable:!0,get:()=>o[n]})}}return i.default=o,Object.freeze(i)}const h=R(C);function j(o){const{displayPreferences:i,cardId:n,...u}=o,s={...u,id:o.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:o.cardId}),t.jsx(e.UXProvider,{appearance:o.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:i,children:t.jsx(e.Container,{type:"visual",cardId:n,...s,children:t.jsx(w,{cardId:n})})})})]})})}function w({cardId:o}){const i=a.useDashboardStore(s=>{var c;return(c=s.dashboard)==null?void 0:c.sheets}),{card:n,frame:u}=C.useMemo(()=>{const s=i==null?void 0:i.flatMap(l=>l.frames),c=s==null?void 0:s.flatMap(l=>l==null?void 0:l.cards),D=c==null?void 0:c.find(l=>(l==null?void 0:l.id)===o),E=s==null?void 0:s.find(l=>{var p;return(p=l==null?void 0:l.cards)==null?void 0:p.find(g=>(g==null?void 0:g.id)===o)});return{card:D,frame:E}},[i,o]);return!n||!u?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${o}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:u})})})}function M(o,i,n,u){C.useEffect(()=>{o&&!n&&i&&u(e.cloneDeep(i))},[o,n,i,u])}function L({name:o,items:i,value:n,onChange:u,isLoading:s,isError:c,refetch:D,className:E,icon:l,showNone:p=!1}){const g=h.useRef(null),[b,T]=h.useState(!1),[B,A]=h.useState("100%"),x=p?[...i||[],{id:"none",name:"None"}]:i;h.useLayoutEffect(()=>{g.current&&A(g.current.offsetWidth)},[]);function F(){var f;return s?"Loading...":c?"Error":n?(f=i==null?void 0:i.find(m=>m.id===n))==null?void 0:f.name:`Select ${o}`}function v(f,m){u(m),T(!1)}return t.jsxs(a.Popover,{open:b,onOpenChange:T,children:[t.jsx(a.PopoverTrigger,{asChild:!0,children:t.jsxs(a.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:a.cn("flex h-9 w-full justify-between",E),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[l&&t.jsx("div",{className:"mr-2",children:l}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:F()})]}),t.jsx(a.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(a.PopoverContent,{className:"w-full p-0",style:{minWidth:B},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:D,children:t.jsx(e.RefreshCw,{className:a.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",o==null?void 0:o.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:m=>v(m,f.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(a.Check,{className:a.cn("size-4",n===f.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function I(o,i){C.useEffect(()=>(o&&i&&(window.__SEMAPHOR_PRINT_STATE__={...i}),()=>{o&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[o,i])}exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createExport=e.createExport;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.CalendarPreferencesDialog=P.CalendarPreferencesDialog;exports.createEmptyKpiConfig=a.createEmptyKpiConfig;exports.createSqlGenConfig=a.createSqlGenConfig;exports.emitDashboardLoad=a.emitDashboardLoad;exports.emitDashboardUnload=a.emitDashboardUnload;exports.fmt=a.fmt;exports.getColumnDataType=a.getColumnDataType;exports.getFilterValueType=a.getFilterValueType;exports.getFormattedTableNameForQuery=a.getFormattedTableNameForQuery;exports.getQualifiedTableName=a.getQualifiedTableName;exports.getSql=a.getSql;exports.invalidateToken=a.invalidateToken;exports.isBooleanDataType=a.isBooleanDataType;exports.isColumnInSqlGen=a.isColumnInSqlGen;exports.isDateDataType=a.isDateDataType;exports.isNumberDataType=a.isNumberDataType;exports.isTextDataType=a.isTextDataType;exports.resolveDataType=a.resolveDataType;exports.resolveDatamodelName=a.resolveDatamodelName;exports.useCurrentActiveCard=a.useCurrentActiveCard;exports.useCurrentCardConfig=a.useCurrentCardConfig;exports.useCurrentSheetActiveCards=a.useCurrentSheetActiveCards;exports.useDashboardActions=a.useDashboardActions;exports.useDashboardStore=a.useDashboardStore;exports.useEditorActions=a.useEditorActions;exports.useEditorStore=a.useEditorStore;exports.ResourceManagementPanel=N.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=y.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=y.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.useDebouncedDirtyCheck=_.useDebouncedDirtyCheck;exports.AdvancedModeToggle=r.AdvancedModeToggle;exports.BriefingAuthor=r.BriefingAuthor;exports.BriefingsApiError=r.BriefingsApiError;exports.DashboardBriefingLauncher=r.DashboardBriefingLauncher;exports.DashboardControlsSettings=r.DashboardControlsSettings;exports.DashboardFilterControlsButton=r.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=r.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=r.DocumentControlsSettings;exports.ExportNotificationItem=r.ExportNotificationItem;exports.ExportNotificationList=r.ExportNotificationList;exports.NotificationBell=r.NotificationBell;exports.UnsavedChangesAlert=r.UnsavedChangesAlert;exports.VisualEditingControls=r.VisualEditingControls;exports.WatchDashboardButton=r.WatchDashboardButton;exports.applyBriefingFormPatch=r.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=r.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=r.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=r.briefingToFormDraft;exports.cancelBriefingRun=r.cancelBriefingRun;exports.createBriefing=r.createBriefing;exports.createBriefingFormDraft=r.createBriefingFormDraft;exports.deleteBriefing=r.deleteBriefing;exports.deleteBriefingRun=r.deleteBriefingRun;exports.getBriefing=r.getBriefing;exports.getBriefingArtifact=r.getBriefingArtifact;exports.getBriefingEvidence=r.getBriefingEvidence;exports.getBriefingPreviewRun=r.getBriefingPreviewRun;exports.getBriefingRun=r.getBriefingRun;exports.listBriefingRuns=r.listBriefingRuns;exports.listBriefingTenantSummaries=r.listBriefingTenantSummaries;exports.listBriefings=r.listBriefings;exports.pauseBriefing=r.pauseBriefing;exports.polishBriefingText=r.polishBriefingText;exports.previewBriefingPlan=r.previewBriefingPlan;exports.resumeBriefing=r.resumeBriefing;exports.runBriefingNow=r.runBriefingNow;exports.runBriefingPreview=r.runBriefingPreview;exports.updateBriefing=r.updateBriefing;exports.useExportPolling=r.useExportPolling;exports.useExportRecovery=r.useExportRecovery;exports.validateBriefingFormDraft=r.validateBriefingFormDraft;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=L;exports.Visual=j;exports.useExposePrintState=I;exports.usePristineSnapshotInitializer=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DE0vIuYG.js"),d=require("./chunks/common-types-C73-Ud1-.js"),P=require("./chunks/calendar-preferences-dialog-Bm7ji3k9.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-CyRoZr5T.js"),C=require("react"),N=require("./chunks/resource-management-panel-P9iNqBM1.js"),y=require("./types/index.cjs"),_=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const r=require("./chunks/dashboard-briefing-launcher-BtqtLx1-.js"),S=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");require("./chunks/index-BxM99sFL.js");function R(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const n in o)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(o,n);Object.defineProperty(i,n,u.get?u:{enumerable:!0,get:()=>o[n]})}}return i.default=o,Object.freeze(i)}const h=R(C);function j(o){const{displayPreferences:i,cardId:n,...u}=o,s={...u,id:o.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:o.cardId}),t.jsx(e.UXProvider,{appearance:o.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:i,children:t.jsx(e.Container,{type:"visual",cardId:n,...s,children:t.jsx(w,{cardId:n})})})})]})})}function w({cardId:o}){const i=a.useDashboardStore(s=>{var c;return(c=s.dashboard)==null?void 0:c.sheets}),{card:n,frame:u}=C.useMemo(()=>{const s=i==null?void 0:i.flatMap(l=>l.frames),c=s==null?void 0:s.flatMap(l=>l==null?void 0:l.cards),D=c==null?void 0:c.find(l=>(l==null?void 0:l.id)===o),E=s==null?void 0:s.find(l=>{var p;return(p=l==null?void 0:l.cards)==null?void 0:p.find(g=>(g==null?void 0:g.id)===o)});return{card:D,frame:E}},[i,o]);return!n||!u?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${o}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:u})})})}function M(o,i,n,u){C.useEffect(()=>{o&&!n&&i&&u(e.cloneDeep(i))},[o,n,i,u])}function L({name:o,items:i,value:n,onChange:u,isLoading:s,isError:c,refetch:D,className:E,icon:l,showNone:p=!1}){const g=h.useRef(null),[b,T]=h.useState(!1),[B,A]=h.useState("100%"),x=p?[...i||[],{id:"none",name:"None"}]:i;h.useLayoutEffect(()=>{g.current&&A(g.current.offsetWidth)},[]);function F(){var f;return s?"Loading...":c?"Error":n?(f=i==null?void 0:i.find(m=>m.id===n))==null?void 0:f.name:`Select ${o}`}function v(f,m){u(m),T(!1)}return t.jsxs(a.Popover,{open:b,onOpenChange:T,children:[t.jsx(a.PopoverTrigger,{asChild:!0,children:t.jsxs(a.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:a.cn("flex h-9 w-full justify-between",E),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[l&&t.jsx("div",{className:"mr-2",children:l}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:F()})]}),t.jsx(a.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(a.PopoverContent,{className:"w-full p-0",style:{minWidth:B},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:D,children:t.jsx(e.RefreshCw,{className:a.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",o==null?void 0:o.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:m=>v(m,f.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(a.Check,{className:a.cn("size-4",n===f.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function I(o,i){C.useEffect(()=>(o&&i&&(window.__SEMAPHOR_PRINT_STATE__={...i}),()=>{o&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[o,i])}exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createExport=e.createExport;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.CalendarPreferencesDialog=P.CalendarPreferencesDialog;exports.createEmptyKpiConfig=a.createEmptyKpiConfig;exports.createSqlGenConfig=a.createSqlGenConfig;exports.emitDashboardLoad=a.emitDashboardLoad;exports.emitDashboardUnload=a.emitDashboardUnload;exports.fmt=a.fmt;exports.getColumnDataType=a.getColumnDataType;exports.getFilterValueType=a.getFilterValueType;exports.getFormattedTableNameForQuery=a.getFormattedTableNameForQuery;exports.getQualifiedTableName=a.getQualifiedTableName;exports.getSql=a.getSql;exports.invalidateToken=a.invalidateToken;exports.isBooleanDataType=a.isBooleanDataType;exports.isColumnInSqlGen=a.isColumnInSqlGen;exports.isDateDataType=a.isDateDataType;exports.isNumberDataType=a.isNumberDataType;exports.isTextDataType=a.isTextDataType;exports.resolveDataType=a.resolveDataType;exports.resolveDatamodelName=a.resolveDatamodelName;exports.useCurrentActiveCard=a.useCurrentActiveCard;exports.useCurrentCardConfig=a.useCurrentCardConfig;exports.useCurrentSheetActiveCards=a.useCurrentSheetActiveCards;exports.useDashboardActions=a.useDashboardActions;exports.useDashboardStore=a.useDashboardStore;exports.useEditorActions=a.useEditorActions;exports.useEditorStore=a.useEditorStore;exports.ResourceManagementPanel=N.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=y.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=y.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.useDebouncedDirtyCheck=_.useDebouncedDirtyCheck;exports.AdvancedModeToggle=r.AdvancedModeToggle;exports.BriefingAuthor=r.BriefingAuthor;exports.BriefingsApiError=r.BriefingsApiError;exports.DashboardBriefingLauncher=r.DashboardBriefingLauncher;exports.DashboardControlsSettings=r.DashboardControlsSettings;exports.DashboardFilterControlsButton=r.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=r.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=r.DocumentControlsSettings;exports.ExportNotificationItem=r.ExportNotificationItem;exports.ExportNotificationList=r.ExportNotificationList;exports.NotificationBell=r.NotificationBell;exports.UnsavedChangesAlert=r.UnsavedChangesAlert;exports.VisualEditingControls=r.VisualEditingControls;exports.WatchDashboardButton=r.WatchDashboardButton;exports.applyBriefingFormPatch=r.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=r.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=r.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=r.briefingToFormDraft;exports.cancelBriefingRun=r.cancelBriefingRun;exports.createBriefing=r.createBriefing;exports.createBriefingFormDraft=r.createBriefingFormDraft;exports.deleteBriefing=r.deleteBriefing;exports.deleteBriefingRun=r.deleteBriefingRun;exports.getBriefing=r.getBriefing;exports.getBriefingArtifact=r.getBriefingArtifact;exports.getBriefingEvidence=r.getBriefingEvidence;exports.getBriefingPreviewRun=r.getBriefingPreviewRun;exports.getBriefingRun=r.getBriefingRun;exports.listBriefingRuns=r.listBriefingRuns;exports.listBriefingTenantSummaries=r.listBriefingTenantSummaries;exports.listBriefings=r.listBriefings;exports.pauseBriefing=r.pauseBriefing;exports.polishBriefingText=r.polishBriefingText;exports.previewBriefingPlan=r.previewBriefingPlan;exports.resumeBriefing=r.resumeBriefing;exports.runBriefingNow=r.runBriefingNow;exports.runBriefingPreview=r.runBriefingPreview;exports.updateBriefing=r.updateBriefing;exports.useExportPolling=r.useExportPolling;exports.useExportRecovery=r.useExportRecovery;exports.validateBriefingFormDraft=r.validateBriefingFormDraft;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=L;exports.Visual=j;exports.useExposePrintState=I;exports.usePristineSnapshotInitializer=M;
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { E as T, F as N, S, q as P, U as _, r as w, s as F, t as x, v as R, w as I, C as M, i as L, I as k, x as U, j as O, k as z, l as V, m as H } from "./chunks/index-zqZLz4DH.js";
2
- import { W as ca, D as fa, T as ma, Q as pa, N as ha, a9 as ga, A as Ca, H as Da, H as Ea, J as xa, V as Ta, a as ba, a8 as ya, a4 as va, P as Aa, O as Ba, ac as Na, a7 as Sa, a6 as Pa, a5 as _a, ab as wa, aa as Fa, a1 as Ra, _ as Ia, M as Ma, Y as La, L as ka, z as Ua, X as Oa, Z as za, B as Va, a3 as Ha, a0 as qa, $ as Wa, a2 as ja, y as Ga, K as Qa, G as Ka } from "./chunks/index-zqZLz4DH.js";
1
+ import { E as T, F as N, S, q as P, U as _, r as w, s as F, t as x, v as R, w as I, C as M, i as L, I as k, x as U, j as O, k as z, l as V, m as H } from "./chunks/index-DzyUhzV3.js";
2
+ import { W as ca, D as fa, T as ma, Q as pa, N as ha, a9 as ga, A as Ca, H as Da, H as Ea, J as xa, V as Ta, a as ba, a8 as ya, a4 as va, P as Aa, O as Ba, ac as Na, a7 as Sa, a6 as Pa, a5 as _a, ab as wa, aa as Fa, a1 as Ra, _ as Ia, M as Ma, Y as La, L as ka, z as Ua, X as Oa, Z as za, B as Va, a3 as Ha, a0 as qa, $ as Wa, a2 as ja, y as Ga, K as Qa, G as Ka } from "./chunks/index-DzyUhzV3.js";
3
3
  import { a as Ya, C as $a, D as Ja, E as Za, P as ae, g as ee, d as se, h as re, b as oe, c as te, i as ne } from "./chunks/common-types-4bjoIgvm.js";
4
- import { C as le } from "./chunks/calendar-preferences-dialog-Cxj1zuet.js";
4
+ import { C as le } from "./chunks/calendar-preferences-dialog-Cocogo9H.js";
5
5
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
6
- import { u as q, P as W, b as j, B as G, a as C, g as Q, d as K, e as X } from "./chunks/switch-DionLwdI.js";
7
- import { F as ue, q as ce, h as fe, i as me, k as pe, s as he, r as ge, w as Ce, x as De, p as Ee, j as xe, o as Te, t as be, n as ye, m as ve, l as Ae, y as Be, v as Ne, z as Se, D as Pe, A as _e, E as we, H as Fe, G as Re } from "./chunks/switch-DionLwdI.js";
6
+ import { u as q, P as W, b as j, B as G, a as C, g as Q, d as K, e as X } from "./chunks/switch-BAYfpAEb.js";
7
+ import { F as ue, q as ce, h as fe, i as me, k as pe, s as he, r as ge, w as Ce, x as De, p as Ee, j as xe, o as Te, t as be, n as ye, m as ve, l as Ae, y as Be, v as Ne, z as Se, D as Pe, A as _e, E as we, H as Fe, G as Re } from "./chunks/switch-BAYfpAEb.js";
8
8
  import * as m from "react";
9
9
  import { useMemo as Y, useEffect as b } from "react";
10
- import { ResourceManagementPanel as Me } from "./chunks/resource-management-panel-CR87UhdL.js";
10
+ import { ResourceManagementPanel as Me } from "./chunks/resource-management-panel-C4YydU9I.js";
11
11
  import { DEFAULT_CALENDAR_CONTEXT as ke, DEFAULT_SEMANTIC_DOMAIN_ACCESS as Ue } from "./types/index.js";
12
12
  import { u as ze } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
13
13
  import "react-dom";
14
14
  import "./chunks/index-CJdxSyQq.js";
15
- import { A as He, J as qe, B as We, K as je, D as Ge, d as Qe, e as Ke, c as Xe, a as Ye, E as $e, N as Je, U as Ze, V as as, W as es, C as ss, G as rs, H as os, F as ts, t as ns, h as is, z as ls, j as ds, v as us, g as cs, w as fs, x as ms, o as ps, s as hs, q as gs, f as Cs, l as Ds, p as Es, y as xs, m as Ts, r as bs, k as ys, n as vs, i as As, u as Bs, b as Ns, I as Ss } from "./chunks/dashboard-briefing-launcher-BQXscUvQ.js";
15
+ import { A as He, J as qe, B as We, K as je, D as Ge, d as Qe, e as Ke, c as Xe, a as Ye, E as $e, N as Je, U as Ze, V as as, W as es, C as ss, G as rs, H as os, F as ts, t as ns, h as is, z as ls, j as ds, v as us, g as cs, w as fs, x as ms, o as ps, s as hs, q as gs, f as Cs, l as Ds, p as Es, y as xs, m as Ts, r as bs, k as ys, n as vs, i as As, u as Bs, b as Ns, I as Ss } from "./chunks/dashboard-briefing-launcher-DF4CoaRn.js";
16
16
  import { n as _s, s as ws } from "./chunks/normalize-dashboard-for-dirty-check-5KpZN8xr.js";
17
17
  import "./chunks/index-CuHybtft.js";
18
18
  function ta(e) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-DMilTFOG.js"),e=require("../chunks/common-types-C73-Ud1-.js"),a=require("../chunks/calendar-preferences-dialog-mY0L4X0S.js");exports.Surfboard=r.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=a.CalendarPreferencesDialog;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-DE0vIuYG.js"),e=require("../chunks/common-types-C73-Ud1-.js"),a=require("../chunks/calendar-preferences-dialog-Bm7ji3k9.js");exports.Surfboard=r.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=a.CalendarPreferencesDialog;
@@ -1,6 +1,6 @@
1
- import { a as e } from "../chunks/index-zqZLz4DH.js";
1
+ import { a as e } from "../chunks/index-DzyUhzV3.js";
2
2
  import { C, E } from "../chunks/common-types-4bjoIgvm.js";
3
- import { C as s } from "../chunks/calendar-preferences-dialog-Cxj1zuet.js";
3
+ import { C as s } from "../chunks/calendar-preferences-dialog-Cocogo9H.js";
4
4
  export {
5
5
  C as CONTROL_CARD_DEFAULT_VALUE,
6
6
  s as CalendarPreferencesDialog,
@@ -233,10 +233,20 @@ export declare type SemaphorAnalyticsExecutionResult = {
233
233
  intentId?: string;
234
234
  queryId?: string;
235
235
  status: SemaphorAnalyticsExecutionStatus;
236
+ resultShape?: SemaphorAnalyticsResult['kind'] | 'period_change';
237
+ intent?: SemaphorAnalyticsIntent;
238
+ compiledQuery?: SemaphorCompiledQuery;
239
+ fieldsUsed?: SemaphorFieldRef[];
236
240
  result?: SemaphorAnalyticsResult;
237
241
  validation: SemaphorAnalyticsValidationResult;
242
+ coverage?: {
243
+ answeredObligations: string[];
244
+ missingObligations: string[];
245
+ warnings: SemaphorAnalyticsValidationIssue[];
246
+ };
238
247
  missingFields?: string[];
239
248
  warnings?: string[];
249
+ metadata?: Record<string, unknown>;
240
250
  };
241
251
 
242
252
  export declare type SemaphorAnalyticsExecutionStatus = 'answered' | 'partial' | 'failed';
@@ -247,6 +257,39 @@ export declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRec
247
257
 
248
258
  export declare type SemaphorAnalyticsIntentFixtureName = keyof typeof SEMAPHOR_ANALYTICS_INTENT_FIXTURES;
249
259
 
260
+ export declare type SemaphorAnalyticsObligation = {
261
+ id: string;
262
+ type: SemaphorAnalyticsObligationType;
263
+ subject: string;
264
+ prompt: string;
265
+ metricCandidates?: string[];
266
+ entityCandidates?: string[];
267
+ dateFieldCandidates?: string[];
268
+ dimensionCandidates?: string[];
269
+ displayFieldCandidates?: string[];
270
+ requiredFieldCandidates?: string[];
271
+ limit?: number;
272
+ timeWindowDays?: number;
273
+ timeWindowMonths?: number;
274
+ comparison?: 'same_period_last_year' | 'previous_period';
275
+ required?: boolean;
276
+ };
277
+
278
+ export declare type SemaphorAnalyticsObligationType = 'record_list' | 'count' | 'trend' | 'comparison' | 'driver_analysis' | 'metric_summary' | 'analysis_table' | 'lookup' | 'unknown';
279
+
280
+ export declare type SemaphorAnalyticsRecoveryPlan = {
281
+ version: SemaphorProtocolVersion;
282
+ kind: 'analytics_recovery_plan';
283
+ operationIntent: SemaphorOperationIntent;
284
+ plannedToolCalls: SemaphorRecoveryToolCall[];
285
+ diagnostics: Array<{
286
+ code: string;
287
+ message: string;
288
+ obligationId?: string;
289
+ recommendedNextStep?: string;
290
+ }>;
291
+ };
292
+
250
293
  export declare type SemaphorAnalyticsRepairHint = {
251
294
  code: SemaphorAnalyticsValidationCode | string;
252
295
  message?: string;
@@ -409,6 +452,13 @@ export declare type SemaphorInputSpec = {
409
452
  scope?: SemaphorInputScope;
410
453
  };
411
454
 
455
+ export declare type SemaphorMetricAnalysis = {
456
+ kind: 'period_change';
457
+ orderBy?: 'absolute_change' | 'positive_change' | 'negative_change';
458
+ direction?: 'increase' | 'decrease' | 'both';
459
+ timeWindow?: SemaphorTimeWindow;
460
+ };
461
+
412
462
  export declare type SemaphorMetricIntent = {
413
463
  kind: 'metric';
414
464
  version?: SemaphorProtocolVersion;
@@ -424,6 +474,7 @@ export declare type SemaphorMetricIntent = {
424
474
  kind: 'previous_period' | 'previous_year' | 'target';
425
475
  targetValue?: number;
426
476
  };
477
+ analysis?: SemaphorMetricAnalysis;
427
478
  inputs?: SemaphorInputBinding[];
428
479
  limit?: number;
429
480
  };
@@ -439,6 +490,27 @@ export declare type SemaphorMetricResult = SemaphorAnalyticsResultBase & {
439
490
  };
440
491
  };
441
492
 
493
+ export declare type SemaphorOperationIntent = {
494
+ version: SemaphorProtocolVersion;
495
+ kind: 'answer_obligations';
496
+ obligations: SemaphorAnalyticsObligation[];
497
+ source?: SemaphorSourceRef;
498
+ context?: Record<string, unknown>;
499
+ } | {
500
+ version: SemaphorProtocolVersion;
501
+ kind: 'dashboard_change';
502
+ instruction: string;
503
+ targetDashboardId?: string;
504
+ analyticsIntent?: SemaphorAnalyticsIntent;
505
+ context?: Record<string, unknown>;
506
+ } | {
507
+ version: SemaphorProtocolVersion;
508
+ kind: 'data_app_change';
509
+ instruction: string;
510
+ analyticsIntent?: SemaphorAnalyticsIntent;
511
+ context?: Record<string, unknown>;
512
+ };
513
+
442
514
  export declare type SemaphorProtocolIssue = {
443
515
  code: string;
444
516
  message: string;
@@ -477,6 +549,14 @@ export declare type SemaphorRecordsResult = SemaphorAnalyticsResultBase & {
477
549
  records: Array<Record<string, unknown>>;
478
550
  };
479
551
 
552
+ export declare type SemaphorRecoveryToolCall = {
553
+ name: 'semaphor_get_dataset_schema' | 'semaphor_query_spec' | 'semaphor_query_sql' | string;
554
+ arguments: Record<string, unknown>;
555
+ purpose: string;
556
+ obligationId?: string;
557
+ recoveryKind?: 'schema_discovery' | 'query_spec' | 'sql' | 'unsupported';
558
+ };
559
+
480
560
  export declare type SemaphorSourceCoordinateInput = {
481
561
  databaseName?: string;
482
562
  schemaName?: string;
@@ -544,6 +624,12 @@ export declare type SemaphorSqlResult = SemaphorAnalyticsResultBase & {
544
624
 
545
625
  export declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
546
626
 
627
+ export declare type SemaphorTimeWindow = {
628
+ unit: 'day' | 'month';
629
+ value: number;
630
+ anchor?: 'now' | 'latest_available';
631
+ };
632
+
547
633
  export declare type SemaphorValidationResult = {
548
634
  ok: boolean;
549
635
  errors: SemaphorProtocolIssue[];
@@ -566,6 +652,10 @@ export declare type SemaphorViewPresentation = {
566
652
 
567
653
  export declare function validateSemaphorAnalyticsIntent(intent: SemaphorAnalyticsIntent): SemaphorAnalyticsValidationResult;
568
654
 
655
+ export declare function validateSemaphorAnalyticsRecoveryPlan(plan: SemaphorAnalyticsRecoveryPlan): SemaphorAnalyticsValidationResult;
656
+
569
657
  export declare function validateSemaphorDashboardIntent(intent: SemaphorDashboardIntent): SemaphorValidationResult;
570
658
 
659
+ export declare function validateSemaphorOperationIntent(intent: SemaphorOperationIntent): SemaphorAnalyticsValidationResult;
660
+
571
661
  export { }
@@ -21,6 +21,7 @@ export declare const BRIEFING_TEXT_LIMITS: {
21
21
  readonly contentTitle: 500;
22
22
  readonly contentSummary: 20000;
23
23
  readonly contentText: 5000;
24
+ readonly contentSql: 50000;
24
25
  readonly contentItem: 2000;
25
26
  readonly contentCell: 500;
26
27
  readonly attachmentTitle: 500;
@@ -144,6 +145,12 @@ export declare type BriefingContentBlock = {
144
145
  title?: string;
145
146
  tiles: BriefingKpiTile[];
146
147
  evidenceIds?: string[];
148
+ } | {
149
+ type: 'progress';
150
+ label: string;
151
+ value: number;
152
+ detail?: string;
153
+ evidenceIds?: string[];
147
154
  } | BriefingContentTableBlock | {
148
155
  type: 'actions';
149
156
  title?: string;
@@ -154,6 +161,11 @@ export declare type BriefingContentBlock = {
154
161
  title?: string;
155
162
  items: string[];
156
163
  evidenceIds?: string[];
164
+ } | {
165
+ type: 'sql';
166
+ title?: string;
167
+ sql: string;
168
+ evidenceIds?: string[];
157
169
  } | {
158
170
  type: 'evidence_appendix';
159
171
  title?: string;
@@ -1906,6 +1906,13 @@ declare type SemaphorInputSpec = {
1906
1906
  scope?: SemaphorInputScope;
1907
1907
  };
1908
1908
 
1909
+ declare type SemaphorMetricAnalysis = {
1910
+ kind: 'period_change';
1911
+ orderBy?: 'absolute_change' | 'positive_change' | 'negative_change';
1912
+ direction?: 'increase' | 'decrease' | 'both';
1913
+ timeWindow?: SemaphorTimeWindow;
1914
+ };
1915
+
1909
1916
  declare type SemaphorMetricIntent = {
1910
1917
  kind: 'metric';
1911
1918
  version?: SemaphorProtocolVersion;
@@ -1921,6 +1928,7 @@ declare type SemaphorMetricIntent = {
1921
1928
  kind: 'previous_period' | 'previous_year' | 'target';
1922
1929
  targetValue?: number;
1923
1930
  };
1931
+ analysis?: SemaphorMetricAnalysis;
1924
1932
  inputs?: SemaphorInputBinding[];
1925
1933
  limit?: number;
1926
1934
  };
@@ -1988,6 +1996,12 @@ declare type SemaphorSqlIntent = {
1988
1996
 
1989
1997
  declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
1990
1998
 
1999
+ declare type SemaphorTimeWindow = {
2000
+ unit: 'day' | 'month';
2001
+ value: number;
2002
+ anchor?: 'now' | 'latest_available';
2003
+ };
2004
+
1991
2005
  declare type SemaphorViewPresentation = {
1992
2006
  kind: 'kpi';
1993
2007
  format?: 'number' | 'currency' | 'percent' | 'duration';
@@ -510,6 +510,13 @@ declare type SemaphorInputOptionsIntent = {
510
510
  limit?: number;
511
511
  };
512
512
 
513
+ declare type SemaphorMetricAnalysis = {
514
+ kind: 'period_change';
515
+ orderBy?: 'absolute_change' | 'positive_change' | 'negative_change';
516
+ direction?: 'increase' | 'decrease' | 'both';
517
+ timeWindow?: SemaphorTimeWindow;
518
+ };
519
+
513
520
  declare type SemaphorMetricIntent = {
514
521
  kind: 'metric';
515
522
  version?: SemaphorProtocolVersion;
@@ -525,6 +532,7 @@ declare type SemaphorMetricIntent = {
525
532
  kind: 'previous_period' | 'previous_year' | 'target';
526
533
  targetValue?: number;
527
534
  };
535
+ analysis?: SemaphorMetricAnalysis;
528
536
  inputs?: SemaphorInputBinding[];
529
537
  limit?: number;
530
538
  };
@@ -592,6 +600,12 @@ declare type SemaphorSqlIntent = {
592
600
 
593
601
  declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
594
602
 
603
+ declare type SemaphorTimeWindow = {
604
+ unit: 'day' | 'month';
605
+ value: number;
606
+ anchor?: 'now' | 'latest_available';
607
+ };
608
+
595
609
  export declare type WorkspaceContext = {
596
610
  projectRoot?: string;
597
611
  framework?: string;
@@ -274,6 +274,13 @@ declare type SemaphorInputOptionsIntent = {
274
274
  limit?: number;
275
275
  };
276
276
 
277
+ declare type SemaphorMetricAnalysis = {
278
+ kind: 'period_change';
279
+ orderBy?: 'absolute_change' | 'positive_change' | 'negative_change';
280
+ direction?: 'increase' | 'decrease' | 'both';
281
+ timeWindow?: SemaphorTimeWindow;
282
+ };
283
+
277
284
  declare type SemaphorMetricIntent = {
278
285
  kind: 'metric';
279
286
  version?: SemaphorProtocolVersion;
@@ -289,6 +296,7 @@ declare type SemaphorMetricIntent = {
289
296
  kind: 'previous_period' | 'previous_year' | 'target';
290
297
  targetValue?: number;
291
298
  };
299
+ analysis?: SemaphorMetricAnalysis;
292
300
  inputs?: SemaphorInputBinding[];
293
301
  limit?: number;
294
302
  };
@@ -356,6 +364,12 @@ declare type SemaphorSqlIntent = {
356
364
 
357
365
  declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
358
366
 
367
+ declare type SemaphorTimeWindow = {
368
+ unit: 'day' | 'month';
369
+ value: number;
370
+ anchor?: 'now' | 'latest_available';
371
+ };
372
+
359
373
  export declare function toSemaphorActiveInputSnapshots(inputs: SemaphorDataAppInputReference[] | undefined): SemaphorDataAppInputSnapshot[];
360
374
 
361
375
  export declare function toSemaphorInputBinding(input: SemaphorDataAppInputReference): SemaphorInputBinding;
@@ -3,6 +3,7 @@ import { ChartConfiguration } from 'chart.js';
3
3
  import { ColumnSizingState } from '@tanstack/react-table';
4
4
  import { DateRange } from 'react-day-picker';
5
5
  import { default as default_2 } from 'react-grid-layout';
6
+ import { FetchStatus } from '@tanstack/query-core';
6
7
  import { FontSpec } from 'chart.js';
7
8
  import { JSX } from 'react/jsx-runtime';
8
9
  import { JSX as JSX_2 } from 'react';
@@ -4447,6 +4448,13 @@ declare type SemaphorInputOptionsIntent = {
4447
4448
  limit?: number;
4448
4449
  };
4449
4450
 
4451
+ declare type SemaphorMetricAnalysis = {
4452
+ kind: 'period_change';
4453
+ orderBy?: 'absolute_change' | 'positive_change' | 'negative_change';
4454
+ direction?: 'increase' | 'decrease' | 'both';
4455
+ timeWindow?: SemaphorTimeWindow;
4456
+ };
4457
+
4450
4458
  declare type SemaphorMetricIntent = {
4451
4459
  kind: 'metric';
4452
4460
  version?: SemaphorProtocolVersion;
@@ -4462,6 +4470,7 @@ declare type SemaphorMetricIntent = {
4462
4470
  kind: 'previous_period' | 'previous_year' | 'target';
4463
4471
  targetValue?: number;
4464
4472
  };
4473
+ analysis?: SemaphorMetricAnalysis;
4465
4474
  inputs?: SemaphorInputBinding[];
4466
4475
  limit?: number;
4467
4476
  };
@@ -4535,6 +4544,12 @@ declare type SemaphorSqlIntent = {
4535
4544
 
4536
4545
  declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
4537
4546
 
4547
+ declare type SemaphorTimeWindow = {
4548
+ unit: 'day' | 'month';
4549
+ value: number;
4550
+ anchor?: 'now' | 'latest_available';
4551
+ };
4552
+
4538
4553
  /**
4539
4554
  * Stable serializer for dashboard dirty checks.
4540
4555
  * This consolidates normalization + serialization into one call site, so
@@ -6084,6 +6099,7 @@ export declare function useCard(cardId: string): {
6084
6099
  isError: boolean;
6085
6100
  isLoading: boolean;
6086
6101
  isFetching: boolean;
6102
+ fetchStatus: FetchStatus;
6087
6103
  visualKey: number;
6088
6104
  handleDatapointClick: (chart: Chart_2, datasetIndex: number, clickIndex: number, value: number) => void;
6089
6105
  cfg: TChartConfiguration | undefined;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.333",
8
+ "version": "0.1.335",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",