react-semaphor 0.1.404 → 0.1.406

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 (64) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +2 -2
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +2 -2
  5. package/dist/chunks/analyze-result-contract-8nxUOWp8.js +1 -0
  6. package/dist/chunks/{analyze-result-contract-BUgK3759.js → analyze-result-contract-DPjm6btg.js} +303 -267
  7. package/dist/chunks/{calendar-preferences-dialog-jF28UOzm.js → calendar-preferences-dialog-BDovl96B.js} +1 -1
  8. package/dist/chunks/{calendar-preferences-dialog-Dj1avYWq.js → calendar-preferences-dialog-BEJunQM-.js} +3 -3
  9. package/dist/chunks/{dashboard-briefing-launcher-BatREtF1.js → dashboard-briefing-launcher-D-G1kXb8.js} +1 -1
  10. package/dist/chunks/{dashboard-briefing-launcher-DnK3ivGs.js → dashboard-briefing-launcher-DmybDHiR.js} +4 -4
  11. package/dist/chunks/{dashboard-controls-Cp3FsITw.js → dashboard-controls-DIPQW6Vj.js} +1 -1
  12. package/dist/chunks/{dashboard-controls-DJec1DO3.js → dashboard-controls-DgjlAGWu.js} +5 -5
  13. package/dist/chunks/{dashboard-json-LB47MHc8.js → dashboard-json-DUmEB8x3.js} +3 -3
  14. package/dist/chunks/{dashboard-json-cCEwwXos.js → dashboard-json-DvW8_MWp.js} +1 -1
  15. package/dist/chunks/{edit-dashboard-visual-CBpZmNeA.js → edit-dashboard-visual-BZnVLA4S.js} +1 -1
  16. package/dist/chunks/{edit-dashboard-visual-Dg6G9Mx2.js → edit-dashboard-visual-BuwFsoeW.js} +4 -4
  17. package/dist/chunks/{index-CLIpGd1e.js → index-D7JKnhyA.js} +45 -45
  18. package/dist/chunks/{index-5aAW3fxS.js → index-DhkNgPPm.js} +3248 -3250
  19. package/dist/chunks/{switch-oim6Xl36.js → switch-DMlqgIx_.js} +1 -1
  20. package/dist/chunks/{switch-CXMExaSF.js → switch-DgiogS4X.js} +1 -1
  21. package/dist/chunks/{update-policy-BmtOqvbf.js → update-policy-2M0canB_.js} +1 -1
  22. package/dist/chunks/{update-policy-KImUg4Od.js → update-policy-Bv3_5LFK.js} +1 -1
  23. package/dist/chunks/{use-create-flow-overlay-state-CnNgMc_m.js → use-create-flow-overlay-state-B8clS9IG.js} +3 -3
  24. package/dist/chunks/{use-create-flow-overlay-state-uKR1mGi9.js → use-create-flow-overlay-state-C9QPAd9_.js} +1 -1
  25. package/dist/chunks/validators-BCQB11_y.js +1 -0
  26. package/dist/chunks/{validators-B1Mgdr3T.js → validators-DaBsAUsR.js} +254 -262
  27. package/dist/dashboard/index.cjs +1 -1
  28. package/dist/dashboard/index.js +1 -1
  29. package/dist/dashboard-authoring/index.cjs +1 -1
  30. package/dist/dashboard-authoring/index.js +2 -2
  31. package/dist/data-app-builder/index.cjs +1 -1
  32. package/dist/data-app-builder/index.js +2 -2
  33. package/dist/data-app-codegen/index.cjs +1 -1
  34. package/dist/data-app-codegen/index.js +2 -2
  35. package/dist/data-app-codegen-node/index.cjs +1 -1
  36. package/dist/data-app-codegen-node/index.js +3 -3
  37. package/dist/data-app-sdk/index.cjs +1 -1
  38. package/dist/data-app-sdk/index.js +2 -2
  39. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  40. package/dist/data-app-sdk-adapters/index.js +1 -1
  41. package/dist/data-app-sdk-validation/index.cjs +1 -1
  42. package/dist/data-app-sdk-validation/index.js +2 -2
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +7 -7
  45. package/dist/surfboard/index.cjs +1 -1
  46. package/dist/surfboard/index.js +2 -2
  47. package/dist/types/analytics-protocol.d.ts +0 -5
  48. package/dist/types/dashboard-assistant.d.ts +0 -5
  49. package/dist/types/dashboard-authoring.d.ts +0 -5
  50. package/dist/types/dashboard.d.ts +0 -5
  51. package/dist/types/data-app-builder.d.ts +0 -5
  52. package/dist/types/data-app-codegen-node.d.ts +0 -5
  53. package/dist/types/data-app-codegen.d.ts +0 -5
  54. package/dist/types/data-app-sdk-adapters.d.ts +0 -5
  55. package/dist/types/data-app-sdk-validation.d.ts +0 -5
  56. package/dist/types/data-app-sdk.d.ts +0 -5
  57. package/dist/types/main.d.ts +0 -5
  58. package/dist/types/shared.d.ts +0 -5
  59. package/dist/types/surfboard.d.ts +0 -5
  60. package/dist/types/types.d.ts +0 -5
  61. package/package.json +1 -1
  62. package/src/data-app-sdk/README.md +7 -0
  63. package/dist/chunks/analyze-result-contract-S8u7CcPL.js +0 -1
  64. package/dist/chunks/validators-DFOX0tYY.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../chunks/operators-DrTQsJXv.js"),o=require("../chunks/validators-DFOX0tYY.js"),e=require("../chunks/analyze-result-contract-S8u7CcPL.js"),i=require("../chunks/catalog-field-grounding-Bnx-3tE0.js"),l=require("../chunks/source-identity-uMaUe036.js");function u(a,r={}){const t=d(a),s={connectionId:r.connectionId,connectionType:a,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return t.includes("postgres")?{...s,prefixLevels:["schema","table"],dialect:"postgres"}:t.includes("mysql")?{...s,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:t.includes("mssql")||t.includes("sqlserver")?{...s,dialect:"mssql",supportsFilterClause:!1}:t.includes("redshift")?{...s,prefixLevels:["schema","table"],dialect:"redshift"}:t.includes("snowflake")?{...s,dialect:"snowflake"}:t.includes("clickhouse")?{connectionId:r.connectionId,connectionType:a,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:t==="s3"||t==="api"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:t==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:t==="googlesheets"||t==="fileupload"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:t==="s3tables"?{...s,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:t==="bigquery"?{...s,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:s}function p(a){const r=d(a);switch(r){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return r;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function h(a){return a.capabilities.prefixLevels.every(r=>!!c(a.source,r))}function S(a){const r=a.quoteIdentifier??y;return a.capabilities.prefixLevels.map(t=>c(a.source,t)).filter(t=>!!t).map(t=>r(t,a.capabilities.dialect)).join(".")}function c(a,r){return r==="database"?a.databaseName:r==="schema"?a.schemaName:a.tableName}function y(a,r){return r==="mysql"||r==="bigquery"||r==="clickhouse"||r==="duckdb"?`\`${a.replace(/`/g,"``")}\``:r==="mssql"?`[${a.replace(/]/g,"]]")}]`:`"${a.replace(/"/g,'""')}"`}function d(a){if(typeof a!="string")return"";const r=[];for(const t of a.trim().toLowerCase())A(t)&&r.push(t);return r.join("")}function A(a){const r=a.charCodeAt(0);return r>=48&&r<=57||r>=97&&r<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},b={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",inputId:"region",source:n,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=m.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=m.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=o.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=o.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=o.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=o.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=o.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=o.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=o.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=e.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION;exports.getSemaphorAnalyzeResultFieldNames=e.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=e.isSemaphorAnalyzeResultFieldName;exports.isSemaphorDataAppCodegenSummary=e.isSemaphorDataAppCodegenSummary;exports.parseSemaphorAnalyzeResult=e.parseSemaphorAnalyzeResult;exports.semaphorAnalyticsCoverageSchema=e.semaphorAnalyticsCoverageSchema;exports.semaphorAnalyticsDiagnosticFeedbackSchema=e.semaphorAnalyticsDiagnosticFeedbackSchema;exports.semaphorAnalyticsExecutionResultSchema=e.semaphorAnalyticsExecutionResultSchema;exports.semaphorAnalyticsPopulationSchema=e.semaphorAnalyticsPopulationSchema;exports.semaphorAnalyticsResultSchema=e.semaphorAnalyticsResultSchema;exports.semaphorAnalyticsValidationIssueSchema=e.semaphorAnalyticsValidationIssueSchema;exports.semaphorAnalyticsValidationResultSchema=e.semaphorAnalyticsValidationResultSchema;exports.semaphorAnalyzeResultSchema=e.semaphorAnalyzeResultSchema;exports.semaphorAnalyzeResultShape=e.semaphorAnalyzeResultShape;exports.semaphorDataAppCodegenSummarySchema=e.semaphorDataAppCodegenSummarySchema;exports.semaphorDerivedFieldDefinitionSchema=e.semaphorDerivedFieldDefinitionSchema;exports.semaphorExecutionFieldRefSchema=e.semaphorExecutionFieldRefSchema;exports.semaphorFieldRefSchema=e.semaphorFieldRefSchema;exports.semaphorInputOptionsResultSchema=e.semaphorInputOptionsResultSchema;exports.semaphorMatrixResultSchema=e.semaphorMatrixResultSchema;exports.semaphorMetricResultSchema=e.semaphorMetricResultSchema;exports.semaphorPhysicalSourceRefSchema=e.semaphorPhysicalSourceRefSchema;exports.semaphorRecordsResultSchema=e.semaphorRecordsResultSchema;exports.semaphorRelationshipDiagnosticsSchema=e.semaphorRelationshipDiagnosticsSchema;exports.semaphorResultColumnSchema=e.semaphorResultColumnSchema;exports.semaphorSemanticSourceRefSchema=e.semaphorSemanticSourceRefSchema;exports.semaphorSourceRefSchema=e.semaphorSourceRefSchema;exports.semaphorSqlResultSchema=e.semaphorSqlResultSchema;exports.semaphorSqlSourceRefSchema=e.semaphorSqlSourceRefSchema;exports.validateSemaphorDataAppCodegenSummary=e.validateSemaphorDataAppCodegenSummary;exports.buildAnalyticsCatalogFieldSummary=i.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=i.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=i.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=i.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=i.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=i.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=i.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=i.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=i.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=i.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=i.normalizeAnalyticsCatalogName;exports.mergeSemaphorSourcesByIdentity=l.mergeSemaphorSourcesByIdentity;exports.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=b;exports.buildSemaphorQualifiedSourcePath=S;exports.getSemaphorConnectionCapabilities=u;exports.normalizeSemaphorDialect=p;exports.semaphorSourceHasRequiredCoordinates=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../chunks/operators-DrTQsJXv.js"),o=require("../chunks/validators-BCQB11_y.js"),e=require("../chunks/analyze-result-contract-8nxUOWp8.js"),i=require("../chunks/catalog-field-grounding-Bnx-3tE0.js"),l=require("../chunks/source-identity-uMaUe036.js");function u(a,r={}){const t=d(a),s={connectionId:r.connectionId,connectionType:a,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return t.includes("postgres")?{...s,prefixLevels:["schema","table"],dialect:"postgres"}:t.includes("mysql")?{...s,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:t.includes("mssql")||t.includes("sqlserver")?{...s,dialect:"mssql",supportsFilterClause:!1}:t.includes("redshift")?{...s,prefixLevels:["schema","table"],dialect:"redshift"}:t.includes("snowflake")?{...s,dialect:"snowflake"}:t.includes("clickhouse")?{connectionId:r.connectionId,connectionType:a,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:t==="s3"||t==="api"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:t==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:t==="googlesheets"||t==="fileupload"?{connectionId:r.connectionId,connectionType:a,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:t==="s3tables"?{...s,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:t==="bigquery"?{...s,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:s}function p(a){const r=d(a);switch(r){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return r;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function h(a){return a.capabilities.prefixLevels.every(r=>!!c(a.source,r))}function S(a){const r=a.quoteIdentifier??y;return a.capabilities.prefixLevels.map(t=>c(a.source,t)).filter(t=>!!t).map(t=>r(t,a.capabilities.dialect)).join(".")}function c(a,r){return r==="database"?a.databaseName:r==="schema"?a.schemaName:a.tableName}function y(a,r){return r==="mysql"||r==="bigquery"||r==="clickhouse"||r==="duckdb"?`\`${a.replace(/`/g,"``")}\``:r==="mssql"?`[${a.replace(/]/g,"]]")}]`:`"${a.replace(/"/g,'""')}"`}function d(a){if(typeof a!="string")return"";const r=[];for(const t of a.trim().toLowerCase())A(t)&&r.push(t);return r.join("")}function A(a){const r=a.charCodeAt(0);return r>=48&&r<=57||r>=97&&r<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},b={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",inputId:"region",source:n,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=m.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=m.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=o.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=o.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=o.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=o.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=o.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=o.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=o.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=e.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=e.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION;exports.getSemaphorAnalyzeResultFieldNames=e.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=e.isSemaphorAnalyzeResultFieldName;exports.isSemaphorDataAppCodegenSummary=e.isSemaphorDataAppCodegenSummary;exports.parseSemaphorAnalyzeResult=e.parseSemaphorAnalyzeResult;exports.semaphorAnalyticsCoverageSchema=e.semaphorAnalyticsCoverageSchema;exports.semaphorAnalyticsDiagnosticFeedbackSchema=e.semaphorAnalyticsDiagnosticFeedbackSchema;exports.semaphorAnalyticsExecutionResultSchema=e.semaphorAnalyticsExecutionResultSchema;exports.semaphorAnalyticsPopulationSchema=e.semaphorAnalyticsPopulationSchema;exports.semaphorAnalyticsResultSchema=e.semaphorAnalyticsResultSchema;exports.semaphorAnalyticsValidationIssueSchema=e.semaphorAnalyticsValidationIssueSchema;exports.semaphorAnalyticsValidationResultSchema=e.semaphorAnalyticsValidationResultSchema;exports.semaphorAnalyzeResultSchema=e.semaphorAnalyzeResultSchema;exports.semaphorAnalyzeResultShape=e.semaphorAnalyzeResultShape;exports.semaphorDataAppCodegenSummarySchema=e.semaphorDataAppCodegenSummarySchema;exports.semaphorDerivedFieldDefinitionSchema=e.semaphorDerivedFieldDefinitionSchema;exports.semaphorExecutionFieldRefSchema=e.semaphorExecutionFieldRefSchema;exports.semaphorFieldRefSchema=e.semaphorFieldRefSchema;exports.semaphorInputOptionsResultSchema=e.semaphorInputOptionsResultSchema;exports.semaphorMatrixResultSchema=e.semaphorMatrixResultSchema;exports.semaphorMetricResultSchema=e.semaphorMetricResultSchema;exports.semaphorPhysicalSourceRefSchema=e.semaphorPhysicalSourceRefSchema;exports.semaphorRecordsResultSchema=e.semaphorRecordsResultSchema;exports.semaphorRelationshipDiagnosticsSchema=e.semaphorRelationshipDiagnosticsSchema;exports.semaphorResultColumnSchema=e.semaphorResultColumnSchema;exports.semaphorSemanticSourceRefSchema=e.semaphorSemanticSourceRefSchema;exports.semaphorSourceRefSchema=e.semaphorSourceRefSchema;exports.semaphorSqlResultSchema=e.semaphorSqlResultSchema;exports.semaphorSqlSourceRefSchema=e.semaphorSqlSourceRefSchema;exports.validateSemaphorDataAppCodegenSummary=e.validateSemaphorDataAppCodegenSummary;exports.buildAnalyticsCatalogFieldSummary=i.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=i.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=i.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=i.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=i.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=i.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=i.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=i.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=i.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=i.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=i.normalizeAnalyticsCatalogName;exports.mergeSemaphorSourcesByIdentity=l.mergeSemaphorSourcesByIdentity;exports.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=b;exports.buildSemaphorQualifiedSourcePath=S;exports.getSemaphorConnectionCapabilities=u;exports.normalizeSemaphorDialect=p;exports.semaphorSourceHasRequiredCoordinates=h;
@@ -1,6 +1,6 @@
1
1
  import { a as S, n as f } from "../chunks/operators-C8TxpM4C.js";
2
- import { p as g, b as v, d as A, e as R, v as C, c as I, a as T } from "../chunks/validators-B1Mgdr3T.js";
3
- import { c as k, S as F, a as D, g as q, b as E, i as L, p as M, A as O, y as x, B as N, z as P, w as z, m as w, n as B, D as H, C as U, E as Y, j, k as G, h as V, r as Q, u as $, o as K, d as W, q as X, x as Z, l as J, s as ee, f as ae, t as se, e as re, v as te } from "../chunks/analyze-result-contract-BUgK3759.js";
2
+ import { p as g, b as v, d as A, e as R, v as C, c as I, a as T } from "../chunks/validators-DaBsAUsR.js";
3
+ import { c as k, S as F, a as D, g as q, b as E, i as L, p as M, A as O, y as x, B as N, z as P, w as z, m as w, n as B, D as H, C as U, E as Y, j, k as G, h as V, r as Q, u as $, o as K, d as W, q as X, x as Z, l as J, s as ee, f as ae, t as se, e as re, v as te } from "../chunks/analyze-result-contract-DPjm6btg.js";
4
4
  import { j as ne, a as oe, g as le, c as me, h as de, f as ce, i as ue, e as pe, d as he, b as be, n as Se } from "../chunks/catalog-field-grounding-CJKAqtiC.js";
5
5
  import { m as ye, p as ge, c as ve, s as Ae, a as Re, b as Ce } from "../chunks/source-identity-y0VSSreA.js";
6
6
  function m(e, a = {}) {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-oim6Xl36.js"),A=require("../chunks/index-DRlMUglg.js"),J=require("../chunks/x-B6ghREd2.js");require("../chunks/analyze-result-contract-S8u7CcPL.js");const U=require("../chunks/palette-C4KTXOug.js"),be=require("../chunks/braces-D2tStQjF.js"),fe=require("../chunks/save-C__QggEE.js"),me=require("../chunks/layout-grid-C0OI-MRn.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-DMlqgIx_.js"),A=require("../chunks/index-DRlMUglg.js"),J=require("../chunks/x-B6ghREd2.js");require("../chunks/analyze-result-contract-8nxUOWp8.js");const U=require("../chunks/palette-C4KTXOug.js"),be=require("../chunks/braces-D2tStQjF.js"),fe=require("../chunks/save-C__QggEE.js"),me=require("../chunks/layout-grid-C0OI-MRn.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,9 +1,9 @@
1
1
  import { jsxs as d, jsx as r, Fragment as ce } from "react/jsx-runtime";
2
2
  import m from "react";
3
- import { c as q, P as ge, a as be, B as C, b as fe, U as De, C as Ie, R as me, e as le, S as se, d as Je, T as je, G as Le, H as U, I as $e, J as M, K as _e, M as Ve, N as Ue, O as Me, L as E, Q as K, V as Q, W as ee, X as he, Y as re, Z as oe, _ as ke, $ as xe, a0 as ye, a1 as ve, a2 as Ce, a3 as Ge } from "../chunks/switch-CXMExaSF.js";
3
+ import { c as q, P as ge, a as be, B as C, b as fe, U as De, C as Ie, R as me, e as le, S as se, d as Je, T as je, G as Le, H as U, I as $e, J as M, K as _e, M as Ve, N as Ue, O as Me, L as E, Q as K, V as Q, W as ee, X as he, Y as re, Z as oe, _ as ke, $ as xe, a0 as ye, a1 as ve, a2 as Ce, a3 as Ge } from "../chunks/switch-DgiogS4X.js";
4
4
  import { r as We, v as He, A as Xe, a as Ye, p as Ze } from "../chunks/index-CJdxSyQq.js";
5
5
  import { c as ae, X as qe } from "../chunks/x-CXDkqdur.js";
6
- import "../chunks/analyze-result-contract-BUgK3759.js";
6
+ import "../chunks/analyze-result-contract-DPjm6btg.js";
7
7
  import { P as G } from "../chunks/palette-Cp1hqZtm.js";
8
8
  import { B as Ke } from "../chunks/braces-8TRlDwDw.js";
9
9
  import { S as Qe } from "../chunks/save-DgMfP0j8.js";
@@ -0,0 +1 @@
1
+ "use strict";const e=require("zod"),q={answerSummary:"string",responseDetail:"responseDetail",mode:"string",comparisonType:"string",executionResult:"executionResult",compiledQuery:"unknown",data:"unknown",resultSets:"record",analysisWarnings:"unknownArray",columns:"unknownArray",records:"recordArray",rowCount:"number",rowLimitExceeded:"boolean",output:"string",querySpec:"unknown",metadata:"record",validation:"validationResult",coverage:"coverage",diagnosticFeedback:"diagnosticFeedback",missingFields:"stringArray",warnings:"unknownArray",comparison:"unknown",population:"population",comparisons:"recordArray",fieldsUsed:"compactExecutionFieldArray",primary:"recordArray",contributors:"recordArray",segments:"recordArray",periodChanges:"recordArray",changes:"recordArray",largestNegativeChanges:"recordArray",largestPositiveChanges:"recordArray",drivers:"recordArray",absoluteDeltaDrivers:"recordArray",largestNegativeDrivers:"recordArray",largestPositiveDrivers:"recordArray",periodRows:"recordArray",sql:"unknown",omitted:"stringArray"},_="semaphor-data-app-codegen-summary/v1",_e="semaphor-data-app-codegen-summary-validator/v2",je=new Set(["metric","records","matrix","analysis","sql_fallback"]),Ce=new Set(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]),qe=new Set(["absolute_delta","largest_negative","largest_positive","positive_and_negative","all"]),ie=new Set(["source","id","label","measures","primaryMeasure","dateField","timeGrain","dimensions","comparison","orderBy","filters","relationshipHint","limit","derivedFields"]),xe=new Set([...ie,"analysis","timeWindow","filters","driverMode","includePopulation","calendarContext","chartTitle","chartType"]),Ee=new Set(["source","id","label","fields","dateField","timeGrain","timeWindow","filters","orderBy","relationshipHint","limit","pagination","totals","derivedFields"]),Fe=new Set(["source","id","label","filters","relationshipHint","rows","columns","values","totals","sort","expansion","layout","displayLimits"]),Ne=new Set(["source","id","label","sql","defaultParameters","pythonCode","fields","limit","pagination","rationale"]),De=new Set(["kpi","line_chart","bar_chart","stacked_bar_chart","pie_chart","donut_chart","area_chart","table","matrix","narrative","text_block","custom"]),Te=new Set(["missing_measure","missing_dimension","missing_date","missing_relationship","missing_semantic_role","missing_current_app_state","unsupported_change_intent","ambiguous_field_grounding","invalid_ranker_output","latest_snapshot_selector_not_modeled","unsupported_grain","requires_sql_escape_hatch","unsupported_sdk_capability"]);function Oe(i){return B(i).ok}function B(i){const o=[];if(!i||typeof i!="object")return{ok:!1,issues:["Summary must be an object."]};const t=i;return t.schemaVersion!==_&&o.push(`schemaVersion must be ${_}.`),(typeof t.title!="string"||!t.title.trim())&&o.push("title is required."),Array.isArray(t.sources)||o.push("sources must be an array."),Array.isArray(t.inputs)||o.push("inputs must be an array."),Array.isArray(t.views)||o.push("views must be an array."),Array.isArray(t.filterContracts)||o.push("filterContracts must be an array."),(!t.implementationChecklist||typeof t.implementationChecklist!="object")&&o.push("implementationChecklist must be an object."),t.implementationChecklist&&typeof t.implementationChecklist=="object"&&o.push(...Ke(t.implementationChecklist)),Array.isArray(t.sources)&&t.sources.forEach((s,r)=>{o.push(...$(s,`sources.${r}`))}),Array.isArray(t.inputs)&&t.inputs.forEach((s,r)=>{o.push(...Pe(s,`inputs.${r}`))}),Array.isArray(t.views)&&t.views.forEach((s,r)=>{o.push(...Be(s,`views.${r}`))}),Array.isArray(t.filterContracts)&&t.filterContracts.forEach((s,r)=>{o.push(...Qe(s,`filterContracts.${r}`))}),t.unsupportedInsights!==void 0&&(Array.isArray(t.unsupportedInsights)?t.unsupportedInsights.forEach((s,r)=>{o.push(...gt(s,`unsupportedInsights.${r}`))}):o.push("unsupportedInsights must be an array.")),o.push(...Me(t)),{ok:o.length===0,issues:o}}function Me(i){const o=Array.isArray(i.unsupportedInsights)&&i.unsupportedInsights.some(l=>{var u;return((u=a(l))==null?void 0:u.reason)==="missing_relationship"}),t=Array.isArray(i.views)&&i.views.some(l=>{var d;const u=a((d=a(l))==null?void 0:d.computation);return(u==null?void 0:u.kind)==="unsupported"&&u.reason==="missing_relationship"});if(!o&&!t)return[];const s=[],r=a(i.validation);(r==null?void 0:r.status)!=="blocked"&&s.push("validation.status must be blocked when missing_relationship gaps are present.");const n=a(i.nextRequiredTool);return(n==null?void 0:n.name)!=="semaphor_propose_semantic_model_change"&&s.push("nextRequiredTool.name must be semaphor_propose_semantic_model_change when missing_relationship gaps are present."),s}function $(i,o){const t=a(i);return t?t.kind==="semantic"?typeof t.domainId=="string"&&t.domainId.trim()&&typeof t.datasetName=="string"&&t.datasetName.trim()?[]:[`${o} must include sourceKey or a supported source identity.`]:typeof t.sourceKey=="string"&&t.sourceKey.trim()?[]:t.kind==="physical"&&typeof t.tableName=="string"&&t.tableName.trim()&&typeof t.connectionId=="string"&&t.connectionId.trim()?[]:t.kind==="sql"&&typeof t.connectionId=="string"&&t.connectionId.trim()?[]:[`${o} must include sourceKey or a supported source identity.`]:[`${o} must be an object.`]}function Ke(i){const o=a(i);if(!o)return["implementationChecklist must be an object."];const t=[],s=["requiredDevtools","requiredInputOptions","filterScopeByInput","bindingsByView","validationCommands","browserSmokeChecks"];for(const n of s)n in o||t.push(`implementationChecklist.${n} is required.`);const r=a(o.requiredDevtools);return r?typeof r.mountRootDevtools!="boolean"&&t.push("implementationChecklist.requiredDevtools.mountRootDevtools must be a boolean."):t.push("implementationChecklist.requiredDevtools must be an object."),Array.isArray(o.requiredInputOptions)||t.push("implementationChecklist.requiredInputOptions must be an array."),Array.isArray(o.filterScopeByInput)||t.push("implementationChecklist.filterScopeByInput must be an array."),a(o.bindingsByView)||t.push("implementationChecklist.bindingsByView must be an object."),g(o.validationCommands)||t.push("implementationChecklist.validationCommands must be an array of strings."),g(o.browserSmokeChecks)||t.push("implementationChecklist.browserSmokeChecks must be an array of strings."),t}function Pe(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return(typeof t.id!="string"||!t.id.trim())&&s.push(`${o}.id is required.`),t.fieldRef&&s.push(...p(t.fieldRef,`${o}.fieldRef`)),s.push(...re(t.optionQuery,`${o}.optionQuery`)),g(t.appliesToViewIds)||s.push(`${o}.appliesToViewIds must be an array of strings.`),t.bindings!==void 0&&!Array.isArray(t.bindings)&&s.push(`${o}.bindings must be an array.`),Array.isArray(t.bindings)&&t.bindings.forEach((r,n)=>{const l=a(r);if(!l){s.push(`${o}.bindings.${n} must be an object.`);return}g(l.appliesToViewIds)||s.push(`${o}.bindings.${n}.appliesToViewIds must be an array of strings.`),s.push(...p(l.fieldRef,`${o}.bindings.${n}.fieldRef`))}),s}function Be(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];if((typeof t.id!="string"||!t.id.trim())&&s.push(`${o}.id is required.`),t.visualSpec!==void 0&&s.push(...at(t.visualSpec,`${o}.visualSpec`)),t.computation!==void 0&&s.push(...mt(t.computation,`${o}.computation`)),nt(t))return s.push(...T(t,`${o}`)),t.fields!==void 0&&(Array.isArray(t.fields)?t.fields.forEach((n,l)=>{s.push(...p(n,`${o}.fields.${l}`))}):s.push(`${o}.fields must be an array.`)),t.queryKind!==void 0&&s.push(`${o}.queryKind is not allowed for non-executable views.`),t.sdkBuilder!==void 0&&s.push(`${o}.sdkBuilder is not allowed for non-executable views.`),t.sdkSpec!==void 0&&s.push(`${o}.sdkSpec is not allowed for non-executable views.`),s;if(!Array.isArray(t.fields))return s.push(`${o}.fields must be an array.`),(t.sdkSpec!==void 0||t.sdkBuilder!==void 0)&&s.push(`${o}.fields must be an array for executable views.`),s.push(...T(t,`${o}`)),s;t.fields.forEach((n,l)=>{s.push(...p(n,`${o}.fields.${l}`))}),v(t.queryKind)||s.push(`${o}.queryKind must be a supported codegen query kind.`),t.sdkBuilder!==void 0&&!ae(t.sdkBuilder)&&s.push(`${o}.sdkBuilder must be a supported SDK builder.`);const r=a(t.computation);return(r==null?void 0:r.kind)==="server_query"&&v(t.queryKind)&&v(r.queryKind)&&r.queryKind!==t.queryKind&&s.push(`${o}.computation.queryKind must match queryKind.`),s.push(...Ye({value:t.sdkSpec,path:`${o}.sdkSpec`,queryKind:typeof t.queryKind=="string"?t.queryKind:void 0,sdkBuilder:typeof t.sdkBuilder=="string"?t.sdkBuilder:void 0}),...T(t,`${o}`)),s}function T(i,o){var Z;const t=a((Z=a(i.visualSpec))==null?void 0:Z.tableBehavior),s=a(i.sdkSpec),r=a(s==null?void 0:s.spec),n=typeof(s==null?void 0:s.builder)=="string"?s.builder:void 0,l=n==="semaphor.records"?a(r==null?void 0:r.totals):void 0,u=[];if(!t)return l&&u.push(`${o}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),u;const d=a(t.totals);return d?(d.mode==="server"&&(n!=="semaphor.records"&&u.push(`${o}.visualSpec.tableBehavior.totals.mode server is only supported for semaphor.records views.`),!l||l.mode!=="server"?u.push(`${o}.sdkSpec.spec.totals.mode must be server when tableBehavior.totals.mode is server.`):u.push(...Ve({left:d.measures,right:l.measures,leftPath:`${o}.visualSpec.tableBehavior.totals.measures`,rightPath:`${o}.sdkSpec.spec.totals.measures`}))),d.mode!=="server"&&l&&u.push(`${o}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),n==="semaphor.sql"&&d.mode!=="none"&&u.push(`${o}.visualSpec.tableBehavior.totals.mode must be none for semaphor.sql views.`),n==="semaphor.sql"&&a(r==null?void 0:r.totals)&&u.push(`${o}.sdkSpec.spec.totals is not supported for semaphor.sql.`),u):(l&&u.push(`${o}.sdkSpec.spec.totals is only allowed when tableBehavior.totals.mode is server.`),u)}function Ve({left:i,right:o,leftPath:t,rightPath:s}){if(!Array.isArray(i)||!Array.isArray(o))return[`${s} must match ${t}.`];const r=[];return i.length!==o.length?(r.push(`${s} must match ${t}.`),r):(i.forEach((n,l)=>{Le(a(n),a(o[l]))||r.push(`${s}.${l} must match ${t}.${l}.`)}),r)}function Le(i,o){return!i||!o?!1:i.name===o.name&&(i.role||"measure")===(o.role||"measure")&&X(i)===X(o)&&Ue(i,o)}function X(i){return typeof i.aggregate=="string"?i.aggregate.toUpperCase():"SUM"}function Ue(i,o){const t=a(i.source),s=a(o.source);if(Ge(t,s))return!1;const r=J(i),n=J(o);if(r.size>0||n.size>0){for(const l of r)if(n.has(l))return!0;return!1}return!t||!s||t.kind!==s.kind?!1:t.kind==="semantic"?t.domainId===s.domainId&&t.datasetName===s.datasetName&&(t.datasetId===void 0||s.datasetId===void 0||t.datasetId===s.datasetId):t.kind==="physical"?t.connectionId===s.connectionId&&t.tableName===s.tableName:t.kind==="sql"?t.connectionId===s.connectionId:!1}function Ge(i,o){if(!i||!o||i.kind!=="semantic"||o.kind!=="semantic")return!1;const t=typeof i.datasetId=="string"?i.datasetId.trim():"",s=typeof o.datasetId=="string"?o.datasetId.trim():"";return!!(t&&s&&t!==s)}function J(i){const o=typeof i.sourceKey=="string"?i.sourceKey.trim():"";return o?new Set([o]):He(a(i.source))}function He(i){const o=new Set;if(!i)return o;const t=typeof i.sourceKey=="string"?i.sourceKey.trim():"";if(t&&o.add(t),i.kind==="semantic"){const s=typeof i.domainId=="string"?i.domainId:"",r=typeof i.datasetName=="string"?i.datasetName:"",n=typeof i.datasetId=="string"?i.datasetId:"";s&&n&&o.add(`semantic:${s}:datasetId:${n}`),s&&r&&o.add(`semantic:${s}:datasetName:${r}`)}if(i.kind==="physical"){const s=typeof i.connectionId=="string"?i.connectionId:"",r=typeof i.tableName=="string"?i.tableName:"",n=typeof i.databaseName=="string"?i.databaseName:"",l=typeof i.schemaName=="string"?i.schemaName:"";s&&r&&(o.add(["physical",s,n,l,r].join(":")),o.add(`physical:${s}:${r}`))}if(i.kind==="sql"){const s=typeof i.connectionId=="string"?i.connectionId:"",r=typeof i.dialect=="string"?i.dialect:"",n=typeof i.label=="string"?i.label:"";s&&(o.add(["sql",s,r,n].join(":")),o.add(`sql:${s}`))}return o}function Qe(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];if(t.fieldRef&&s.push(...p(t.fieldRef,`${o}.fieldRef`)),(typeof t.inputId!="string"||!t.inputId.trim())&&s.push(`${o}.inputId is required.`),s.push(...re(t.optionQuery,`${o}.optionQuery`)),g(t.appliesToViewIds)||s.push(`${o}.appliesToViewIds must be an array of strings.`),g(t.notAppliedToViewIds)||s.push(`${o}.notAppliedToViewIds must be an array of strings.`),!Array.isArray(t.bindings))s.push(`${o}.bindings must be an array.`);else{const r=g(t.appliesToViewIds)?new Set(t.appliesToViewIds):void 0,n=g(t.notAppliedToViewIds)?new Set(t.notAppliedToViewIds):void 0;t.bindings.forEach((l,u)=>{const d=a(l);if(!d){s.push(`${o}.bindings.${u} must be an object.`);return}typeof d.viewId!="string"||!d.viewId?s.push(`${o}.bindings.${u}.viewId is required.`):(r&&!r.has(d.viewId)&&s.push(`${o}.bindings.${u}.viewId must be included in appliesToViewIds.`),n!=null&&n.has(d.viewId)&&s.push(`${o}.bindings.${u}.viewId must not be listed in notAppliedToViewIds.`)),s.push(...p(d.fieldRef,`${o}.bindings.${u}.fieldRef`))})}return s}function re(i,o){if(i===void 0)return[];const t=a(i);if(!t)return[`${o} must be an object.`];const s=[...h(t.valueFieldRef,`${o}.valueFieldRef`),...h(t.labelFieldRef,`${o}.labelFieldRef`),...h(t.filterFieldRef,`${o}.filterFieldRef`)];return t.builder!=="semaphor.inputOptions"&&s.push(`${o}.builder must be semaphor.inputOptions.`),typeof t.sourceKey!="string"&&t.source===void 0&&s.push(`${o} must include source or sourceKey.`),t.source!==void 0&&s.push(...$(t.source,`${o}.source`)),a(t.valueFieldRef)||s.push(`${o}.valueFieldRef is required.`),a(t.labelFieldRef)||s.push(`${o}.labelFieldRef is required.`),t.limit!==void 0&&(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<=0)&&s.push(`${o}.limit must be a positive integer.`),s}function Ye(i){var r;const o=a(i.value);if(!o)return[`${i.path} is required for executable views.`];const t=[];if(!ae(o.builder))return t.push(`${i.path}.builder must be a supported SDK builder.`),t;i.sdkBuilder&&o.builder!==i.sdkBuilder&&t.push(`${i.path}.builder must match sdkBuilder.`),i.queryKind&&v(i.queryKind)&&o.builder!==rt(i.queryKind)&&t.push(`${i.path}.builder must match queryKind.`);const s=a(o.spec);if(!s)return t.push(`${i.path}.spec must be an object.`),t;switch(o.builder){case"semaphor.metric":t.push(...S(s,ie,`${i.path}.spec`),...A(s,i.path),...O(s.measures,`${i.path}.spec.measures`),...h(s.primaryMeasure,`${i.path}.spec.primaryMeasure`),...h(s.dateField,`${i.path}.spec.dateField`),...M(s.dimensions,`${i.path}.spec.dimensions`),...K(s.orderBy,`${i.path}.spec.orderBy`),...I(s.filters,`${i.path}.spec.filters`));break;case"semaphor.analysis":t.push(...S(s,xe,`${i.path}.spec`),...A(s,i.path),...O(s.measures,`${i.path}.spec.measures`),...h(s.primaryMeasure,`${i.path}.spec.primaryMeasure`),...h(s.dateField,`${i.path}.spec.dateField`),...M(s.dimensions,`${i.path}.spec.dimensions`),...K(s.orderBy,`${i.path}.spec.orderBy`),...I(s.filters,`${i.path}.spec.filters`),...Ze(s,`${i.path}.spec`));break;case"semaphor.records":t.push(...S(s,Ee,`${i.path}.spec`),...A(s,i.path),...O(s.fields,`${i.path}.spec.fields`),...h(s.dateField,`${i.path}.spec.dateField`),...K(s.orderBy,`${i.path}.spec.orderBy`),...I(s.filters,`${i.path}.spec.filters`),...Xe(s.totals,`${i.path}.spec.totals`));break;case"semaphor.matrix":t.push(...S(s,Fe,`${i.path}.spec`),...Je(s,i.path),...et(s.rows,`${i.path}.spec.rows`),...tt(s.columns,`${i.path}.spec.columns`),...ot(s.values,`${i.path}.spec.values`),...st(s.sort,`${i.path}.spec.sort`),...I(s.filters,`${i.path}.spec.filters`),...We(s.displayLimits,`${i.path}.spec.displayLimits`));break;case"semaphor.sql":t.push(...S(s,Ne,`${i.path}.spec`),...A(s,i.path)),((r=a(s.source))==null?void 0:r.kind)!=="sql"&&t.push(`${i.path}.spec.source.kind must be sql.`),(typeof s.sql!="string"||!s.sql.trim())&&t.push(`${i.path}.spec.sql is required.`),t.push(...M(s.fields,`${i.path}.spec.fields`));break}return t}function We(i,o){if(i===void 0)return[];const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];s.push(...ee(t.rows,`${o}.rows`),...ee(t.columns,`${o}.columns`));for(const r of Object.keys(t))r==="rows"||r==="columns"||s.push(`${o}.${r} is not supported.`);return s}function ee(i,o){if(i===void 0)return[];const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<1)&&s.push(`${o}.limit must be a positive integer.`);for(const r of Object.keys(t))r!=="limit"&&s.push(`${o}.${r} is not supported; matrix display limits are count-only in v1.`);return s}function Ze(i,o){const t=[];if(i.driverMode!==void 0&&!qe.has(i.driverMode)&&t.push(`${o}.driverMode must be a supported analysis driver mode.`),i.includePopulation!==void 0&&typeof i.includePopulation!="boolean"&&t.push(`${o}.includePopulation must be a boolean.`),i.calendarContext!==void 0){const s=a(i.calendarContext);if(!s)t.push(`${o}.calendarContext must be an object.`);else{s.tz!==void 0&&typeof s.tz!="string"&&t.push(`${o}.calendarContext.tz must be a string.`),s.weekStart!==void 0&&(typeof s.weekStart!="number"||!Number.isInteger(s.weekStart)||s.weekStart<0||s.weekStart>6)&&t.push(`${o}.calendarContext.weekStart must be an integer between 0 and 6.`);const r=s.anchor;if(r!==void 0&&r!=="now"){const n=a(r);(!n||typeof n.iso!="string"||!n.iso.trim())&&t.push(`${o}.calendarContext.anchor must be now or { iso }.`)}}}return t}function Xe(i,o){if(i===void 0)return[];const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="server"&&s.push(`${o}.mode must be server.`),!Array.isArray(t.measures)||t.measures.length===0?s.push(`${o}.measures must include at least one measure.`):t.measures.forEach((r,n)=>{var l;s.push(...le(r,`${o}.measures.${n}`)),((l=a(r))==null?void 0:l.role)!=="measure"&&s.push(`${o}.measures.${n}.role must be measure.`)}),s}function S(i,o,t){const s=[];return Object.keys(i).forEach(r=>{o.has(r)||s.push(`${t}.${r} is not supported for this SDK builder.`)}),s}function A(i,o){return a(i.source)?$(i.source,`${o}.spec.source`):[`${o}.spec.source must be an object.`]}function Je(i,o){const t=a(i.source);if(!t)return[`${o}.spec.source must be an object.`];const s=$(i.source,`${o}.spec.source`);return t.kind!=="semantic"&&t.kind!=="physical"&&s.push(`${o}.spec.source.kind must be semantic or physical.`),s}function O(i,o){const t=V(i,o);return Array.isArray(i)&&i.forEach((s,r)=>{t.push(...p(s,`${o}.${r}`))}),t}function M(i,o){if(i===void 0)return[];if(!Array.isArray(i))return[`${o} must be an array.`];const t=[];return i.forEach((s,r)=>{t.push(...p(s,`${o}.${r}`))}),t}function K(i,o){if(i===void 0)return[];const t=a(i);return t?[...p(t.field,`${o}.field`),...ne(t.direction,`${o}.direction`)]:[`${o} must be an object.`]}function et(i,o){const t=V(i,o);return Array.isArray(i)&&i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t}function tt(i,o){if(i===void 0)return[];const t=[];return Array.isArray(i)?(i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t):[`${o} must be an array.`]}function ot(i,o){const t=V(i,o);return Array.isArray(i)&&i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t}function st(i,o){if(i===void 0)return[];if(!Array.isArray(i))return[`${o} must be an array.`];const t=[];return i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}n.axis!=="row"&&n.axis!=="column"&&t.push(`${o}.${r}.axis must be row or column.`),t.push(...ne(n.direction,`${o}.${r}.direction`),...it(n.by,`${o}.${r}.by`))}),t}function it(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];switch(t.kind){case"label":return[];case"field":return p(t.field,`${o}.field`);case"value":return typeof t.valueId!="string"||!t.valueId.trim()?[`${o}.valueId is required.`]:[];default:return[`${o}.kind must be label, field, or value.`]}}function ne(i,o){return i==="asc"||i==="desc"?[]:[`${o} must be asc or desc.`]}function I(i,o){if(i===void 0)return[];if(!Array.isArray(i))return[`${o} must be an array.`];const t=[];return i.forEach((s,r)=>{const n=a(s);if(!n){t.push(`${o}.${r} must be an object.`);return}t.push(...p(n.field,`${o}.${r}.field`))}),t}function V(i,o){return!Array.isArray(i)||i.length===0?[`${o} must be a non-empty array.`]:[]}function rt(i){switch(i){case"metric":return"semaphor.metric";case"records":return"semaphor.records";case"matrix":return"semaphor.matrix";case"analysis":return"semaphor.analysis";case"sql_fallback":return"semaphor.sql"}}function nt(i){const o=a(i.computation),t=a(i.visualSpec);return(o==null?void 0:o.kind)==="presentation_only"||(o==null?void 0:o.kind)==="derived"||(o==null?void 0:o.kind)==="unsupported"||i.visual==="text_block"||(t==null?void 0:t.visualType)==="text_block"}function at(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return De.has(t.visualType)||s.push(`${o}.visualType must be a supported visual type.`),t.limit!==void 0&&(typeof t.limit!="number"||!Number.isInteger(t.limit)||t.limit<=0)&&s.push(`${o}.limit must be a positive integer.`),t.tableBehavior!==void 0&&s.push(...lt(t.tableBehavior,`${o}.tableBehavior`)),s}function lt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.tableMode!=="bounded"&&t.tableMode!=="server_paginated"&&t.tableMode!=="server_windowed"&&s.push(`${o}.tableMode must be a supported table mode.`),s.push(...ut(t.height,`${o}.height`),...ct(t.pagination,`${o}.pagination`),...dt(t.sorting,`${o}.sorting`),...pt(t.totals,`${o}.totals`)),typeof t.serverSideRequired!="boolean"&&s.push(`${o}.serverSideRequired must be a boolean.`),s}function ut(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return(typeof t.maxPx!="number"||!Number.isInteger(t.maxPx)||t.maxPx<=0)&&s.push(`${o}.maxPx must be a positive integer.`),t.scroll!=="vertical"&&t.scroll!=="both"&&s.push(`${o}.scroll must be vertical or both.`),typeof t.stickyHeader!="boolean"&&s.push(`${o}.stickyHeader must be a boolean.`),s}function ct(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="none"&&t.mode!=="server"&&t.mode!=="client_for_bounded_rows"&&s.push(`${o}.mode must be a supported pagination mode.`),t.pageSize!==void 0&&(typeof t.pageSize!="number"||!Number.isInteger(t.pageSize)||t.pageSize<=0)&&s.push(`${o}.pageSize must be a positive integer.`),t.readsFrom!==void 0&&t.readsFrom!=="result.pagination"&&s.push(`${o}.readsFrom must be result.pagination.`),s}function dt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="server"&&t.mode!=="client_for_bounded_rows"&&s.push(`${o}.mode must be a supported sorting mode.`),t.defaultField!==void 0&&(typeof t.defaultField!="string"||!t.defaultField.trim())&&s.push(`${o}.defaultField must be a non-empty string.`),t.defaultDirection!==void 0&&t.defaultDirection!=="asc"&&t.defaultDirection!=="desc"&&s.push(`${o}.defaultDirection must be asc or desc.`),t.resetPageOnChange!==void 0&&typeof t.resetPageOnChange!="boolean"&&s.push(`${o}.resetPageOnChange must be a boolean.`),s}function pt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return t.mode!=="none"&&t.mode!=="server"&&t.mode!=="local"?(s.push(`${o}.mode must be none, server, or local.`),s):t.mode==="none"?(t.measures!==void 0&&s.push(`${o}.measures is not allowed when mode is none.`),t.label!==void 0&&s.push(`${o}.label is not allowed when mode is none.`),s):t.mode==="server"?(!Array.isArray(t.measures)||t.measures.length===0?s.push(`${o}.measures must include at least one measure when mode is server.`):t.measures.forEach((r,n)=>{var l;s.push(...le(r,`${o}.measures.${n}`)),((l=a(r))==null?void 0:l.role)!=="measure"&&s.push(`${o}.measures.${n}.role must be measure.`)}),t.label!==void 0&&s.push(`${o}.label is not allowed when mode is server.`),s):(t.mode==="local"&&(t.label!=="Displayed rows"&&t.label!=="Current page"&&s.push(`${o}.label must be Displayed rows or Current page when mode is local.`),t.measures!==void 0&&s.push(`${o}.measures is not allowed when mode is local.`)),s)}function mt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];switch(t.kind){case"server_query":v(t.queryKind)||s.push(`${o}.queryKind must be a supported codegen query kind.`),t.queryOwnership!==void 0&&t.queryOwnership!=="view_owned"&&t.queryOwnership!=="shared_query"&&s.push(`${o}.queryOwnership must be view_owned or shared_query.`),t.sourceKeys!==void 0&&!g(t.sourceKeys)&&s.push(`${o}.sourceKeys must be an array of strings.`),t.fieldNames!==void 0&&!g(t.fieldNames)&&s.push(`${o}.fieldNames must be an array of strings.`);break;case"derived":(typeof t.upstreamViewId!="string"||!t.upstreamViewId.trim())&&s.push(`${o}.upstreamViewId is required.`),(typeof t.derivation!="string"||!t.derivation.trim())&&s.push(`${o}.derivation is required.`);break;case"presentation_only":break;case"unsupported":(typeof t.reason!="string"||!t.reason.trim())&&s.push(`${o}.reason is required.`),(typeof t.suggestedModelingFix!="string"||!t.suggestedModelingFix.trim())&&s.push(`${o}.suggestedModelingFix is required.`);break;default:s.push(`${o}.kind must be a supported computation kind.`)}return s}function gt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];for(const n of["title","requestedQuestion","suggestedModelingFix"])(typeof t[n]!="string"||!t[n].trim())&&s.push(`${o}.${n} is required.`);return Te.has(t.reason)||s.push(`${o}.reason must be a supported unsupported insight reason.`),(t.relationshipCandidate!==void 0||t.nextRepairAction!==void 0)&&t.reason!=="missing_relationship"&&s.push(`${o} relationship repair metadata is only valid for missing_relationship unsupported insights.`),t.relationshipCandidate!==void 0&&s.push(...ft(t.relationshipCandidate,`${o}.relationshipCandidate`)),t.nextRepairAction!==void 0&&s.push(...ht(t.nextRepairAction,`${o}.nextRepairAction`)),s}function ht(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["tool","reason"]);return Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; repair actions support only tool and reason.`)}),t.tool!=="semaphor_propose_semantic_model_change"&&s.push(`${o}.tool must be semaphor_propose_semantic_model_change.`),t.reason!=="missing_relationship"&&s.push(`${o}.reason must be missing_relationship.`),s}function ft(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["source","sourceFields","target","targetFields"]);Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; relationship candidates support only source, sourceFields, target, and targetFields.`)}),s.push(...te(t.source,`${o}.source`)),s.push(...te(t.target,`${o}.target`));for(const n of["sourceFields","targetFields"]){const l=t[n];if(!Array.isArray(l)||l.length===0){s.push(`${o}.${n} must be a non-empty endpoint field array.`);continue}l.forEach((u,d)=>{s.push(...zt(u,`${o}.${n}.${d}`))})}return s}function zt(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["name","label","role","dataType"]);return Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; relationship candidate fields are scoped by their endpoint and support only name, label, role, and dataType.`)}),(typeof t.name!="string"||!t.name.trim())&&s.push(`${o}.name must be a non-empty string.`),t.role!==void 0&&(typeof t.role!="string"||!["dimension","measure","date","id","unknown"].includes(t.role))&&s.push(`${o}.role must be dimension, measure, date, id, or unknown.`),t.dataType!==void 0&&(typeof t.dataType!="string"||!["string","number","boolean","date","datetime","unknown"].includes(t.dataType))&&s.push(`${o}.dataType must be string, number, boolean, date, datetime, or unknown.`),s}function te(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[],r=new Set(["kind","domainId","datasetName","datasetId","label","sourceKey"]);return Object.keys(t).forEach(n=>{r.has(n)||s.push(`${o}.${n} is not supported; relationship candidate sources support only semantic identity fields.`)}),t.kind!=="semantic"&&s.push(`${o} must use semantic source identity.`),(typeof t.domainId!="string"||!t.domainId.trim()||typeof t.datasetName!="string"||!t.datasetName.trim())&&s.push(`${o} must include semantic domainId and datasetName.`),s}function v(i){return je.has(i)}function ae(i){return Ce.has(i)}function h(i,o){return i===void 0?[]:p(i,o)}function p(i,o){const t=a(i);if(!t)return[`${o} must be an object.`];const s=[];return(typeof t.name!="string"||!t.name.trim())&&s.push(`${o}.name is required.`),!t.source&&typeof t.sourceKey!="string"&&s.push(`${o} must include source or sourceKey.`),s}function le(i,o){const t=a(i),s=p(i,o);if(!t||typeof t.sourceKey=="string"&&t.sourceKey.trim())return s;if(t.source!==void 0){const n=$(t.source,`${o}.source`);return n.length===0||s.push(...n),s}return s.includes(`${o} must include source or sourceKey.`)||s.push(`${o} must include source or sourceKey.`),s}function a(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:void 0}function g(i){return Array.isArray(i)&&i.every(o=>typeof o=="string")}const m=e.z.record(e.z.string(),e.z.unknown()),x=e.z.array(m),c=e.z.enum(["SUM","COUNT","AVG","MIN","MAX","MEDIAN","DISTINCT"]),E=e.z.enum(["postgres","mysql","mssql","snowflake","clickhouse","bigquery","redshift","duckdb","sqlite","unknown"]),ue=e.z.enum(["hour","day","week","month","quarter","year"]),F=e.z.enum(["dimension","measure","date","id","unknown"]),N=e.z.enum(["string","number","boolean","date","datetime","unknown"]),ce=e.z.enum(["semantic_model","caller_override","default_sum"]),R=e.z.union([e.z.number(),e.z.string(),e.z.null()]),P=e.z.enum(["millisecond","second","minute","hour","day"]),de=e.z.union([e.z.object({type:e.z.enum(["number","currency","percent","percentage","scientific"]),locale:e.z.string().optional(),minimumFractionDigits:e.z.number().optional(),maximumFractionDigits:e.z.number().optional(),useGrouping:e.z.boolean().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional(),negativeStyle:e.z.enum(["minus","parentheses"]).optional(),compact:e.z.boolean().optional(),scale:e.z.number().optional(),currency:e.z.string().optional(),percentValueMode:e.z.enum(["fraction","whole"]).optional()}).passthrough(),e.z.object({type:e.z.enum(["date","datetime"]),locale:e.z.string().optional(),pattern:e.z.string().optional(),relative:e.z.boolean().optional(),timezone:e.z.string().optional(),sourceTimezone:e.z.string().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional()}).passthrough(),e.z.object({type:e.z.literal("duration"),inputUnit:P.optional(),outputStyle:e.z.enum(["compact","digital","long"]).optional(),largestUnit:P.optional(),smallestUnit:P.optional(),maxUnits:e.z.number().optional(),prefix:e.z.string().optional(),suffix:e.z.string().optional(),negativeStyle:e.z.enum(["minus","parentheses"]).optional()}).passthrough(),e.z.object({type:e.z.literal("string"),prefix:e.z.string().optional(),suffix:e.z.string().optional()}).passthrough()]),bt=e.z.union([e.z.object({kind:e.z.literal("defaultAggregate")}).passthrough(),e.z.object({kind:e.z.literal("blank")}).passthrough(),e.z.object({kind:e.z.literal("labelOnly"),label:e.z.string().optional()}).passthrough(),e.z.object({kind:e.z.literal("customAggregate"),aggregate:c}).passthrough(),e.z.object({kind:e.z.literal("percentOfParent")}).passthrough(),e.z.object({kind:e.z.literal("percentOfGrandTotal")}).passthrough(),e.z.object({kind:e.z.literal("customExpression"),expressionId:e.z.string()}).passthrough()]);function w(i,o){return e.z.object(i).passthrough().superRefine((t,s)=>{for(const r of o)Object.prototype.hasOwnProperty.call(t,r)||s.addIssue({code:"custom",path:[r],message:`Required field "${r}" is missing.`})})}const L=e.z.object({kind:e.z.literal("semantic"),domainId:e.z.string(),datasetName:e.z.string(),datasetId:e.z.string().optional(),label:e.z.string().optional(),connectionId:e.z.string().optional()}).passthrough(),pe=e.z.object({kind:e.z.literal("physical"),connectionId:e.z.string(),connectionType:e.z.string().optional(),tableName:e.z.string(),databaseName:e.z.string().optional(),schemaName:e.z.string().optional(),label:e.z.string().optional(),dialect:E.optional()}).passthrough(),me=e.z.object({kind:e.z.literal("sql"),connectionId:e.z.string(),dialect:E.optional(),label:e.z.string().optional()}).passthrough(),b=e.z.union([L,pe,me]),z=e.z.object({name:e.z.string(),label:e.z.string().optional(),role:F.optional(),dataType:N.optional(),source:b.optional(),aggregate:c.optional()}).passthrough(),yt=e.z.object({kind:e.z.literal("field"),field:z,aggregate:c.optional()}).passthrough(),U=e.z.object({kind:e.z.literal("derived_field"),name:e.z.string(),label:e.z.string(),description:e.z.string().optional(),resultRole:F,dataType:N,computeStage:e.z.enum(["row","aggregate"]),expression:e.z.string(),expressionLanguage:e.z.literal("semaphor_sql_template").optional(),inputs:e.z.record(yt),defaultAggregate:c.optional(),aggregationBehavior:e.z.enum(["additive","non_additive","ratio_of_sums","weighted","pre_aggregated","snapshot"]).optional(),aggregationStrategy:e.z.enum(["default","symmetric_aggregate","aggregate_then_join","weighted"]).optional(),format:de.optional(),tags:e.z.array(e.z.string()).optional()}).passthrough(),D=z.and(e.z.object({semanticAggregate:c.optional(),effectiveAggregate:c.optional(),aggregateSource:ce.optional(),derivedField:U.optional()}).passthrough()),St=L,vt=e.z.object({kind:e.z.literal("physical"),connectionId:e.z.string().optional(),connectionType:e.z.string().optional(),tableName:e.z.string(),databaseName:e.z.string().optional(),schemaName:e.z.string().optional(),label:e.z.string().optional(),dialect:E.optional()}).passthrough(),$t=e.z.object({kind:e.z.literal("sql"),connectionId:e.z.string().optional(),dialect:E.optional(),label:e.z.string().optional()}).passthrough(),wt=e.z.union([St,vt,$t]),kt=e.z.object({key:e.z.string().optional(),name:e.z.string(),label:e.z.string().optional(),role:F.optional(),dataType:N.optional(),source:wt.optional(),aggregate:c.optional(),semanticAggregate:c.optional(),effectiveAggregate:c.optional(),aggregateSource:ce.optional(),derivedField:e.z.never().optional()}).passthrough(),j=e.z.object({key:e.z.string(),name:e.z.string(),label:e.z.string(),role:F.optional(),dataType:N.optional(),aggregate:c.optional(),source:b.optional(),derivedField:U.optional()}).passthrough(),ge=e.z.object({code:e.z.string(),message:e.z.string().optional(),invalidField:e.z.string().optional(),fieldRole:e.z.enum(["measure","date","dimension","input","source","sql"]).optional(),validMeasureCandidates:e.z.array(e.z.string()).optional(),validDateCandidates:e.z.array(e.z.string()).optional(),validDimensionCandidates:e.z.array(e.z.string()).optional(),recommendedNextStep:e.z.string()}).passthrough(),C=e.z.object({code:e.z.string(),message:e.z.string(),path:e.z.string().optional(),fieldRole:e.z.enum(["measure","date","dimension","input","source","sql"]).optional(),repairHint:ge.optional()}).passthrough(),G=e.z.object({ok:e.z.boolean(),errors:e.z.array(C),warnings:e.z.array(C),repairHints:e.z.array(ge)}).passthrough(),At=e.z.object({page:e.z.number(),pageSize:e.z.number(),pageCount:e.z.number(),totalCount:e.z.number(),hasNextPage:e.z.boolean(),hasPrevPage:e.z.boolean()}).passthrough(),k={intentId:e.z.string().optional(),queryPath:e.z.enum(["query_spec","sql","sql_python"]),warnings:e.z.array(e.z.string()).optional(),rowCount:e.z.number().optional(),rowLimitExceeded:e.z.boolean().optional(),limit:e.z.number().optional(),pagination:At.optional()},he=e.z.object({...k,kind:e.z.literal("metric"),value:R,measures:e.z.record(R).optional(),comparison:e.z.object({kind:e.z.enum(["previous_period","previous_year","target"]),value:R.optional(),delta:e.z.union([e.z.number(),e.z.null()]).optional(),deltaPercent:e.z.union([e.z.number(),e.z.null()]).optional()}).passthrough().optional(),records:x.optional()}).passthrough(),fe=e.z.object({...k,kind:e.z.literal("records"),columns:e.z.array(j),records:x,totals:e.z.object({mode:e.z.literal("server"),scope:e.z.literal("filtered_result"),row:e.z.record(e.z.string(),e.z.unknown()),columns:e.z.array(j).optional()}).passthrough().optional()}).passthrough(),ze=e.z.object({...k,kind:e.z.literal("inputOptions"),options:e.z.array(w({label:e.z.string(),value:e.z.unknown(),count:e.z.number().optional(),disambiguation:e.z.array(e.z.string()).optional()},["value"]))}).passthrough(),be=e.z.object({...k,kind:e.z.literal("sql"),columns:e.z.array(j),records:x,sqlShape:e.z.object({statementType:e.z.string().optional(),explicitLimit:e.z.number().optional(),hasPythonCode:e.z.boolean().optional()}).passthrough().optional()}).passthrough(),It=e.z.object({enabled:e.z.boolean().optional(),position:e.z.enum(["before","after"]).optional(),label:e.z.string().optional()}).passthrough(),oe=e.z.object({id:e.z.enum(["rows","columns"]),levels:e.z.array(e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),label:e.z.string(),field:z,grain:ue.optional(),subtotal:It.optional()}).passthrough()),nodeIds:e.z.array(e.z.string())}).passthrough(),y=w({instanceId:e.z.string(),fieldKey:e.z.string(),value:e.z.unknown(),label:e.z.string()},["value"]),Rt=e.z.union([e.z.object({kind:e.z.literal("label")}).passthrough(),e.z.object({kind:e.z.literal("field"),field:z,aggregate:c.optional()}).passthrough(),e.z.object({kind:e.z.literal("value"),valueId:e.z.string(),rowPath:e.z.array(y).optional(),columnPath:e.z.array(y).optional()}).passthrough()]),_t=e.z.enum(["present","presentNull","missing","densified"]),jt=e.z.enum(["value","rowSubtotal","columnSubtotal","subtotalIntersection","rowGrandTotal","columnGrandTotal","matrixGrandTotal"]),Ct=e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),field:z,role:e.z.enum(["row","column","measure","sort","filter"]),label:e.z.string().optional()}).passthrough(),qt=e.z.union([e.z.object({kind:e.z.literal("additive"),aggregate:c.optional()}).passthrough(),e.z.object({kind:e.z.literal("semiAdditive"),aggregate:c.optional(),grain:ue.optional()}).passthrough(),e.z.object({kind:e.z.literal("nonAdditive"),aggregate:c.optional()}).passthrough(),e.z.object({kind:e.z.literal("ratio"),numeratorMeasureInstanceId:e.z.string().optional(),denominatorMeasureInstanceId:e.z.string().optional()}).passthrough(),e.z.object({kind:e.z.literal("custom"),expressionId:e.z.string().optional()}).passthrough()]),xt=e.z.object({instanceId:e.z.string(),fieldKey:e.z.string(),label:e.z.string(),field:z,aggregate:c.optional(),format:de.optional(),totalBehavior:bt.optional(),semantics:qt}).passthrough(),Et=e.z.object({id:e.z.string(),measureId:e.z.string(),aggregate:c.optional(),label:e.z.string().optional(),source:e.z.enum(["measureDefault","rowSubtotal","columnSubtotal","subtotalIntersection","rowGrandTotal","columnGrandTotal","matrixGrandTotal","custom"]),scope:e.z.object({rowLevelId:e.z.string().optional(),columnLevelId:e.z.string().optional(),rowNodeId:e.z.string().optional(),columnNodeId:e.z.string().optional()}).passthrough().optional()}).passthrough(),Ft=e.z.object({kind:e.z.string(),label:e.z.string().optional(),payload:e.z.record(e.z.string(),e.z.unknown()).optional()}).passthrough(),Nt=w({id:e.z.string(),axis:e.z.enum(["row","column"]),path:e.z.array(y),level:e.z.number(),label:e.z.string(),value:e.z.unknown(),parentId:e.z.string().optional(),hasChildren:e.z.boolean(),isExpanded:e.z.boolean().optional(),isSubtotal:e.z.boolean().optional(),isGrandTotal:e.z.boolean().optional(),subtotalFunction:c.optional(),childCount:e.z.number().optional(),actions:e.z.array(Ft).optional()},["value"]),Dt=e.z.object({rowHeaderLevels:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),fieldInstanceId:e.z.string()}).passthrough()),columnHeaderRows:e.z.array(e.z.object({id:e.z.string(),cells:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),role:e.z.enum(["rowHeader","columnHeader","measureHeader","subtotal","grandTotal"]),colSpan:e.z.number(),rowSpan:e.z.number(),columnPath:e.z.array(y),measureInstanceId:e.z.string().optional()}).passthrough())}).passthrough()),columns:e.z.array(e.z.object({id:e.z.string(),label:e.z.string(),columnNodeId:e.z.string().optional(),columnPath:e.z.array(y),measureInstanceId:e.z.string(),role:e.z.enum(["value","columnSubtotal","columnGrandTotal"])}).passthrough())}).passthrough(),Tt=w({rowId:e.z.string(),columnId:e.z.string().optional(),measureId:e.z.string(),value:e.z.unknown(),formattedValue:e.z.string().optional(),presence:_t,role:jt,calculationId:e.z.string().optional()},["value"]),Ot=e.z.object({rows:e.z.boolean().optional(),columns:e.z.boolean().optional(),grandTotal:e.z.union([e.z.boolean(),e.z.object({rows:e.z.boolean().optional(),columns:e.z.boolean().optional()}).passthrough()]).optional()}).passthrough(),Mt=w({id:e.z.string(),axis:e.z.enum(["row","column"]),targetInstanceId:e.z.string().optional(),direction:e.z.enum(["asc","desc"]),nulls:e.z.enum(["warehouseDefault","first","last"]).optional(),scope:e.z.enum(["global","withinParent"]).optional(),by:Rt},["by"]),Kt=e.z.object({rowOffset:e.z.number().optional(),rowLimit:e.z.number().optional(),columnOffset:e.z.number().optional(),columnLimit:e.z.number().optional(),hasMoreRows:e.z.boolean().optional(),hasMoreColumns:e.z.boolean().optional()}).passthrough(),Pt=e.z.object({axis:e.z.enum(["row","column"]),path:e.z.array(y),depth:e.z.number().optional()}).passthrough(),Bt=e.z.object({rowLazyLoading:e.z.boolean().optional(),columnLazyLoading:e.z.boolean().optional(),expandableRowNodeIds:e.z.array(e.z.string()).optional(),expandableColumnNodeIds:e.z.array(e.z.string()).optional(),nextRequests:e.z.array(Pt).optional()}).passthrough(),Vt=e.z.object({domains:e.z.record(e.z.object({min:e.z.number().optional(),max:e.z.number().optional()}).passthrough()).optional(),rules:e.z.array(e.z.record(e.z.string(),e.z.unknown())).optional()}).passthrough(),ye=e.z.object({...k,kind:e.z.literal("matrix"),schemaVersion:e.z.literal(1),shape:e.z.enum(["hierarchical","pivot"]),capabilities:e.z.array(e.z.string()),executionMetadata:e.z.record(e.z.string(),e.z.unknown()),fieldsById:e.z.record(e.z.string(),Ct),measuresById:e.z.record(e.z.string(),xt),calculationsById:e.z.record(e.z.string(),Et).optional(),axes:e.z.object({rows:oe,columns:oe}).passthrough(),nodesById:e.z.record(e.z.string(),Nt),layout:Dt,cells:e.z.array(Tt),totals:Ot,sort:e.z.array(Mt),formattingContext:Vt,pageInfo:Kt.optional(),expansion:Bt.optional()}).passthrough(),Se=e.z.union([he,fe,ze,be,ye]),ve=e.z.object({status:e.z.enum(["not_required","resolved","missing","ambiguous","fanout_risk","unknown"]),requiredSources:e.z.array(b).optional(),relationshipsUsed:e.z.array(e.z.string()).optional(),missingSources:e.z.array(e.z.string()).optional(),warnings:e.z.array(e.z.string()).optional(),message:e.z.string().optional(),recommendedNextStep:e.z.string().optional(),joinPlanSummary:e.z.object({baseSource:b.optional(),joinedSources:e.z.array(b).optional(),joinCount:e.z.number().optional()}).passthrough().optional(),fanoutRisk:e.z.object({status:e.z.enum(["none","warning","error","unknown"]),message:e.z.string().optional()}).passthrough().optional()}).passthrough(),se=e.z.enum(["ambiguous_fields","empty_result","missing_grounded_fields","missing_relationship","no_grounded_query","partial_result","presentation_incomplete","query_validation_failed","unsafe_join"]),H=e.z.object({version:e.z.literal(1),status:e.z.enum(["answered","partial","blocked"]),summary:e.z.string(),answered:e.z.array(e.z.object({slotId:e.z.string().optional(),queryId:e.z.string().optional(),summary:e.z.string(),evidenceIds:e.z.array(e.z.string()).optional(),fieldsUsed:e.z.array(D).optional()}).passthrough()),blocked:e.z.array(e.z.object({slotId:e.z.string().optional(),queryId:e.z.string().optional(),reasonCode:se,message:e.z.string(),missingFields:e.z.array(e.z.string()).optional(),availableFields:e.z.array(e.z.string()).optional(),ambiguousFields:e.z.array(e.z.string()).optional(),missingRelationships:e.z.array(e.z.string()).optional(),evidenceIds:e.z.array(e.z.string()).optional(),neededFromUser:e.z.array(e.z.string()).optional(),recommendedNextStep:e.z.string().optional()}).passthrough()),semanticModelRecommendations:e.z.array(e.z.object({reasonCode:se,message:e.z.string(),recommendedNextStep:e.z.string().optional()}).passthrough()).optional()}).passthrough(),Q=e.z.object({scope:e.z.literal("filtered_query"),measures:e.z.record(R)}).passthrough(),Y=e.z.object({answeredObligations:e.z.array(e.z.string()),missingObligations:e.z.array(e.z.string()),warnings:e.z.array(C).optional()}).passthrough(),$e=e.z.object({intentId:e.z.string().optional(),queryId:e.z.string().optional(),status:e.z.enum(["answered","partial","failed"]),resultShape:e.z.enum(["metric","records","inputOptions","sql","matrix","period_change","analysis"]).optional(),intent:e.z.unknown().optional(),compiledQuery:e.z.unknown().optional(),fieldsUsed:e.z.array(D).optional(),result:Se.optional(),validation:G,coverage:Y.optional(),missingFields:e.z.array(e.z.string()).optional(),warnings:e.z.array(e.z.string()).optional(),relationshipDiagnostics:ve.optional(),diagnosticFeedback:H.optional(),population:Q.optional(),metadata:e.z.record(e.z.string(),e.z.unknown()).optional()}).passthrough();function Lt(i){switch(i){case"boolean":return e.z.boolean().optional();case"compactExecutionFieldArray":return e.z.array(kt).optional();case"coverage":return Y.optional();case"diagnosticFeedback":return H.optional();case"executionFieldArray":return e.z.array(D).optional();case"executionResult":return $e.optional();case"number":return e.z.number().finite().optional();case"population":return Q.optional();case"record":return m.optional();case"recordArray":return x.optional();case"responseDetail":return e.z.enum(["compact","standard","debug"]).optional();case"string":return e.z.string().optional();case"stringArray":return e.z.array(e.z.string()).optional();case"unknown":return e.z.unknown().optional();case"unknownArray":return e.z.array(e.z.unknown()).optional();case"validationResult":return G.optional()}}const we=Object.fromEntries(Object.entries(q).map(([i,o])=>[i,Lt(o)])),ke=e.z.object(we).strict(),W=e.z.object({sourceKey:e.z.string().optional(),kind:e.z.enum(["semantic","physical","sql"]).optional(),domainId:e.z.string().optional(),datasetName:e.z.string().optional(),datasetId:e.z.string().optional(),connectionId:e.z.string().optional(),tableName:e.z.string().optional(),label:e.z.string().optional()}).passthrough(),f=e.z.object({name:e.z.string(),label:e.z.string().optional(),role:e.z.enum(["dimension","measure","date","id","unknown"]).optional(),dataType:e.z.enum(["string","number","boolean","date","datetime","unknown"]).optional(),aggregate:c.optional(),sourceKey:e.z.string().optional(),source:W.optional()}).passthrough(),Ae=e.z.object({id:e.z.string().optional(),builder:e.z.literal("semaphor.inputOptions"),source:W.optional(),sourceKey:e.z.string().optional(),valueFieldRef:f,labelFieldRef:f,filterFieldRef:f.optional(),population:e.z.unknown().optional(),dependencies:e.z.unknown().optional(),limit:e.z.number().int().positive().optional(),spec:m.optional()}).passthrough(),Ie=e.z.object({appliesToViewIds:e.z.array(e.z.string()).optional(),viewId:e.z.string().optional(),fieldRef:f,relationshipHint:e.z.unknown().optional(),relationshipsUsed:e.z.array(m).optional()}).passthrough(),Ut=e.z.object({id:e.z.string(),label:e.z.string().optional(),type:e.z.string().optional(),serverSide:e.z.boolean().optional(),fieldRef:f.optional(),optionQuery:Ae.optional(),bindings:e.z.array(Ie).optional(),appliesToViewIds:e.z.array(e.z.string()),relationshipHint:e.z.unknown().optional(),relationshipsUsed:e.z.array(m).optional()}).passthrough(),Gt=e.z.object({builder:e.z.enum(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]),spec:m,fallbackReason:m.optional()}).passthrough(),Ht=e.z.object({id:e.z.string(),title:e.z.string().optional(),purpose:e.z.string().optional(),sourcePresentation:e.z.object({sourceKeys:e.z.array(e.z.string()).optional(),sourceLabels:e.z.array(e.z.string()).optional()}).passthrough().optional(),visual:e.z.string().optional(),visualSpec:m.optional(),queryKind:e.z.enum(["metric","records","matrix","analysis","sql_fallback"]).optional(),sdkBuilder:e.z.enum(["semaphor.metric","semaphor.records","semaphor.matrix","semaphor.analysis","semaphor.sql"]).optional(),sdkSpec:Gt.optional(),fields:e.z.array(f).optional(),computation:m.optional(),uxExpectations:e.z.array(e.z.string()).optional(),validation:m.optional()}).passthrough(),Qt=e.z.object({inputId:e.z.string(),label:e.z.string().optional(),type:e.z.string().optional(),serverSide:e.z.boolean().optional(),fieldRef:f.optional(),optionQuery:Ae.optional(),bindings:e.z.array(Ie),appliesToViewIds:e.z.array(e.z.string()),notAppliedToViewIds:e.z.array(e.z.string())}).passthrough(),Yt=e.z.object({schemaVersion:e.z.literal(_),title:e.z.string(),purpose:e.z.string().optional(),userGoal:e.z.string().optional(),nextStep:e.z.string().optional(),sources:e.z.array(W),inputs:e.z.array(Ut),views:e.z.array(Ht),filterContracts:e.z.array(Qt),implementationChecklist:e.z.object({schemaVersion:e.z.string().optional(),requiredDevtools:e.z.object({mountRootDevtools:e.z.boolean(),providerDebugBridge:e.z.string().optional(),panelPosition:e.z.string().optional(),forbidden:e.z.array(e.z.string()).optional()}).passthrough(),requiredInputOptions:e.z.array(m),filterScopeByInput:e.z.array(m),bindingsByView:e.z.record(e.z.string(),e.z.array(m)),validationCommands:e.z.array(e.z.string()),browserSmokeChecks:e.z.array(e.z.string())}).passthrough(),nextRequiredTool:e.z.object({name:e.z.string(),reason:e.z.string().optional()}).optional(),unsupportedInsights:e.z.array(e.z.object({title:e.z.string(),requestedQuestion:e.z.string(),reason:e.z.string(),suggestedModelingFix:e.z.string()}).passthrough()).optional(),assumptions:e.z.array(e.z.string()).optional(),validation:m.optional()}).passthrough().superRefine((i,o)=>{const t=B(i);for(const s of t.issues)o.addIssue({code:e.z.ZodIssueCode.custom,message:s})}),Wt=new Set(Object.keys(q));function Zt(){return Object.keys(q)}function Re(i){return Wt.has(i)}function Xt(i){if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Semaphor analyze result must be an object.");const t=Object.keys(i).filter(s=>!Re(s));if(t.length)throw new Error(`Semaphor analyze result contains unsupported top-level field(s): ${t.join(", ")}.`);return ke.parse(i)}exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=q;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION=_;exports.SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION=_e;exports.getSemaphorAnalyzeResultFieldNames=Zt;exports.isSemaphorAnalyzeResultFieldName=Re;exports.isSemaphorDataAppCodegenSummary=Oe;exports.parseSemaphorAnalyzeResult=Xt;exports.semaphorAnalyticsCoverageSchema=Y;exports.semaphorAnalyticsDiagnosticFeedbackSchema=H;exports.semaphorAnalyticsExecutionResultSchema=$e;exports.semaphorAnalyticsPopulationSchema=Q;exports.semaphorAnalyticsResultSchema=Se;exports.semaphorAnalyticsValidationIssueSchema=C;exports.semaphorAnalyticsValidationResultSchema=G;exports.semaphorAnalyzeResultSchema=ke;exports.semaphorAnalyzeResultShape=we;exports.semaphorDataAppCodegenSummarySchema=Yt;exports.semaphorDerivedFieldDefinitionSchema=U;exports.semaphorExecutionFieldRefSchema=D;exports.semaphorFieldRefSchema=z;exports.semaphorInputOptionsResultSchema=ze;exports.semaphorMatrixResultSchema=ye;exports.semaphorMetricResultSchema=he;exports.semaphorPhysicalSourceRefSchema=pe;exports.semaphorRecordsResultSchema=fe;exports.semaphorRelationshipDiagnosticsSchema=ve;exports.semaphorResultColumnSchema=j;exports.semaphorSemanticSourceRefSchema=L;exports.semaphorSourceRefSchema=b;exports.semaphorSqlResultSchema=be;exports.semaphorSqlSourceRefSchema=me;exports.validateSemaphorDataAppCodegenSummary=B;