react-semaphor 0.1.335 → 0.1.336
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +67 -45
- package/dist/chunks/{validators-BuaRUBQI.js → validators-BOqiGymD.js} +247 -148
- package/dist/chunks/validators-BtFXY3S_.js +2 -0
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +567 -545
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +89 -80
- package/dist/types/analytics-protocol.d.ts +94 -6
- package/dist/types/dashboard-authoring.d.ts +20 -5
- package/dist/types/data-app-builder.d.ts +17 -4
- package/dist/types/data-app-sdk.d.ts +19 -6
- package/dist/types/main.d.ts +21 -4
- package/package.json +1 -1
- package/dist/chunks/validators-x74uYpnG.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/validators-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/validators-BtFXY3S_.js"),t=require("../chunks/catalog-field-grounding-VgVzDd25.js");function d(e,a={}){const i=o(e),r={connectionId:a.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...r,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...r,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...r,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...r,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...r,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...r,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...r,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:r}function c(e){const a=o(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";case"semantic":return"semantic";default:return"unknown"}}function u(e){return e.capabilities.prefixLevels.every(a=>!!l(e.source,a))}function m(e){const a=e.quoteIdentifier??p;return e.capabilities.prefixLevels.map(i=>l(e.source,i)).filter(i=>!!i).map(i=>a(i,e.capabilities.dialect)).join(".")}function l(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function p(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function o(e){if(typeof e!="string")return"";const a=[];for(const i of e.trim().toLowerCase())b(i)&&a.push(i);return a.join("")}function b(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const s={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},f={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:s,metrics:["revenue"],primaryMetric:"revenue",comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:s,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"}],measures:["revenue"],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:s,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],measures:["revenue"],orderBy:{field:"revenue",direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",source:s,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:s,metrics:["revenue"],primaryMetric:"revenue",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:s,metrics:["net_tons","ticket_value"],primaryMetric:"net_tons",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:"=",value:"Inbound"}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"physical",connectionId:"conn_sales",databaseName:"warehouse",schemaName:"public",tableName:"orders",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.validateSemaphorAnalyticsIntent=n.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=n.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=n.validateSemaphorDashboardIntent;exports.validateSemaphorOperationIntent=n.validateSemaphorOperationIntent;exports.buildAnalyticsCatalogFieldSummary=t.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=t.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=t.getAnalyticsCatalogFieldName;exports.inferAnalyticsMetricFormat=t.inferAnalyticsMetricFormat;exports.isAnalyticsCatalogDateField=t.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=t.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=t.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=t.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=t.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=t.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=t.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=t.normalizeAnalyticsCatalogName;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=f;exports.buildSemaphorQualifiedSourcePath=m;exports.getSemaphorConnectionCapabilities=d;exports.normalizeSemaphorDialect=c;exports.semaphorSourceHasRequiredCoordinates=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v
|
|
2
|
-
import { k as C, a as I, g as
|
|
1
|
+
import { v, b as g, c as h, a as y } from "../chunks/validators-BOqiGymD.js";
|
|
2
|
+
import { k as C, a as I, g as T, j as q, c as S, h as F, f as A, i as _, e as L, d as R, b as N, n as D } from "../chunks/catalog-field-grounding-DmT7aGUA.js";
|
|
3
3
|
function d(e, a = {}) {
|
|
4
|
-
const
|
|
4
|
+
const i = n(e), t = {
|
|
5
5
|
connectionId: a.connectionId,
|
|
6
6
|
connectionType: e,
|
|
7
7
|
path: ["database", "schema", "table"],
|
|
@@ -14,27 +14,27 @@ function d(e, a = {}) {
|
|
|
14
14
|
dialect: "postgres",
|
|
15
15
|
supportsFilterClause: !0
|
|
16
16
|
};
|
|
17
|
-
return
|
|
18
|
-
...
|
|
17
|
+
return i.includes("postgres") ? {
|
|
18
|
+
...t,
|
|
19
19
|
prefixLevels: ["schema", "table"],
|
|
20
20
|
dialect: "postgres"
|
|
21
|
-
} :
|
|
22
|
-
...
|
|
21
|
+
} : i.includes("mysql") ? {
|
|
22
|
+
...t,
|
|
23
23
|
prefixLevels: ["database", "table"],
|
|
24
24
|
dialect: "mysql",
|
|
25
25
|
supportsFilterClause: !1
|
|
26
|
-
} :
|
|
27
|
-
...
|
|
26
|
+
} : i.includes("mssql") || i.includes("sqlserver") ? {
|
|
27
|
+
...t,
|
|
28
28
|
dialect: "mssql",
|
|
29
29
|
supportsFilterClause: !1
|
|
30
|
-
} :
|
|
31
|
-
...
|
|
30
|
+
} : i.includes("redshift") ? {
|
|
31
|
+
...t,
|
|
32
32
|
prefixLevels: ["schema", "table"],
|
|
33
33
|
dialect: "redshift"
|
|
34
|
-
} :
|
|
35
|
-
...
|
|
34
|
+
} : i.includes("snowflake") ? {
|
|
35
|
+
...t,
|
|
36
36
|
dialect: "snowflake"
|
|
37
|
-
} :
|
|
37
|
+
} : i.includes("clickhouse") ? {
|
|
38
38
|
connectionId: a.connectionId,
|
|
39
39
|
connectionType: e,
|
|
40
40
|
path: ["database", "table"],
|
|
@@ -45,17 +45,17 @@ function d(e, a = {}) {
|
|
|
45
45
|
prefixLevels: ["database", "table"],
|
|
46
46
|
dialect: "clickhouse",
|
|
47
47
|
supportsFilterClause: !1
|
|
48
|
-
} :
|
|
48
|
+
} : i === "s3" || i === "api" ? {
|
|
49
49
|
connectionId: a.connectionId,
|
|
50
50
|
connectionType: e,
|
|
51
51
|
path: ["table"],
|
|
52
52
|
labels: {
|
|
53
|
-
table:
|
|
53
|
+
table: i === "api" ? "API Table" : "File Table"
|
|
54
54
|
},
|
|
55
55
|
prefixLevels: ["table"],
|
|
56
56
|
dialect: "duckdb",
|
|
57
57
|
supportsFilterClause: !0
|
|
58
|
-
} :
|
|
58
|
+
} : i === "googlesheets" || i === "fileupload" ? {
|
|
59
59
|
connectionId: a.connectionId,
|
|
60
60
|
connectionType: e,
|
|
61
61
|
path: ["table"],
|
|
@@ -65,16 +65,16 @@ function d(e, a = {}) {
|
|
|
65
65
|
prefixLevels: ["table"],
|
|
66
66
|
dialect: "postgres",
|
|
67
67
|
supportsFilterClause: !0
|
|
68
|
-
} :
|
|
69
|
-
...
|
|
68
|
+
} : i === "s3tables" ? {
|
|
69
|
+
...t,
|
|
70
70
|
labels: {
|
|
71
71
|
database: "Database",
|
|
72
72
|
schema: "Namespace",
|
|
73
73
|
table: "Table"
|
|
74
74
|
},
|
|
75
75
|
dialect: "duckdb"
|
|
76
|
-
} :
|
|
77
|
-
...
|
|
76
|
+
} : i === "bigquery" ? {
|
|
77
|
+
...t,
|
|
78
78
|
labels: {
|
|
79
79
|
database: "Project",
|
|
80
80
|
schema: "Dataset",
|
|
@@ -83,7 +83,7 @@ function d(e, a = {}) {
|
|
|
83
83
|
prefixLevels: ["schema", "table"],
|
|
84
84
|
dialect: "bigquery",
|
|
85
85
|
supportsFilterClause: !1
|
|
86
|
-
} :
|
|
86
|
+
} : t;
|
|
87
87
|
}
|
|
88
88
|
function c(e) {
|
|
89
89
|
const a = n(e);
|
|
@@ -110,14 +110,14 @@ function c(e) {
|
|
|
110
110
|
}
|
|
111
111
|
function u(e) {
|
|
112
112
|
return e.capabilities.prefixLevels.every(
|
|
113
|
-
(a) => !!
|
|
113
|
+
(a) => !!s(e.source, a)
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
function m(e) {
|
|
117
117
|
const a = e.quoteIdentifier ?? l;
|
|
118
|
-
return e.capabilities.prefixLevels.map((
|
|
118
|
+
return e.capabilities.prefixLevels.map((i) => s(e.source, i)).filter((i) => !!i).map((i) => a(i, e.capabilities.dialect)).join(".");
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function s(e, a) {
|
|
121
121
|
return a === "database" ? e.databaseName : a === "schema" ? e.schemaName : e.tableName;
|
|
122
122
|
}
|
|
123
123
|
function l(e, a) {
|
|
@@ -127,15 +127,15 @@ function n(e) {
|
|
|
127
127
|
if (typeof e != "string")
|
|
128
128
|
return "";
|
|
129
129
|
const a = [];
|
|
130
|
-
for (const
|
|
131
|
-
o(
|
|
130
|
+
for (const i of e.trim().toLowerCase())
|
|
131
|
+
o(i) && a.push(i);
|
|
132
132
|
return a.join("");
|
|
133
133
|
}
|
|
134
134
|
function o(e) {
|
|
135
135
|
const a = e.charCodeAt(0);
|
|
136
136
|
return a >= 48 && a <= 57 || a >= 97 && a <= 122;
|
|
137
137
|
}
|
|
138
|
-
const
|
|
138
|
+
const r = {
|
|
139
139
|
kind: "semantic",
|
|
140
140
|
domainId: "domain_sales",
|
|
141
141
|
datasetName: "orders",
|
|
@@ -147,8 +147,9 @@ const t = {
|
|
|
147
147
|
kind: "metric",
|
|
148
148
|
id: "revenue-kpi",
|
|
149
149
|
label: "Revenue",
|
|
150
|
-
source:
|
|
151
|
-
|
|
150
|
+
source: r,
|
|
151
|
+
metrics: ["revenue"],
|
|
152
|
+
primaryMetric: "revenue",
|
|
152
153
|
comparison: { kind: "previous_period" },
|
|
153
154
|
limit: 1
|
|
154
155
|
},
|
|
@@ -157,7 +158,7 @@ const t = {
|
|
|
157
158
|
kind: "records",
|
|
158
159
|
id: "revenue-trend",
|
|
159
160
|
label: "Revenue trend",
|
|
160
|
-
source:
|
|
161
|
+
source: r,
|
|
161
162
|
fields: [
|
|
162
163
|
{ name: "order_date", role: "date", dataType: "date", label: "Order Date" }
|
|
163
164
|
],
|
|
@@ -171,7 +172,7 @@ const t = {
|
|
|
171
172
|
kind: "records",
|
|
172
173
|
id: "top-customers",
|
|
173
174
|
label: "Top customers",
|
|
174
|
-
source:
|
|
175
|
+
source: r,
|
|
175
176
|
fields: [
|
|
176
177
|
{ name: "customer_name", role: "dimension", dataType: "string" },
|
|
177
178
|
{ name: "segment", role: "dimension", dataType: "string" },
|
|
@@ -186,7 +187,7 @@ const t = {
|
|
|
186
187
|
kind: "inputOptions",
|
|
187
188
|
id: "region-options",
|
|
188
189
|
label: "Region options",
|
|
189
|
-
source:
|
|
190
|
+
source: r,
|
|
190
191
|
field: { name: "region", role: "dimension", dataType: "string" },
|
|
191
192
|
limit: 100
|
|
192
193
|
},
|
|
@@ -195,13 +196,34 @@ const t = {
|
|
|
195
196
|
kind: "metric",
|
|
196
197
|
id: "revenue-previous-period",
|
|
197
198
|
label: "Revenue previous period comparison",
|
|
198
|
-
source:
|
|
199
|
-
|
|
199
|
+
source: r,
|
|
200
|
+
metrics: ["revenue"],
|
|
201
|
+
primaryMetric: "revenue",
|
|
200
202
|
dateField: { name: "order_date", role: "date", dataType: "date" },
|
|
201
203
|
timeGrain: "week",
|
|
202
204
|
comparison: { kind: "previous_period" },
|
|
203
205
|
limit: 100
|
|
204
206
|
},
|
|
207
|
+
inboundSupplierConcentration: {
|
|
208
|
+
version: 1,
|
|
209
|
+
kind: "metric",
|
|
210
|
+
id: "inbound-supplier-concentration",
|
|
211
|
+
label: "Inbound supplier concentration",
|
|
212
|
+
source: r,
|
|
213
|
+
metrics: ["net_tons", "ticket_value"],
|
|
214
|
+
primaryMetric: "net_tons",
|
|
215
|
+
dateField: { name: "ticket_date", role: "date", dataType: "date" },
|
|
216
|
+
timeWindow: { unit: "month", value: 6, anchor: "latest_available" },
|
|
217
|
+
dimensions: [{ name: "supplier_id", role: "dimension", dataType: "number" }],
|
|
218
|
+
filters: [
|
|
219
|
+
{
|
|
220
|
+
field: { name: "direction", role: "dimension", dataType: "string" },
|
|
221
|
+
operator: "=",
|
|
222
|
+
value: "Inbound"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
limit: 15
|
|
226
|
+
},
|
|
205
227
|
boundedSqlRanking: {
|
|
206
228
|
version: 1,
|
|
207
229
|
kind: "sql",
|
|
@@ -229,21 +251,21 @@ export {
|
|
|
229
251
|
C as buildAnalyticsCatalogFieldSummary,
|
|
230
252
|
m as buildSemaphorQualifiedSourcePath,
|
|
231
253
|
I as getAnalyticsCatalogFieldCandidates,
|
|
232
|
-
|
|
254
|
+
T as getAnalyticsCatalogFieldName,
|
|
233
255
|
d as getSemaphorConnectionCapabilities,
|
|
234
|
-
|
|
256
|
+
q as inferAnalyticsMetricFormat,
|
|
235
257
|
S as isAnalyticsCatalogDateField,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
258
|
+
F as isAnalyticsCatalogDimensionField,
|
|
259
|
+
A as isAnalyticsCatalogMetricField,
|
|
260
|
+
_ as isAnalyticsDateLikeDataType,
|
|
261
|
+
L as isAnalyticsMetricIdentifierField,
|
|
262
|
+
R as isAnalyticsTechnicalIdentifierField,
|
|
263
|
+
N as normalizeAnalyticsCatalogDataType,
|
|
242
264
|
D as normalizeAnalyticsCatalogName,
|
|
243
265
|
c as normalizeSemaphorDialect,
|
|
244
266
|
u as semaphorSourceHasRequiredCoordinates,
|
|
245
|
-
|
|
246
|
-
|
|
267
|
+
v as validateSemaphorAnalyticsIntent,
|
|
268
|
+
g as validateSemaphorAnalyticsRecoveryPlan,
|
|
247
269
|
h as validateSemaphorDashboardIntent,
|
|
248
270
|
y as validateSemaphorOperationIntent
|
|
249
271
|
};
|