react-semaphor 0.1.361 → 0.1.363
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/chunks/{calendar-preferences-dialog-GwtaSN53.js → calendar-preferences-dialog-CCWsI9hQ.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-BEKBpwMY.js → calendar-preferences-dialog-DCh8LMFL.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D6gGO5wz.js → dashboard-briefing-launcher-BPJcXz59.js} +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-DYxd4856.js → dashboard-briefing-launcher-BsWvqsgi.js} +1 -1
- package/dist/chunks/{dashboard-controls-C_rExqPw.js → dashboard-controls-7uVDGJgT.js} +1 -1
- package/dist/chunks/{dashboard-controls-B4u5RsKl.js → dashboard-controls-Ty36m44I.js} +3 -3
- package/dist/chunks/{dashboard-json-CPGTofhm.js → dashboard-json-COqIDBU7.js} +1 -1
- package/dist/chunks/{dashboard-json-BWWU6a7V.js → dashboard-json-CVlvQrWF.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-D_jZ-iix.js → edit-dashboard-visual-4wuOgtnP.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-biMO829J.js → edit-dashboard-visual-yfR8agWj.js} +3 -3
- package/dist/chunks/{index-Db1XVmfU.js → index-B0Qkb2b3.js} +2 -2
- package/dist/chunks/{index-CJ2IEuKz.js → index-DEvjcO2T.js} +11 -5
- package/dist/chunks/{resource-management-panel-B9-5VHYe.js → resource-management-panel-BWHj4Red.js} +2 -2
- package/dist/chunks/{resource-management-panel-Bam-yvnt.js → resource-management-panel-DO4VOGlS.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DAvEqaJV.js → use-create-flow-overlay-state-CtOJ3KgD.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-dhxgdLYo.js → use-create-flow-overlay-state-pwbt_yFw.js} +1 -1
- package/dist/chunks/{use-visual-utils-CAKdXsr5.js → use-visual-utils-BQBJEW6P.js} +1 -1
- package/dist/chunks/{use-visual-utils-FoHNPwpu.js → use-visual-utils-CzxWsSJL.js} +1 -1
- package/dist/chunks/{validation-3nSax_Vs.js → validation-B4_hBuYu.js} +164 -168
- package/dist/chunks/validation-CsK42Vbq.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +1 -1
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +37 -36
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/data-app-sdk.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/validation-bKtG7HIt.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const z=require("./validators-Cu_w8ZEP.js"),c=require("./source-identity-C-xaeE_I.js");function g(e){var r;const t=O(e);return{version:1,kind:"metric",id:e.id,label:e.label,source:y(e),metrics:t,primaryMetric:D(e,t),dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,dimensions:(r=e.dimensions)==null?void 0:r.map(o=>a(o,"dimension")),comparison:J(e.comparison),orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:v(e.inputs),limit:e.limit}}function M(e){var r;return{...g(e),...e.timeWindow?{timeWindow:e.timeWindow}:{},...(r=e.filters)!=null&&r.length?{filters:e.filters}:{},...e.analysis?{analysis:e.analysis}:{}}}function B(e){return{...e.chartTitle?{chartTitle:e.chartTitle}:{},...e.chartType?{chartType:e.chartType}:{},...e.driverMode?{driverMode:e.driverMode}:{},...e.includePopulation!==void 0?{includePopulation:e.includePopulation}:{},...e.calendarContext?{calendarContext:e.calendarContext}:{}}}function D(e,t){if(!e.primaryMetric)return t[0]||{name:"",role:"measure"};const r=a(e.primaryMetric,"measure"),o=N(r,t),i=o.length===1?o[0]:void 0;return i?b(r,i):r}function O(e){const t=[];for(const r of e.metrics.map(o=>a(o,"measure"))){if(!r.name)continue;const o=t.findIndex(i=>H(i,r));if(o===-1){t.push(r);continue}t[o]=b(t[o],r)}return t}function H(e,t){return c.semaphorFieldRefsMatch(e,t)&&u(e)===u(t)}function j(e,t){return u(t)===u(e)}function q(e,t){return t.name!==e.name||e.source&&!c.semaphorFieldRefsMatch(t,e)?!1:j(e,t)}function N(e,t){const r=t.filter(o=>q(e,o));return e.aggregate!==void 0,r}function u(e){return(e.aggregate||"SUM").toUpperCase()}function b(e,t){if(e.aggregate&&t.aggregate&&e.aggregate!==t.aggregate)throw new Error(`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${t.aggregate}.`);return{...c.preferSemaphorFieldRefMetadata(e,t),aggregate:e.aggregate||t.aggregate}}function _(e){if("sort"in e)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!K(e))throw new Error("useSemaphorRecords needs at least one field.");const t=E(e.fields);return{version:1,kind:"records",id:e.id,label:e.label,source:y(e),fields:t,dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:v(e.inputs),limit:e.limit}}function E(e){return e.map(t=>{const r=a(t);if(!r.role)throw new Error(`useSemaphorRecords field "${r.name}" needs an explicit role.`);return r})}function w(e){return{version:1,kind:"inputOptions",id:e.id,label:e.label,source:y(e),field:a(e.field,"dimension"),search:e.search,limit:e.limit}}function $(e){if("toAnalyticsInput"in e){const t=e.toAnalyticsInput();return{inputId:t.inputId,...t.field?{field:t.field}:{}}}return{inputId:e.inputId,...e.field?{field:e.field}:{}}}function U(e){const t=v(e);return t.length>0?t:void 0}function C(e){return(e||[]).map(W)}function V(e){return C(e).filter(t=>t.isActive)}function G(e){return e.kind==="filter"?{inputId:e.id,kind:e.kind,label:e.label,field:a(e.field,"dimension"),operator:e.operator||"in"}:{inputId:e.id,kind:e.kind,label:e.label}}function Q(e=[]){return e.map(t=>typeof t=="object"?t:{label:String(t),value:t})}function F(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!0}function W(e){return"toAnalyticsInput"in e?e.toAnalyticsInput():"kind"in e&&"isActive"in e?e:{...e,kind:"filter",isActive:F(e.value),value:e.value}}function y(e){return e.source}function K(e){var t;return!!((t=e.fields)!=null&&t.length)}function a(e,t){return{...e,role:e.role||t}}function v(e){return(e||[]).map($)}function J(e){if(e)return e}function T(e,t={}){const r=t.pathPrefix||"analysisOptions";if(e===void 0)return{ok:!0};if(!e||typeof e!="object"||Array.isArray(e))return s(r,"Data App analysis options must be an object.");const o=e,i={};if(o.chartTitle!==void 0){if(typeof o.chartTitle!="string")return s(`${r}.chartTitle`,'Data App analysis option "chartTitle" must be a string.');i.chartTitle=o.chartTitle}if(o.chartType!==void 0){if(typeof o.chartType!="string")return s(`${r}.chartType`,'Data App analysis option "chartType" must be a string.');i.chartType=o.chartType}if(o.driverMode!==void 0){if(!Y(o.driverMode))return s(`${r}.driverMode`,'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.');i.driverMode=o.driverMode}if(o.includePopulation!==void 0){if(typeof o.includePopulation!="boolean")return s(`${r}.includePopulation`,'Data App analysis option "includePopulation" must be a boolean.');i.includePopulation=o.includePopulation}if(o.calendarContext!==void 0){const n=ee(o.calendarContext,{pathPrefix:`${r}.calendarContext`,validateTimezone:t.validateTimezone});if(!n.ok)return n;i.calendarContext=n.calendarContext}return{ok:!0,analysisOptions:i}}function L(e){const t=e.hooks.map((i,n)=>X(i,n,{fieldCatalogs:e.fieldCatalogs||[],requireFieldCatalog:!!e.requireFieldCatalog,validateTimezone:e.validateTimezone})),r=t.flatMap(i=>i.diagnostics),o=t.map(i=>i.executionResult);return{ok:r.every(i=>i.severity!=="error"),diagnostics:r,hooks:t,intents:t.flatMap(i=>i.intent?[i.intent]:[]),executionResults:o}}function X(e,t,r){const o=`hooks.${t}`;try{const i=te(e),n=ce(e,i),d=z.validateSemaphorAnalyticsIntent(i),l=[...d.errors.map(m=>k(m,{hook:e.hook,hookId:n,pathPrefix:o,severity:"error",intent:i})),...d.warnings.map(m=>k(m,{hook:e.hook,hookId:n,pathPrefix:o,severity:"warning",intent:i})),...re({hookSpec:e,hookId:n,intent:i,pathPrefix:o,fieldCatalogs:r.fieldCatalogs,requireFieldCatalog:r.requireFieldCatalog}),...ne({hookSpec:e,hookId:n,intent:i,pathPrefix:o,validateTimezone:r.validateTimezone})],f=le(d,l);return{hook:e.hook,hookId:n,intent:i,diagnostics:l,executionResult:A({intent:i,validation:f,diagnostics:l})}}catch(i){const n={severity:"error",code:"invalid_hook_spec",message:i instanceof Error?i.message:String(i),path:o,hook:e.hook,hookId:P(e.spec)},d=R([n]);return{hook:e.hook,hookId:n.hookId,diagnostics:[n],executionResult:A({validation:d,diagnostics:[n]})}}}function s(e,t){return{ok:!1,issues:[{code:"invalid_analysis_option",message:t,path:e}]}}function Y(e){return e==="absolute_delta"||e==="largest_negative"||e==="largest_positive"||e==="positive_and_negative"||e==="all"}function Z(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function ee(e,t){var f;if(!e||typeof e!="object"||Array.isArray(e))return s(t.pathPrefix,'Data App analysis option "calendarContext" must be an object.');const r=e,o=r.tz,i=r.weekStart,n=r.anchor,d=n&&typeof n=="object"&&!Array.isArray(n)?n.iso:void 0,l=typeof o=="string"?((f=t.validateTimezone)==null?void 0:f.call(t,o))??o:null;return l?typeof i!="number"||!Number.isInteger(i)||i<0||i>6?s(`${t.pathPrefix}.weekStart`,'Data App analysis option "calendarContext.weekStart" must be an integer from 0 to 6.'):n!=="now"&&!(typeof d=="string"&&Z(d))?s(`${t.pathPrefix}.anchor`,'Data App analysis option "calendarContext.anchor" must be "now" or an object with a valid iso string.'):{ok:!0,calendarContext:{tz:l,weekStart:i,anchor:n}}:s(`${t.pathPrefix}.tz`,'Data App analysis option "calendarContext.tz" must be a valid timezone string.')}function te(e){return e.hook==="useSemaphorMetric"?g(e.spec):e.hook==="useSemaphorAnalysis"?M(e.spec):e.hook==="useSemaphorRecords"?_(e.spec):w(e.spec)}function re(e){if(e.fieldCatalogs.length===0&&!e.requireFieldCatalog)return[];const t=se(e.fieldCatalogs,e.intent.source);return t?[...ie({...e,catalog:t}),...oe({...e,catalog:t})]:[{severity:"error",code:"invalid_source_ref",message:`Source ref for ${e.hookSpec.hook} does not match a visible Semaphor source.`,path:`${e.pathPrefix}.spec.source`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:e.intent.source}]}function ie(e){return ae(e.intent).flatMap(({field:t,path:r})=>x(e.catalog,t,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Field "${t.name}" is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.${r}`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:h(t,e.intent.source),field:t}])}function oe(e){return("inputs"in e.intent?e.intent.inputs||[]:[]).flatMap((r,o)=>{if(!r.field)return[];const i=h(r.field,e.intent.source);return c.semaphorSourcesReferToSameDataset(i,e.intent.source)?x(e.catalog,r.field,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Input "${r.inputId}" references field "${r.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:i,field:r.field}]:[{severity:"error",code:"unsupported_input_filter_composition",message:`Input "${r.inputId}" filters a different Semaphor source than the query. Cross-source Data App inputs are not supported yet.`,path:`${e.pathPrefix}.spec.inputs.${o}.field`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:i,field:r.field}]})}function ne(e){if(e.hookSpec.hook!=="useSemaphorAnalysis")return[];const t=T(e.hookSpec.spec,{pathPrefix:`${e.pathPrefix}.spec`,validateTimezone:e.validateTimezone});return t.ok?[]:t.issues.map(r=>({severity:"error",code:r.code,message:r.message,path:r.path,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:e.intent.source}))}function ae(e){return e.kind==="metric"?[...e.metrics.map((t,r)=>({field:t,path:`spec.metrics.${r}`})),...e.primaryMetric?[{field:e.primaryMetric,path:"spec.primaryMetric"}]:[],...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...(e.dimensions||[]).map((t,r)=>({field:t,path:`spec.dimensions.${r}`})),...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((t,r)=>({field:t.field,path:`spec.filters.${r}.field`}))]:e.kind==="records"?[...e.fields.map((t,r)=>({field:t,path:`spec.fields.${r}`})),...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[]]:e.kind==="inputOptions"?[{field:e.field,path:"spec.field"}]:[]}function se(e,t){return e.find(r=>p(r,t))}function x(e,t,r){const o=h(t,r);if(p(e,o))return e.fields.find(i=>de(i,t)&&p(e,h(i,e.source)))}function p(e,t){return[e.source,...e.sourceAliases||[]].some(r=>c.semaphorSourcesReferToSameDataset(r,t))}function h(e,t){return e.source||t}function de(e,t){return!!(e.name&&t.name&&e.name===t.name)}function k(e,t){return{severity:t.severity,code:e.code||"invalid_analytics_intent",message:e.message,path:e.path?`${t.pathPrefix}.spec.${e.path}`:t.pathPrefix,hook:t.hook,hookId:t.hookId,intentId:t.intent.id,source:t.intent.source}}function le(e,t){const r=R(t);return{ok:r.ok&&e.ok,errors:S([...e.errors,...r.errors]),warnings:S([...e.warnings,...r.warnings]),repairHints:[...e.repairHints,...r.repairHints]}}function R(e){const t=e.filter(o=>o.severity==="error").map(I),r=e.filter(o=>o.severity==="warning").map(I);return{ok:t.length===0,errors:t,warnings:r,repairHints:t.map(o=>{var i,n;return{code:o.code,message:o.message,fieldRole:o.fieldRole,invalidField:(i=o.repairHint)==null?void 0:i.invalidField,recommendedNextStep:((n=o.repairHint)==null?void 0:n.recommendedNextStep)||"Update the Data App SDK hook spec to use visible Semaphor source and field refs."}})}}function I(e){var t;return{code:e.code,message:e.message,path:e.path,fieldRole:e.code==="invalid_source_ref"?"source":void 0,repairHint:{code:e.code,message:e.message,invalidField:(t=e.field)==null?void 0:t.name,fieldRole:e.code==="invalid_source_ref"?"source":void 0,recommendedNextStep:e.code==="unsupported_input_filter_composition"?"Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped hooks.":"Update the hook spec to use a visible Semaphor source and field ref."}}}function S(e){const t=new Set;return e.filter(r=>{const o=`${r.code}:${r.path||""}:${r.message}`;return t.has(o)?!1:(t.add(o),!0)})}function A(e){var r,o;const t=e.diagnostics.filter(i=>i.severity==="error");return{intentId:(r=e.intent)==null?void 0:r.id,status:t.length?"failed":"answered",resultShape:(o=e.intent)==null?void 0:o.kind,intent:e.intent,validation:e.validation,coverage:{answeredObligations:t.length?[]:["hook_spec_validation"],missingObligations:t.length?["hook_spec_validation"]:[],warnings:e.validation.warnings},missingFields:t.filter(i=>i.code==="missing_field").flatMap(i=>{var n;return(n=i.field)!=null&&n.name?[i.field.name]:[]}),warnings:e.diagnostics.filter(i=>i.severity==="warning").map(i=>i.message),metadata:{validationKind:"data_app_sdk_hook_spec"}}}function ce(e,t){return t.id||P(e.spec)}function P(e){if(!e||typeof e!="object"||!("id"in e))return;const t=e.id;return typeof t=="string"&&t.trim()?t:void 0}exports.hasSemaphorInputValue=F;exports.normalizeSemaphorAnalysisQueryOptions=T;exports.normalizeSemaphorInputOptions=Q;exports.toSemaphorActiveInputSnapshots=V;exports.toSemaphorAnalysisIntent=M;exports.toSemaphorAnalysisQueryOptions=B;exports.toSemaphorInputBinding=$;exports.toSemaphorInputBindings=U;exports.toSemaphorInputOptionsIntent=w;exports.toSemaphorInputSnapshots=C;exports.toSemaphorInputSpec=G;exports.toSemaphorMetricIntent=g;exports.toSemaphorRecordsIntent=_;exports.validateSemaphorDataAppHookSpecs=L;
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-B0Qkb2b3.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
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-B0Qkb2b3.js");exports.DataAppBuilder=e.DataAppBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/validation-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/validation-CsK42Vbq.js"),O=require("../chunks/index-BxM99sFL.js"),u=require("react"),E=require("react/jsx-runtime"),g=require("../chunks/validators-Cu_w8ZEP.js");function R(){return{executeAnalysis:(t,e,n)=>y(t,e,n??{}),executeMetric:(t,e)=>y(t,e),executeRecords:(t,e)=>y(t,e),executeInputOptions:(t,e)=>y(t,e)}}async function y(t,e,n){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const o=await fetch(T(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,...n?{analysisOptions:n}:{},resultShape:t.kind})}),r=await b(o);if(!o.ok||r.error)throw new Error(r.error||`Semaphor Data App execution failed with status ${o.status}.`);return r}async function b(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:M(t,e),details:e}}}function M(t,e){const n=t.statusText?` ${t.statusText}`:"",o=e.replace(/\s+/g," ").trim();return o?`Semaphor Data App execution failed with status ${t.status}${n}: ${o.slice(0,240)}`:`Semaphor Data App execution failed with status ${t.status}${n}.`}function T(t){const e=C(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/execute`:`${e}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function C(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return O.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const x=u.createContext({});function k(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function q(){return u.useContext(x)}function K({token:t,apiBaseUrl:e,executor:n,children:o}){var d;const r=k(),s=((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(()=>R(),[]),c=n||l,h=u.useMemo(()=>({token:s,apiBaseUrl:i,executor:c}),[i,c,s]);return E.jsx(x.Provider,{value:h,children:o})}const f={value:null},A={},$={records:[]},D={options:[]};function _(t){const e=a.toSemaphorActiveInputSnapshots(t.inputs),n=a.toSemaphorAnalysisQueryOptions(t);try{const o=a.toSemaphorAnalysisIntent(t),r=v(o);return r?{error:r,activeInputs:e,analysisOptions:n,queryKey:p(void 0,e,r,n),idleData:A}:{intent:o,error:null,activeInputs:e,analysisOptions:n,queryKey:p(o,e,void 0,n),idleData:A}}catch(o){const r=S(o);return{error:r,activeInputs:e,analysisOptions:n,queryKey:p(void 0,e,r,n),idleData:A}}}function P(t){const e=a.toSemaphorActiveInputSnapshots(t.inputs);try{const n=a.toSemaphorMetricIntent(t),o=v(n);return o?{error:o,activeInputs:e,queryKey:p(void 0,e,o),idleData:f}:{intent:n,error:null,activeInputs:e,queryKey:p(n,e),idleData:f}}catch(n){const o=S(n);return{error:o,activeInputs:e,queryKey:p(void 0,e,o),idleData:f}}}function V(t){const e=a.toSemaphorActiveInputSnapshots(t.inputs),n=$;try{const o=a.toSemaphorRecordsIntent(t),r=v(o);return r?{error:r,activeInputs:e,queryKey:p(void 0,e,r),idleData:n}:{intent:o,error:null,activeInputs:e,queryKey:p(o,e),idleData:n}}catch(o){const r=S(o);return{error:r,activeInputs:e,queryKey:p(void 0,e,r),idleData:n}}}function w(t){try{const e=a.toSemaphorInputOptionsIntent(t),n=v(e);return n?{error:n,queryKey:p(void 0,void 0,n),idleData:D}:{intent:e,error:null,queryKey:p(e),idleData:D}}catch(e){const n=S(e);return{error:n,queryKey:p(void 0,void 0,n),idleData:D}}}function S(t){return t instanceof Error?t:new Error(String(t))}function v(t){const e=g.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const n=e.errors.map(o=>o.path?`${o.code} at ${o.path}: ${o.message}`:`${o.code}: ${o.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${n}`)}function p(t,e,n,o){return JSON.stringify({intent:t,activeInputs:e,analysisOptions:o,error:n==null?void 0:n.message})}function B(t){const[e,n]=u.useState(t.defaultValue),o=Object.prototype.hasOwnProperty.call(t,"value"),r=o?t.value:e,s=u.useMemo(()=>a.normalizeSemaphorInputOptions(t.options),[t.options]),i=u.useCallback(c=>{var d;const h=c;(d=t.onValueChange)==null||d.call(t,h),o||n(h)},[o,t]),l=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const c=a.toSemaphorInputSpec(t);return{id:t.id,kind:t.kind,label:t.label,field:c.field,operator:c.operator,controlRole:t.kind==="control"?t.role:void 0,value:r,options:s,isActive:a.hasSemaphorInputValue(r),setValue:i,clear:l,toAnalyticsInput:()=>({inputId:c.inputId,field:c.field,kind:t.kind,label:t.label,value:r,isActive:a.hasSemaphorInputValue(r),operator:c.operator,controlRole:t.kind==="control"?t.role:void 0})}},[l,s,i,t,r])}function Q(t){const e=u.useMemo(()=>_(t),[t]),n=u.useCallback(s=>{var i,l;return e.intent?(l=(i=s.executor)==null?void 0:i.executeAnalysis)==null?void 0:l.call(i,e.intent,s,e.analysisOptions):void 0},[e.analysisOptions,e.intent]),o=I(e.queryKey,n,e.idleData,e.activeInputs),r=e.error?e.idleData:o.data;return{id:t.id,intent:e.intent,...r||{},status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function U(t){const e=u.useMemo(()=>P(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeMetric(e.intent,s):void 0},[e.intent]),o=I(e.queryKey,n,e.idleData,e.activeInputs),r=e.error?e.idleData:o.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,executionResult:r==null?void 0:r.executionResult,status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function z(t){const e=u.useMemo(()=>V(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeRecords(e.intent,s):void 0},[e.intent]),o=I(e.queryKey,n,e.idleData,e.activeInputs),r=e.error?e.idleData:o.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,executionResult:r==null?void 0:r.executionResult,status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function L(t){const e=u.useMemo(()=>w(t),[t]),n=u.useCallback(s=>{var i;return e.intent?(i=s.executor)==null?void 0:i.executeInputOptions(e.intent,s):void 0},[e.intent]),o=I(e.queryKey,n,e.idleData),r=e.error?e.idleData:o.data;return{id:t.id,intent:e.intent,options:(r==null?void 0:r.options)||[],executionResult:r==null?void 0:r.executionResult,status:e.error?"error":o.status,isLoading:!e.error&&o.status==="loading",error:e.error||o.error}}function I(t,e,n,o){const r=q(),s=u.useRef(e),i=u.useRef(o),[l,c]=u.useState({status:"idle",data:n,error:null});return s.current=e,i.current=o,u.useEffect(()=>{let h;try{h=s.current({...r,activeInputs:i.current})}catch(m){c({status:"error",data:n,error:S(m)});return}if(!h){c({status:"idle",data:n,error:null});return}let d=!1;return c(m=>({status:"loading",data:m.data,error:null})),h.then(m=>{d||c({status:"success",data:m,error:null})}).catch(m=>{d||c({status:"error",data:n,error:S(m)})}),()=>{d=!0}},[n,t,r]),l}exports.hasSemaphorInputValue=a.hasSemaphorInputValue;exports.normalizeSemaphorAnalysisQueryOptions=a.normalizeSemaphorAnalysisQueryOptions;exports.normalizeSemaphorInputOptions=a.normalizeSemaphorInputOptions;exports.toSemaphorActiveInputSnapshots=a.toSemaphorActiveInputSnapshots;exports.toSemaphorAnalysisIntent=a.toSemaphorAnalysisIntent;exports.toSemaphorAnalysisQueryOptions=a.toSemaphorAnalysisQueryOptions;exports.toSemaphorInputBinding=a.toSemaphorInputBinding;exports.toSemaphorInputBindings=a.toSemaphorInputBindings;exports.toSemaphorInputOptionsIntent=a.toSemaphorInputOptionsIntent;exports.toSemaphorInputSnapshots=a.toSemaphorInputSnapshots;exports.toSemaphorInputSpec=a.toSemaphorInputSpec;exports.toSemaphorMetricIntent=a.toSemaphorMetricIntent;exports.toSemaphorRecordsIntent=a.toSemaphorRecordsIntent;exports.validateSemaphorDataAppHookSpecs=a.validateSemaphorDataAppHookSpecs;exports.SemaphorDataAppContext=x;exports.SemaphorDataAppProvider=K;exports.createSemaphorQueryExecutor=R;exports.readWindowRuntime=k;exports.useSemaphorAnalysis=Q;exports.useSemaphorDataAppRuntime=q;exports.useSemaphorInput=B;exports.useSemaphorInputOptions=L;exports.useSemaphorMetric=U;exports.useSemaphorRecords=z;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as x, a as g, b as O, c as K, d as T, e as $, n as _, f as b, h as E } from "../chunks/validation-
|
|
2
|
-
import { k as dt, g as pt, i as yt, j as ft, v as mt } from "../chunks/validation-
|
|
1
|
+
import { t as x, a as g, b as O, c as K, d as T, e as $, n as _, f as b, h as E } from "../chunks/validation-B4_hBuYu.js";
|
|
2
|
+
import { k as dt, g as pt, i as yt, j as ft, v as mt } from "../chunks/validation-B4_hBuYu.js";
|
|
3
3
|
import { j as P } from "../chunks/index-CuHybtft.js";
|
|
4
|
-
import { createContext as U, useContext as w, useMemo as
|
|
4
|
+
import { createContext as U, useContext as w, useMemo as p, useState as k, useCallback as f, useRef as q, useEffect as C } from "react";
|
|
5
5
|
import { jsx as B } from "react/jsx-runtime";
|
|
6
6
|
import { v as L } from "../chunks/validators-BnLhuIhd.js";
|
|
7
7
|
function M() {
|
|
@@ -85,8 +85,8 @@ function nt({
|
|
|
85
85
|
executor: o,
|
|
86
86
|
children: n
|
|
87
87
|
}) {
|
|
88
|
-
var
|
|
89
|
-
const r = z(), i = ((
|
|
88
|
+
var l;
|
|
89
|
+
const r = z(), i = ((l = r == null ? void 0 : r.authToken) == null ? void 0 : l.accessToken) || e, a = (r == null ? void 0 : r.dataApiBaseUrl) || (r == null ? void 0 : r.apiBaseUrl) || t, c = p(() => M(), []), u = o || c, d = p(
|
|
90
90
|
() => ({
|
|
91
91
|
token: i,
|
|
92
92
|
apiBaseUrl: a,
|
|
@@ -94,7 +94,7 @@ function nt({
|
|
|
94
94
|
}),
|
|
95
95
|
[a, u, i]
|
|
96
96
|
);
|
|
97
|
-
return /* @__PURE__ */ B(R.Provider, { value:
|
|
97
|
+
return /* @__PURE__ */ B(R.Provider, { value: d, children: n });
|
|
98
98
|
}
|
|
99
99
|
const A = { value: null }, I = {}, H = { records: [] }, D = { options: [] };
|
|
100
100
|
function W(e) {
|
|
@@ -221,18 +221,18 @@ function s(e, t, o, n) {
|
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
function ot(e) {
|
|
224
|
-
const [t, o] = k(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), r = n ? e.value : t, i =
|
|
224
|
+
const [t, o] = k(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), r = n ? e.value : t, i = p(
|
|
225
225
|
() => _(e.options),
|
|
226
226
|
[e.options]
|
|
227
227
|
), a = f(
|
|
228
228
|
(u) => {
|
|
229
|
-
var
|
|
230
|
-
const
|
|
231
|
-
(
|
|
229
|
+
var l;
|
|
230
|
+
const d = u;
|
|
231
|
+
(l = e.onValueChange) == null || l.call(e, d), n || o(d);
|
|
232
232
|
},
|
|
233
233
|
[n, e]
|
|
234
|
-
),
|
|
235
|
-
return
|
|
234
|
+
), c = f(() => a(void 0), [a]);
|
|
235
|
+
return p(() => {
|
|
236
236
|
const u = b(e);
|
|
237
237
|
return {
|
|
238
238
|
id: e.id,
|
|
@@ -245,7 +245,7 @@ function ot(e) {
|
|
|
245
245
|
options: i,
|
|
246
246
|
isActive: E(r),
|
|
247
247
|
setValue: a,
|
|
248
|
-
clear:
|
|
248
|
+
clear: c,
|
|
249
249
|
toAnalyticsInput: () => ({
|
|
250
250
|
inputId: u.inputId,
|
|
251
251
|
field: u.field,
|
|
@@ -257,13 +257,14 @@ function ot(e) {
|
|
|
257
257
|
controlRole: e.kind === "control" ? e.role : void 0
|
|
258
258
|
})
|
|
259
259
|
};
|
|
260
|
-
}, [
|
|
260
|
+
}, [c, i, a, e, r]);
|
|
261
261
|
}
|
|
262
262
|
function at(e) {
|
|
263
|
-
const t =
|
|
263
|
+
const t = p(() => W(e), [e]), o = f(
|
|
264
264
|
(i) => {
|
|
265
|
-
var a;
|
|
266
|
-
return t.intent ? (a = i.executor) == null ? void 0 : a.executeAnalysis(
|
|
265
|
+
var a, c;
|
|
266
|
+
return t.intent ? (c = (a = i.executor) == null ? void 0 : a.executeAnalysis) == null ? void 0 : c.call(
|
|
267
|
+
a,
|
|
267
268
|
t.intent,
|
|
268
269
|
i,
|
|
269
270
|
t.analysisOptions
|
|
@@ -286,7 +287,7 @@ function at(e) {
|
|
|
286
287
|
};
|
|
287
288
|
}
|
|
288
289
|
function it(e) {
|
|
289
|
-
const t =
|
|
290
|
+
const t = p(() => Y(e), [e]), o = f(
|
|
290
291
|
(i) => {
|
|
291
292
|
var a;
|
|
292
293
|
return t.intent ? (a = i.executor) == null ? void 0 : a.executeMetric(t.intent, i) : void 0;
|
|
@@ -314,7 +315,7 @@ function it(e) {
|
|
|
314
315
|
};
|
|
315
316
|
}
|
|
316
317
|
function ut(e) {
|
|
317
|
-
const t =
|
|
318
|
+
const t = p(() => F(e), [e]), o = f(
|
|
318
319
|
(i) => {
|
|
319
320
|
var a;
|
|
320
321
|
return t.intent ? (a = i.executor) == null ? void 0 : a.executeRecords(t.intent, i) : void 0;
|
|
@@ -339,7 +340,7 @@ function ut(e) {
|
|
|
339
340
|
};
|
|
340
341
|
}
|
|
341
342
|
function st(e) {
|
|
342
|
-
const t =
|
|
343
|
+
const t = p(() => G(e), [e]), o = f(
|
|
343
344
|
(i) => {
|
|
344
345
|
var a;
|
|
345
346
|
return t.intent ? (a = i.executor) == null ? void 0 : a.executeInputOptions(t.intent, i) : void 0;
|
|
@@ -361,47 +362,47 @@ function st(e) {
|
|
|
361
362
|
};
|
|
362
363
|
}
|
|
363
364
|
function S(e, t, o, n) {
|
|
364
|
-
const r = J(), i = q(t), a = q(n), [
|
|
365
|
+
const r = J(), i = q(t), a = q(n), [c, u] = k({
|
|
365
366
|
status: "idle",
|
|
366
367
|
data: o,
|
|
367
368
|
error: null
|
|
368
369
|
});
|
|
369
370
|
return i.current = t, a.current = n, C(() => {
|
|
370
|
-
let
|
|
371
|
+
let d;
|
|
371
372
|
try {
|
|
372
|
-
|
|
373
|
+
d = i.current({
|
|
373
374
|
...r,
|
|
374
375
|
activeInputs: a.current
|
|
375
376
|
});
|
|
376
|
-
} catch (
|
|
377
|
+
} catch (y) {
|
|
377
378
|
u({
|
|
378
379
|
status: "error",
|
|
379
380
|
data: o,
|
|
380
|
-
error: m(
|
|
381
|
+
error: m(y)
|
|
381
382
|
});
|
|
382
383
|
return;
|
|
383
384
|
}
|
|
384
|
-
if (!
|
|
385
|
+
if (!d) {
|
|
385
386
|
u({ status: "idle", data: o, error: null });
|
|
386
387
|
return;
|
|
387
388
|
}
|
|
388
|
-
let
|
|
389
|
-
return u((
|
|
389
|
+
let l = !1;
|
|
390
|
+
return u((y) => ({
|
|
390
391
|
status: "loading",
|
|
391
|
-
data:
|
|
392
|
+
data: y.data,
|
|
392
393
|
error: null
|
|
393
|
-
})),
|
|
394
|
-
|
|
395
|
-
}).catch((
|
|
396
|
-
|
|
394
|
+
})), d.then((y) => {
|
|
395
|
+
l || u({ status: "success", data: y, error: null });
|
|
396
|
+
}).catch((y) => {
|
|
397
|
+
l || u({
|
|
397
398
|
status: "error",
|
|
398
399
|
data: o,
|
|
399
|
-
error: m(
|
|
400
|
+
error: m(y)
|
|
400
401
|
});
|
|
401
402
|
}), () => {
|
|
402
|
-
|
|
403
|
+
l = !0;
|
|
403
404
|
};
|
|
404
|
-
}, [o, e, r]),
|
|
405
|
+
}, [o, e, r]), c;
|
|
405
406
|
}
|
|
406
407
|
export {
|
|
407
408
|
R as SemaphorDataAppContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/validators-Cu_w8ZEP.js");require("../chunks/source-identity-C-xaeE_I.js");const e=require("../chunks/validation-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/validators-Cu_w8ZEP.js");require("../chunks/source-identity-C-xaeE_I.js");const e=require("../chunks/validation-CsK42Vbq.js");exports.normalizeSemaphorAnalysisQueryOptions=e.normalizeSemaphorAnalysisQueryOptions;exports.validateSemaphorDataAppHookSpecs=e.validateSemaphorDataAppHookSpecs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../chunks/validators-BnLhuIhd.js";
|
|
2
2
|
import "../chunks/source-identity-qAmkNtEK.js";
|
|
3
|
-
import { k as e, v as i } from "../chunks/validation-
|
|
3
|
+
import { k as e, v as i } from "../chunks/validation-B4_hBuYu.js";
|
|
4
4
|
export {
|
|
5
5
|
e as normalizeSemaphorAnalysisQueryOptions,
|
|
6
6
|
i as validateSemaphorDataAppHookSpecs
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-Db1XVmfU.js"),d=require("./chunks/common-types-C73-Ud1-.js"),P=require("./chunks/calendar-preferences-dialog-GwtaSN53.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-C0S63HAv.js"),C=require("react"),N=require("./chunks/resource-management-panel-Bam-yvnt.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-DYxd4856.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-B0Qkb2b3.js"),d=require("./chunks/common-types-C73-Ud1-.js"),P=require("./chunks/calendar-preferences-dialog-CCWsI9hQ.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-C0S63HAv.js"),C=require("react"),N=require("./chunks/resource-management-panel-DO4VOGlS.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-BsWvqsgi.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-
|
|
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-
|
|
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-DEvjcO2T.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-DEvjcO2T.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-
|
|
4
|
+
import { C as le } from "./chunks/calendar-preferences-dialog-DCh8LMFL.js";
|
|
5
5
|
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
6
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-xcWLtWs0.js";
|
|
7
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-xcWLtWs0.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-
|
|
10
|
+
import { ResourceManagementPanel as Me } from "./chunks/resource-management-panel-BWHj4Red.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-
|
|
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-BPJcXz59.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) {
|
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-B0Qkb2b3.js"),e=require("../chunks/common-types-C73-Ud1-.js"),a=require("../chunks/calendar-preferences-dialog-CCWsI9hQ.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;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e } from "../chunks/index-
|
|
1
|
+
import { a as e } from "../chunks/index-DEvjcO2T.js";
|
|
2
2
|
import { C, E } from "../chunks/common-types-4bjoIgvm.js";
|
|
3
|
-
import { C as s } from "../chunks/calendar-preferences-dialog-
|
|
3
|
+
import { C as s } from "../chunks/calendar-preferences-dialog-DCh8LMFL.js";
|
|
4
4
|
export {
|
|
5
5
|
C as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
s as CalendarPreferencesDialog,
|
|
@@ -528,7 +528,7 @@ declare type SemaphorProtocolIssue = {
|
|
|
528
528
|
declare type SemaphorProtocolVersion = 1;
|
|
529
529
|
|
|
530
530
|
export declare type SemaphorQueryExecutor = {
|
|
531
|
-
executeAnalysis(intent: SemaphorMetricIntent, context: SemaphorQueryExecutorContext, options?: SemaphorAnalysisQueryOptions): Promise<SemaphorAnalysisPayload>;
|
|
531
|
+
executeAnalysis?(intent: SemaphorMetricIntent, context: SemaphorQueryExecutorContext, options?: SemaphorAnalysisQueryOptions): Promise<SemaphorAnalysisPayload>;
|
|
532
532
|
executeMetric(intent: SemaphorMetricIntent, context: SemaphorQueryExecutorContext): Promise<SemaphorMetricPayload>;
|
|
533
533
|
executeRecords<TRecord extends Record<string, unknown> = Record<string, unknown>>(intent: SemaphorRecordsIntent, context: SemaphorQueryExecutorContext): Promise<SemaphorRecordsPayload<TRecord>>;
|
|
534
534
|
executeInputOptions(intent: Extract<SemaphorAnalyticsIntent, {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const B=require("./validators-Cu_w8ZEP.js"),c=require("./source-identity-C-xaeE_I.js");function g(e){var r;const t=H(e);return{version:1,kind:"metric",id:e.id,label:e.label,source:y(e),metrics:t,primaryMetric:O(e,t),dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,dimensions:(r=e.dimensions)==null?void 0:r.map(i=>a(i,"dimension")),comparison:J(e.comparison),orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:v(e.inputs),limit:e.limit}}function b(e){var r;return{...g(e),...e.timeWindow?{timeWindow:e.timeWindow}:{},...(r=e.filters)!=null&&r.length?{filters:e.filters}:{},...e.analysis?{analysis:e.analysis}:{}}}function D(e){return{...e.chartTitle?{chartTitle:e.chartTitle}:{},...e.chartType?{chartType:e.chartType}:{},...e.driverMode?{driverMode:e.driverMode}:{},...e.includePopulation!==void 0?{includePopulation:e.includePopulation}:{},...e.calendarContext?{calendarContext:e.calendarContext}:{}}}function O(e,t){if(!e.primaryMetric)return t[0]||{name:"",role:"measure"};const r=a(e.primaryMetric,"measure"),i=E(r,t),o=i.length===1?i[0]:void 0;return o?_(r,o):r}function H(e){const t=[];for(const r of e.metrics.map(i=>a(i,"measure"))){if(!r.name)continue;const i=t.findIndex(o=>N(o,r));if(i===-1){t.push(r);continue}t[i]=_(t[i],r)}return t}function N(e,t){return c.semaphorFieldRefsMatch(e,t)&&u(e)===u(t)}function j(e,t){return u(t)===u(e)}function q(e,t){return t.name!==e.name||e.source&&!c.semaphorFieldRefsMatch(t,e)?!1:j(e,t)}function E(e,t){const r=t.filter(i=>q(e,i));return e.aggregate!==void 0,r}function u(e){return(e.aggregate||"SUM").toUpperCase()}function _(e,t){if(e.aggregate&&t.aggregate&&e.aggregate!==t.aggregate)throw new Error(`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${t.aggregate}.`);return{...c.preferSemaphorFieldRefMetadata(e,t),aggregate:e.aggregate||t.aggregate}}function w(e){if("sort"in e)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!L(e))throw new Error("useSemaphorRecords needs at least one field.");const t=U(e.fields);return{version:1,kind:"records",id:e.id,label:e.label,source:y(e),fields:t,dateField:e.dateField?a(e.dateField,"date"):void 0,timeGrain:e.timeGrain,orderBy:e.orderBy?{field:a(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:v(e.inputs),limit:e.limit}}function U(e){return e.map(t=>{const r=a(t);if(!r.role)throw new Error(`useSemaphorRecords field "${r.name}" needs an explicit role.`);return r})}function C(e){return{version:1,kind:"inputOptions",id:e.id,label:e.label,source:y(e),field:a(e.field,"dimension"),search:e.search,limit:e.limit}}function $(e){if("toAnalyticsInput"in e){const t=e.toAnalyticsInput();return{inputId:t.inputId,...t.field?{field:t.field}:{}}}return{inputId:e.inputId,...e.field?{field:e.field}:{}}}function V(e){const t=v(e);return t.length>0?t:void 0}function F(e){return(e||[]).map(K)}function G(e){return F(e).filter(t=>t.isActive)}function Q(e){return e.kind==="filter"?{inputId:e.id,kind:e.kind,label:e.label,field:a(e.field,"dimension"),operator:e.operator||"in"}:{inputId:e.id,kind:e.kind,label:e.label}}function W(e=[]){return e.map(t=>typeof t=="object"?t:{label:String(t),value:t})}function T(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!0}function K(e){return"toAnalyticsInput"in e?e.toAnalyticsInput():"kind"in e&&"isActive"in e?e:{...e,kind:"filter",isActive:T(e.value),value:e.value}}function y(e){return e.source}function L(e){var t;return!!((t=e.fields)!=null&&t.length)}function a(e,t){return{...e,role:e.role||t}}function v(e){return(e||[]).map($)}function J(e){if(e)return e}function x(e,t={}){const r=t.pathPrefix||"analysisOptions";if(e===void 0)return{ok:!0};if(!e||typeof e!="object"||Array.isArray(e))return s(r,"Data App analysis options must be an object.");const i=e,o={};if(i.chartTitle!==void 0){if(typeof i.chartTitle!="string")return s(`${r}.chartTitle`,'Data App analysis option "chartTitle" must be a string.');o.chartTitle=i.chartTitle}if(i.chartType!==void 0){if(typeof i.chartType!="string")return s(`${r}.chartType`,'Data App analysis option "chartType" must be a string.');o.chartType=i.chartType}if(i.driverMode!==void 0){if(!Z(i.driverMode))return s(`${r}.driverMode`,'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.');o.driverMode=i.driverMode}if(i.includePopulation!==void 0){if(typeof i.includePopulation!="boolean")return s(`${r}.includePopulation`,'Data App analysis option "includePopulation" must be a boolean.');o.includePopulation=i.includePopulation}if(i.calendarContext!==void 0){const n=te(i.calendarContext,{pathPrefix:`${r}.calendarContext`,validateTimezone:t.validateTimezone});if(!n.ok)return n;o.calendarContext=n.calendarContext}return{ok:!0,analysisOptions:o}}function X(e){const t=e.hooks.map((o,n)=>Y(o,n,{fieldCatalogs:e.fieldCatalogs||[],requireFieldCatalog:!!e.requireFieldCatalog,validateTimezone:e.validateTimezone})),r=t.flatMap(o=>o.diagnostics),i=t.map(o=>o.executionResult);return{ok:r.every(o=>o.severity!=="error"),diagnostics:r,hooks:t,intents:t.flatMap(o=>o.intent?[o.intent]:[]),executionResults:i}}function Y(e,t,r){const i=`hooks.${t}`;try{const o=re(e),n=fe(e,o),d=B.validateSemaphorAnalyticsIntent(o),l=[...d.errors.map(m=>I(m,{hook:e.hook,hookId:n,pathPrefix:i,severity:"error",intent:o})),...d.warnings.map(m=>I(m,{hook:e.hook,hookId:n,pathPrefix:i,severity:"warning",intent:o})),...ie({hookSpec:e,hookId:n,intent:o,pathPrefix:i,fieldCatalogs:r.fieldCatalogs,requireFieldCatalog:r.requireFieldCatalog}),...ae({hookSpec:e,hookId:n,intent:o,pathPrefix:i,validateTimezone:r.validateTimezone})],f=ce(d,l);return{hook:e.hook,hookId:n,intent:o,diagnostics:l,executionResult:M({intent:o,validation:f,diagnostics:l})}}catch(o){const n={severity:"error",code:"invalid_hook_spec",message:o instanceof Error?o.message:String(o),path:i,hook:e.hook,hookId:z(e.spec)},d=P([n]);return{hook:e.hook,hookId:n.hookId,diagnostics:[n],executionResult:M({validation:d,diagnostics:[n]})}}}function s(e,t){return{ok:!1,issues:[{code:"invalid_analysis_option",message:t,path:e}]}}function Z(e){return e==="absolute_delta"||e==="largest_negative"||e==="largest_positive"||e==="positive_and_negative"||e==="all"}function ee(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function te(e,t){var f;if(!e||typeof e!="object"||Array.isArray(e))return s(t.pathPrefix,'Data App analysis option "calendarContext" must be an object.');const r=e,i=r.tz,o=r.weekStart,n=r.anchor,d=n&&typeof n=="object"&&!Array.isArray(n)?n.iso:void 0,l=typeof i=="string"?((f=t.validateTimezone)==null?void 0:f.call(t,i))??i:null;return l?typeof o!="number"||!Number.isInteger(o)||o<0||o>6?s(`${t.pathPrefix}.weekStart`,'Data App analysis option "calendarContext.weekStart" must be an integer from 0 to 6.'):n!=="now"&&!(typeof d=="string"&&ee(d))?s(`${t.pathPrefix}.anchor`,'Data App analysis option "calendarContext.anchor" must be "now" or an object with a valid iso string.'):{ok:!0,calendarContext:{tz:l,weekStart:o,anchor:n}}:s(`${t.pathPrefix}.tz`,'Data App analysis option "calendarContext.tz" must be a valid timezone string.')}function re(e){return e.hook==="useSemaphorMetric"?g(e.spec):e.hook==="useSemaphorAnalysis"?b(e.spec):e.hook==="useSemaphorRecords"?w(e.spec):C(e.spec)}function ie(e){if(e.fieldCatalogs.length===0&&!e.requireFieldCatalog)return[];const t=de(e.fieldCatalogs,e.intent.source);return t?[...oe({...e,catalog:t}),...ne({...e,catalog:t})]:[{severity:"error",code:"invalid_source_ref",message:`Source ref for ${e.hookSpec.hook} does not match a visible Semaphor source.`,path:`${e.pathPrefix}.spec.source`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:e.intent.source}]}function oe(e){return se(e.intent).flatMap(({field:t,path:r})=>R(e.catalog,t,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Field "${t.name}" is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.${r}`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:h(t,e.intent.source),field:t}])}function ne(e){return("inputs"in e.intent?e.intent.inputs||[]:[]).flatMap((r,i)=>{if(!r.field)return[];const o=h(r.field,e.intent.source);return c.semaphorSourcesReferToSameDataset(o,e.intent.source)?R(e.catalog,r.field,e.intent.source)?[]:[{severity:"error",code:"missing_field",message:`Input "${r.inputId}" references field "${r.field.name}", which is not visible on the selected Semaphor source.`,path:`${e.pathPrefix}.spec.inputs.${i}.field`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:o,field:r.field}]:[{severity:"error",code:"unsupported_input_filter_composition",message:`Input "${r.inputId}" filters a different Semaphor source than the query. Cross-source Data App inputs are not supported yet.`,path:`${e.pathPrefix}.spec.inputs.${i}.field`,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:o,field:r.field}]})}function ae(e){if(e.hookSpec.hook!=="useSemaphorAnalysis")return[];const t=x(e.hookSpec.spec,{pathPrefix:`${e.pathPrefix}.spec`,validateTimezone:e.validateTimezone});return t.ok?[]:t.issues.map(r=>({severity:"error",code:r.code,message:r.message,path:r.path,hook:e.hookSpec.hook,hookId:e.hookId,intentId:e.intent.id,source:e.intent.source}))}function se(e){return e.kind==="metric"?[...e.metrics.map((t,r)=>({field:t,path:`spec.metrics.${r}`})),...e.primaryMetric?[{field:e.primaryMetric,path:"spec.primaryMetric"}]:[],...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...(e.dimensions||[]).map((t,r)=>({field:t,path:`spec.dimensions.${r}`})),...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[],...(e.filters||[]).map((t,r)=>({field:t.field,path:`spec.filters.${r}.field`}))]:e.kind==="records"?[...e.fields.map((t,r)=>({field:t,path:`spec.fields.${r}`})),...e.dateField?[{field:e.dateField,path:"spec.dateField"}]:[],...e.orderBy?[{field:e.orderBy.field,path:"spec.orderBy.field"}]:[]]:e.kind==="inputOptions"?[{field:e.field,path:"spec.field"}]:[]}function de(e,t){return e.find(r=>p(r,t))}function R(e,t,r){const i=h(t,r);if(p(e,i))return e.fields.find(o=>le(o,t)&&p(e,h(o,e.source)))}function p(e,t){return[e.source,...e.sourceAliases||[]].some(r=>c.semaphorSourcesReferToSameDataset(r,t))}function h(e,t){return e.source||t}function le(e,t){const r=k(e.name),i=k(t.name);return!!(r&&i&&r===i)}function k(e){return(e||"").trim().toLowerCase()}function I(e,t){return{severity:t.severity,code:e.code||"invalid_analytics_intent",message:e.message,path:e.path?`${t.pathPrefix}.spec.${e.path}`:t.pathPrefix,hook:t.hook,hookId:t.hookId,intentId:t.intent.id,source:t.intent.source}}function ce(e,t){const r=P(t);return{ok:r.ok&&e.ok,errors:A([...e.errors,...r.errors]),warnings:A([...e.warnings,...r.warnings]),repairHints:[...e.repairHints,...r.repairHints]}}function P(e){const t=e.filter(i=>i.severity==="error").map(S),r=e.filter(i=>i.severity==="warning").map(S);return{ok:t.length===0,errors:t,warnings:r,repairHints:t.map(i=>{var o,n;return{code:i.code,message:i.message,fieldRole:i.fieldRole,invalidField:(o=i.repairHint)==null?void 0:o.invalidField,recommendedNextStep:((n=i.repairHint)==null?void 0:n.recommendedNextStep)||"Update the Data App SDK hook spec to use visible Semaphor source and field refs."}})}}function S(e){var t;return{code:e.code,message:e.message,path:e.path,fieldRole:e.code==="invalid_source_ref"?"source":void 0,repairHint:{code:e.code,message:e.message,invalidField:(t=e.field)==null?void 0:t.name,fieldRole:e.code==="invalid_source_ref"?"source":void 0,recommendedNextStep:e.code==="unsupported_input_filter_composition"?"Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped hooks.":"Update the hook spec to use a visible Semaphor source and field ref."}}}function A(e){const t=new Set;return e.filter(r=>{const i=`${r.code}:${r.path||""}:${r.message}`;return t.has(i)?!1:(t.add(i),!0)})}function M(e){var r,i;const t=e.diagnostics.filter(o=>o.severity==="error");return{intentId:(r=e.intent)==null?void 0:r.id,status:t.length?"failed":"answered",resultShape:(i=e.intent)==null?void 0:i.kind,intent:e.intent,validation:e.validation,coverage:{answeredObligations:t.length?[]:["hook_spec_validation"],missingObligations:t.length?["hook_spec_validation"]:[],warnings:e.validation.warnings},missingFields:t.filter(o=>o.code==="missing_field").flatMap(o=>{var n;return(n=o.field)!=null&&n.name?[o.field.name]:[]}),warnings:e.diagnostics.filter(o=>o.severity==="warning").map(o=>o.message),metadata:{validationKind:"data_app_sdk_hook_spec"}}}function fe(e,t){return t.id||z(e.spec)}function z(e){if(!e||typeof e!="object"||!("id"in e))return;const t=e.id;return typeof t=="string"&&t.trim()?t:void 0}exports.hasSemaphorInputValue=T;exports.normalizeSemaphorAnalysisQueryOptions=x;exports.normalizeSemaphorInputOptions=W;exports.toSemaphorActiveInputSnapshots=G;exports.toSemaphorAnalysisIntent=b;exports.toSemaphorAnalysisQueryOptions=D;exports.toSemaphorInputBinding=$;exports.toSemaphorInputBindings=V;exports.toSemaphorInputOptionsIntent=C;exports.toSemaphorInputSnapshots=F;exports.toSemaphorInputSpec=Q;exports.toSemaphorMetricIntent=g;exports.toSemaphorRecordsIntent=w;exports.validateSemaphorDataAppHookSpecs=X;
|