@wibi-global/sdk 0.1.0 → 0.1.1
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/artifact-schema/src/biCatalog.d.ts +3 -0
- package/dist/artifact-schema/src/biCatalog.d.ts.map +1 -0
- package/dist/artifact-schema/src/biCatalog.js +36 -0
- package/dist/artifact-schema/src/biCatalog.js.map +1 -0
- package/dist/artifact-schema/src/hash.d.ts +3 -0
- package/dist/artifact-schema/src/hash.d.ts.map +1 -0
- package/dist/artifact-schema/src/hash.js +22 -0
- package/dist/artifact-schema/src/hash.js.map +1 -0
- package/dist/artifact-schema/src/index.d.ts +6 -0
- package/dist/artifact-schema/src/index.d.ts.map +1 -0
- package/dist/artifact-schema/src/index.js +6 -0
- package/dist/artifact-schema/src/index.js.map +1 -0
- package/dist/artifact-schema/src/schema.d.ts +274 -0
- package/dist/artifact-schema/src/schema.d.ts.map +1 -0
- package/dist/artifact-schema/src/schema.js +165 -0
- package/dist/artifact-schema/src/schema.js.map +1 -0
- package/dist/artifact-schema/src/types.d.ts +88 -0
- package/dist/artifact-schema/src/types.d.ts.map +1 -0
- package/dist/artifact-schema/src/types.js +2 -0
- package/dist/artifact-schema/src/types.js.map +1 -0
- package/dist/artifact-schema/src/validate.d.ts +4 -0
- package/dist/artifact-schema/src/validate.d.ts.map +1 -0
- package/dist/artifact-schema/src/validate.js +101 -0
- package/dist/artifact-schema/src/validate.js.map +1 -0
- package/dist/instructions/AGENTS.md +92 -0
- package/dist/instructions/AGENT_COMMON.md +78 -0
- package/dist/instructions/CLAUDE.md +54 -0
- package/dist/instructions/CODEX.md +38 -0
- package/dist/instructions/GEMINI.md +35 -0
- package/dist/prompts/authoring.wbp +61 -0
- package/dist/sdk/src/builder.d.ts.map +1 -0
- package/dist/sdk/src/builder.js.map +1 -0
- package/dist/sdk/src/context.d.ts.map +1 -0
- package/dist/sdk/src/context.js.map +1 -0
- package/dist/sdk/src/dashboard-context.d.ts.map +1 -0
- package/dist/sdk/src/dashboard-context.js.map +1 -0
- package/dist/sdk/src/dashboard-spec.d.ts.map +1 -0
- package/dist/sdk/src/dashboard-spec.js.map +1 -0
- package/dist/sdk/src/data/ctx.wbx +114 -0
- package/dist/sdk/src/data/index.d.ts.map +1 -0
- package/dist/sdk/src/data/index.js.map +1 -0
- package/dist/sdk/src/data/queries.wbx +330 -0
- package/dist/sdk/src/data/serialization/dashboard-serialization.types.d.ts.map +1 -0
- package/dist/sdk/src/data/serialization/dashboard-serialization.types.js.map +1 -0
- package/dist/sdk/src/data/serialization/dashboard-serialization.types.ts +430 -0
- package/dist/sdk/src/data/serialization/index.d.ts.map +1 -0
- package/dist/sdk/src/data/serialization/index.js.map +1 -0
- package/dist/sdk/src/data/syntax.wbx +155 -0
- package/dist/sdk/src/data/view-categories.wbx +88 -0
- package/dist/sdk/src/data/views.wbx +1118 -0
- package/dist/sdk/src/data/widgets.wbx +2477 -0
- package/dist/sdk/src/data.d.ts.map +1 -0
- package/dist/sdk/src/data.js.map +1 -0
- package/dist/sdk/src/index.d.ts.map +1 -0
- package/dist/sdk/src/index.js.map +1 -0
- package/package.json +2 -2
- package/dist/builder.d.ts.map +0 -1
- package/dist/builder.js.map +0 -1
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/dashboard-context.d.ts.map +0 -1
- package/dist/dashboard-context.js.map +0 -1
- package/dist/dashboard-spec.d.ts.map +0 -1
- package/dist/dashboard-spec.js.map +0 -1
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js.map +0 -1
- package/dist/data/serialization/dashboard-serialization.types.d.ts.map +0 -1
- package/dist/data/serialization/dashboard-serialization.types.js.map +0 -1
- package/dist/data/serialization/index.d.ts.map +0 -1
- package/dist/data/serialization/index.js.map +0 -1
- package/dist/data.d.ts.map +0 -1
- package/dist/data.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{builder.d.ts → sdk/src/builder.d.ts} +0 -0
- /package/dist/{builder.js → sdk/src/builder.js} +0 -0
- /package/dist/{context.d.ts → sdk/src/context.d.ts} +0 -0
- /package/dist/{context.js → sdk/src/context.js} +0 -0
- /package/dist/{dashboard-context.d.ts → sdk/src/dashboard-context.d.ts} +0 -0
- /package/dist/{dashboard-context.js → sdk/src/dashboard-context.js} +0 -0
- /package/dist/{dashboard-spec.d.ts → sdk/src/dashboard-spec.d.ts} +0 -0
- /package/dist/{dashboard-spec.js → sdk/src/dashboard-spec.js} +0 -0
- /package/dist/{data → sdk/src/data}/index.d.ts +0 -0
- /package/dist/{data → sdk/src/data}/index.js +0 -0
- /package/dist/{data → sdk/src/data}/serialization/dashboard-serialization.types.d.ts +0 -0
- /package/dist/{data → sdk/src/data}/serialization/dashboard-serialization.types.js +0 -0
- /package/dist/{data → sdk/src/data}/serialization/index.d.ts +0 -0
- /package/dist/{data → sdk/src/data}/serialization/index.js +0 -0
- /package/dist/{data.d.ts → sdk/src/data.d.ts} +0 -0
- /package/dist/{data.js → sdk/src/data.js} +0 -0
- /package/dist/{index.d.ts → sdk/src/index.d.ts} +0 -0
- /package/dist/{index.js → sdk/src/index.js} +0 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
export interface SerializedMetadata {
|
|
2
|
+
name: string
|
|
3
|
+
description: string
|
|
4
|
+
schema_version: string
|
|
5
|
+
generated_at: string
|
|
6
|
+
category: string
|
|
7
|
+
is_public: boolean
|
|
8
|
+
/** Cor de fundo global do dashboard (hex, rgb, ou CSS gradient) */
|
|
9
|
+
background_color?: string
|
|
10
|
+
/** Cor do texto padrão do dashboard */
|
|
11
|
+
text_color?: string
|
|
12
|
+
/** Fonte customizada para o dashboard */
|
|
13
|
+
font_family?: string
|
|
14
|
+
/** Espaçamento entre seções em px */
|
|
15
|
+
section_gap?: number
|
|
16
|
+
/** Padding geral do dashboard em px */
|
|
17
|
+
padding?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DatePeriodType = 'D' | 'S' | 'M' | 'T' | 'SE' | 'A' | 'W' | 'Q' | 'Y' | 'SP' | 'CUSTOM'
|
|
21
|
+
|
|
22
|
+
export interface SerializedDateFilter {
|
|
23
|
+
id: string
|
|
24
|
+
type: 'date'
|
|
25
|
+
label: string
|
|
26
|
+
default_period_type: DatePeriodType
|
|
27
|
+
fallback_days?: number
|
|
28
|
+
binds_to: string[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SerializedEmpresaFilter {
|
|
32
|
+
id: string
|
|
33
|
+
type: 'empresa'
|
|
34
|
+
label: string
|
|
35
|
+
placeholder: string
|
|
36
|
+
default_value: number
|
|
37
|
+
sql_template: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type SerializedFilter = SerializedDateFilter | SerializedEmpresaFilter
|
|
41
|
+
|
|
42
|
+
export interface SerializedSection {
|
|
43
|
+
id: string
|
|
44
|
+
title: string
|
|
45
|
+
columns: number
|
|
46
|
+
responsive?: {
|
|
47
|
+
sm?: number
|
|
48
|
+
md?: number
|
|
49
|
+
xl?: number
|
|
50
|
+
}
|
|
51
|
+
items: string[]
|
|
52
|
+
/** Cor de fundo da seção */
|
|
53
|
+
background_color?: string
|
|
54
|
+
/** Cor do texto da seção */
|
|
55
|
+
text_color?: string
|
|
56
|
+
/** Raio de borda da seção em px */
|
|
57
|
+
border_radius?: number
|
|
58
|
+
/** Padding interno da seção em px */
|
|
59
|
+
padding?: number
|
|
60
|
+
/** Mostrar ou ocultar o título da seção */
|
|
61
|
+
show_title?: boolean
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface SerializedLayout {
|
|
65
|
+
mode: 'sections'
|
|
66
|
+
sections: SerializedSection[]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type SerializedWidgetType =
|
|
70
|
+
| 'kpi'
|
|
71
|
+
| 'chart'
|
|
72
|
+
| 'grid'
|
|
73
|
+
| 'progress-list'
|
|
74
|
+
| 'gauge'
|
|
75
|
+
| 'funnel'
|
|
76
|
+
| 'waterfall'
|
|
77
|
+
| 'heatmap'
|
|
78
|
+
| 'scatter'
|
|
79
|
+
| 'treemap'
|
|
80
|
+
| 'sankey'
|
|
81
|
+
| 'graph'
|
|
82
|
+
| 'sunburst'
|
|
83
|
+
| 'tree'
|
|
84
|
+
| 'radar'
|
|
85
|
+
| 'candlestick'
|
|
86
|
+
| 'boxplot'
|
|
87
|
+
| 'parallel'
|
|
88
|
+
| 'themeriver'
|
|
89
|
+
| 'sparkline'
|
|
90
|
+
| 'multi-card'
|
|
91
|
+
| 'panel'
|
|
92
|
+
| 'date'
|
|
93
|
+
| 'companies'
|
|
94
|
+
| 'heading'
|
|
95
|
+
| 'text'
|
|
96
|
+
| 'image'
|
|
97
|
+
| 'divider'
|
|
98
|
+
| 'spacer'
|
|
99
|
+
|
|
100
|
+
export interface SerializedKpiProperties {
|
|
101
|
+
widget_variant: 'kpi-card' | 'card-component'
|
|
102
|
+
label: string
|
|
103
|
+
value_field: string
|
|
104
|
+
value_format: 'currency' | 'percent' | 'days' | 'days-absolute' | 'number'
|
|
105
|
+
currency?: string
|
|
106
|
+
decimals?: number
|
|
107
|
+
caption: string
|
|
108
|
+
icon: string
|
|
109
|
+
tone: string
|
|
110
|
+
thresholds?: Record<string, number | boolean>
|
|
111
|
+
card_properties?: {
|
|
112
|
+
prefix?: string
|
|
113
|
+
aggregation?: string
|
|
114
|
+
subtitle?: string
|
|
115
|
+
color?: string
|
|
116
|
+
compact?: boolean
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface SerializedChartProperties {
|
|
121
|
+
/** Tipo visual do gráfico */
|
|
122
|
+
chart_type: 'bar' | 'line' | 'area' | 'pie' | 'donut' | 'horizontal_bar' | 'stacked_bar' | 'scatter'
|
|
123
|
+
/** Campo do eixo X (categorias) */
|
|
124
|
+
x_field: string
|
|
125
|
+
/** Campo de valor do eixo Y (série única) */
|
|
126
|
+
y_field?: string
|
|
127
|
+
/** Campos de valor do eixo Y (múltiplas séries) */
|
|
128
|
+
y_fields?: string[]
|
|
129
|
+
/** Campo para agrupar dados em séries automáticas */
|
|
130
|
+
group_by_field?: string
|
|
131
|
+
/** Tipo de agregação: sum, avg, count, min, max, first, last */
|
|
132
|
+
aggregation?: string
|
|
133
|
+
/** Limitar aos top N registros */
|
|
134
|
+
top_n?: number
|
|
135
|
+
/** Ordenação dos dados: asc | desc */
|
|
136
|
+
sort_order?: string
|
|
137
|
+
/** Título exibido no widget */
|
|
138
|
+
title?: string
|
|
139
|
+
/** Descrição curta abaixo do título */
|
|
140
|
+
description?: string
|
|
141
|
+
/** Exibir legenda */
|
|
142
|
+
show_legend?: boolean
|
|
143
|
+
/** Exibir rótulos com valores em cada barra/ponto/fatia */
|
|
144
|
+
show_data_labels?: boolean
|
|
145
|
+
/** Texto quando não há dados */
|
|
146
|
+
empty_state?: string
|
|
147
|
+
|
|
148
|
+
// — Barras —
|
|
149
|
+
/** Cada barra/fatia recebe cor diferente da paleta do tema. Use para rankings e top N. */
|
|
150
|
+
alternate_colors?: boolean
|
|
151
|
+
/** Orientação: 'vertical' (padrão) ou 'horizontal' */
|
|
152
|
+
orientation?: 'vertical' | 'horizontal'
|
|
153
|
+
/** Largura máxima das barras em % (1-100) */
|
|
154
|
+
bar_width?: number
|
|
155
|
+
/** Rotacionar labels do eixo X em 45° */
|
|
156
|
+
rotate_labels?: boolean
|
|
157
|
+
/** Habilitar zoom interativo */
|
|
158
|
+
enable_zoom?: boolean
|
|
159
|
+
|
|
160
|
+
// — Linhas —
|
|
161
|
+
/** Suavizar curvas (line/area) */
|
|
162
|
+
smooth?: boolean
|
|
163
|
+
/** Mostrar pontos nos vértices */
|
|
164
|
+
show_symbol?: boolean
|
|
165
|
+
/** Tamanho dos pontos */
|
|
166
|
+
symbol_size?: number
|
|
167
|
+
/** Estilo da linha: solid, dashed, dotted */
|
|
168
|
+
line_style?: string
|
|
169
|
+
|
|
170
|
+
// — Área —
|
|
171
|
+
/** Opacidade do preenchimento (0 a 1) */
|
|
172
|
+
area_opacity?: number
|
|
173
|
+
/** Usar gradiente no preenchimento */
|
|
174
|
+
gradient?: boolean
|
|
175
|
+
|
|
176
|
+
// — Pizza/Donut —
|
|
177
|
+
/** Raio externo da pizza em % */
|
|
178
|
+
radius?: number
|
|
179
|
+
/** Raio interno (furo) para donut em % */
|
|
180
|
+
inner_radius?: number
|
|
181
|
+
/** Tipo rose: 'radius', 'area', false */
|
|
182
|
+
rose_type?: string | boolean
|
|
183
|
+
/** Ângulo inicial em graus */
|
|
184
|
+
start_angle?: number
|
|
185
|
+
/** Ângulo mínimo de cada fatia */
|
|
186
|
+
min_angle?: number
|
|
187
|
+
/** Exibir porcentagem nos labels */
|
|
188
|
+
show_percentage?: boolean
|
|
189
|
+
/** Posição dos labels: outside, inside, center */
|
|
190
|
+
label_position?: string
|
|
191
|
+
/** Máximo de categorias na pizza */
|
|
192
|
+
max_categories?: number
|
|
193
|
+
/** Critério de ordenação para pizza: value | name */
|
|
194
|
+
sort_by?: string
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface SerializedGridColumnFormat {
|
|
198
|
+
/** Tipo de formatação: text, number, currency, percentage, date, datetime, boolean */
|
|
199
|
+
type?: 'text' | 'number' | 'currency' | 'percentage' | 'date' | 'datetime' | 'boolean'
|
|
200
|
+
/** Número de casas decimais */
|
|
201
|
+
decimals?: number
|
|
202
|
+
/** Moeda (padrão BRL): BRL, USD, MXN, COP, CLP */
|
|
203
|
+
currency?: string
|
|
204
|
+
/** Locale (padrão pt-BR) */
|
|
205
|
+
locale?: string
|
|
206
|
+
/** Notação: standard, compact, scientific */
|
|
207
|
+
notation?: 'standard' | 'compact' | 'scientific' | 'engineering'
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface SerializedGridColumnDef {
|
|
211
|
+
/** ID do campo (deve existir nos dados da query) */
|
|
212
|
+
id: string
|
|
213
|
+
/** Label exibido no cabeçalho */
|
|
214
|
+
header: string
|
|
215
|
+
/** Largura fixa em px ou string CSS (ex: '200px', '25%') */
|
|
216
|
+
width?: number | string
|
|
217
|
+
/** Largura mínima em px */
|
|
218
|
+
min_width?: number
|
|
219
|
+
/** Se a coluna é ordenável (padrão: true) */
|
|
220
|
+
sortable?: boolean
|
|
221
|
+
/** Classe CSS adicional para o cabeçalho */
|
|
222
|
+
header_class?: string
|
|
223
|
+
/** Classe CSS adicional para as células */
|
|
224
|
+
cell_class?: string
|
|
225
|
+
/** Formatação automática do valor */
|
|
226
|
+
format?: SerializedGridColumnFormat
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface SerializedGridProperties {
|
|
230
|
+
title: string
|
|
231
|
+
page_size: number
|
|
232
|
+
columns: string[]
|
|
233
|
+
column_labels: Record<string, string>
|
|
234
|
+
enable_filters: boolean
|
|
235
|
+
enable_export: boolean
|
|
236
|
+
enable_pagination: boolean
|
|
237
|
+
enable_column_settings: boolean
|
|
238
|
+
enable_fullscreen: boolean
|
|
239
|
+
enable_aggregation: boolean
|
|
240
|
+
/** Definições avançadas por coluna (DataGridV2). Se presente, tem prioridade sobre columns + column_labels. */
|
|
241
|
+
column_defs?: SerializedGridColumnDef[]
|
|
242
|
+
/** Ordenação inicial: campo e direção */
|
|
243
|
+
default_sort?: { column_id: string; direction: 'asc' | 'desc' }
|
|
244
|
+
/** Usar DataGridV2 em vez do DataGrid legado (padrão: false para compatibilidade) */
|
|
245
|
+
use_grid_v2?: boolean
|
|
246
|
+
/** Mensagem quando não há dados */
|
|
247
|
+
empty_message?: string
|
|
248
|
+
/** Mensagem durante carregamento */
|
|
249
|
+
loading_message?: string
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface SerializedPanelAction {
|
|
253
|
+
path: string
|
|
254
|
+
title: string
|
|
255
|
+
description: string
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface SerializedProgressListProperties {
|
|
259
|
+
/** Campo de label (categoria/nome exibido na linha) */
|
|
260
|
+
labelField: string
|
|
261
|
+
/** Campo de valor numérico para as barras */
|
|
262
|
+
valueField: string
|
|
263
|
+
/** Agregação: sum | avg | count | min | max */
|
|
264
|
+
aggregation?: 'sum' | 'avg' | 'count' | 'min' | 'max'
|
|
265
|
+
/** Número máximo de itens exibidos */
|
|
266
|
+
maxItems?: number
|
|
267
|
+
/** Exibir valor numérico ao lado da barra */
|
|
268
|
+
showValues?: boolean
|
|
269
|
+
/** Exibir percentual ao lado da barra */
|
|
270
|
+
showPercentage?: boolean
|
|
271
|
+
/** Formato do valor: number | currency | compact | percentage */
|
|
272
|
+
valueFormat?: 'number' | 'currency' | 'compact' | 'percentage'
|
|
273
|
+
/** Altura em px das barras de progresso */
|
|
274
|
+
barHeight?: number
|
|
275
|
+
/** Esquema de cores: gradient | single | custom */
|
|
276
|
+
colorScheme?: 'gradient' | 'single' | 'custom'
|
|
277
|
+
/** Cor primária (usada em colorScheme='single') */
|
|
278
|
+
primaryColor?: string
|
|
279
|
+
/** Ordenação: value | label | none */
|
|
280
|
+
sortBy?: 'value' | 'label' | 'none'
|
|
281
|
+
/** Direção da ordenação: asc | desc */
|
|
282
|
+
sortOrder?: 'asc' | 'desc'
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface SerializedPanelProperties {
|
|
286
|
+
panel_type: 'risk-summary' | 'info' | 'actions'
|
|
287
|
+
title: string
|
|
288
|
+
score_field?: string
|
|
289
|
+
score_format?: string
|
|
290
|
+
score_thresholds?: Record<string, number>
|
|
291
|
+
diagnostic_fields?: string[]
|
|
292
|
+
actions?: SerializedPanelAction[]
|
|
293
|
+
sources?: string[]
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface SerializedDateWidgetProperties {
|
|
297
|
+
label?: string
|
|
298
|
+
default_period_type?: DatePeriodType
|
|
299
|
+
fallback_days?: number
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface SerializedCompaniesWidgetProperties {
|
|
303
|
+
placeholder?: string
|
|
304
|
+
show_icon?: boolean
|
|
305
|
+
auto_select_first?: boolean
|
|
306
|
+
default_value?: number
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ─── Decorative Elements ─────────────────────────────────────────────
|
|
310
|
+
|
|
311
|
+
export interface SerializedHeadingProperties {
|
|
312
|
+
/** Nível do heading: h1, h2, h3, h4 */
|
|
313
|
+
level: 'h1' | 'h2' | 'h3' | 'h4'
|
|
314
|
+
/** Texto do heading */
|
|
315
|
+
content: string
|
|
316
|
+
/** Alinhamento: left, center, right */
|
|
317
|
+
align?: 'left' | 'center' | 'right'
|
|
318
|
+
/** Cor do texto (hex, rgb, nome CSS) */
|
|
319
|
+
color?: string
|
|
320
|
+
/** Subtítulo opcional abaixo do heading */
|
|
321
|
+
subtitle?: string
|
|
322
|
+
/** Cor do subtítulo */
|
|
323
|
+
subtitle_color?: string
|
|
324
|
+
/** Ícone opcional (nome Lucide) */
|
|
325
|
+
icon?: string
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface SerializedTextProperties {
|
|
329
|
+
/** Conteúdo do texto (suporta markdown básico: **bold**, *italic*, [links]) */
|
|
330
|
+
content: string
|
|
331
|
+
/** Alinhamento: left, center, right, justify */
|
|
332
|
+
align?: 'left' | 'center' | 'right' | 'justify'
|
|
333
|
+
/** Tamanho da fonte: xs, sm, base, lg, xl */
|
|
334
|
+
font_size?: 'xs' | 'sm' | 'base' | 'lg' | 'xl'
|
|
335
|
+
/** Cor do texto */
|
|
336
|
+
color?: string
|
|
337
|
+
/** Cor de fundo */
|
|
338
|
+
background_color?: string
|
|
339
|
+
/** Padding interno em px */
|
|
340
|
+
padding?: number
|
|
341
|
+
/** Raio de borda em px */
|
|
342
|
+
border_radius?: number
|
|
343
|
+
/** Cor da borda (se definido, aplica borda de 1px) */
|
|
344
|
+
border_color?: string
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface SerializedImageProperties {
|
|
348
|
+
/** URL da imagem */
|
|
349
|
+
src: string
|
|
350
|
+
/** Texto alternativo */
|
|
351
|
+
alt: string
|
|
352
|
+
/** Ajuste da imagem: cover, contain, fill, none */
|
|
353
|
+
object_fit?: 'cover' | 'contain' | 'fill' | 'none'
|
|
354
|
+
/** Altura fixa em px (se não definido, usa aspect ratio natural) */
|
|
355
|
+
height?: number
|
|
356
|
+
/** Raio de borda em px */
|
|
357
|
+
border_radius?: number
|
|
358
|
+
/** Link ao clicar na imagem */
|
|
359
|
+
href?: string
|
|
360
|
+
/** Legenda abaixo da imagem */
|
|
361
|
+
caption?: string
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface SerializedDividerProperties {
|
|
365
|
+
/** Estilo da linha: solid, dashed, dotted */
|
|
366
|
+
style?: 'solid' | 'dashed' | 'dotted'
|
|
367
|
+
/** Cor da linha */
|
|
368
|
+
color?: string
|
|
369
|
+
/** Espessura em px */
|
|
370
|
+
thickness?: number
|
|
371
|
+
/** Margem vertical em px */
|
|
372
|
+
margin?: number
|
|
373
|
+
/** Texto opcional no centro do divider */
|
|
374
|
+
label?: string
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export interface SerializedSpacerProperties {
|
|
378
|
+
/** Altura do espaçamento em px */
|
|
379
|
+
height: number
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export type SerializedWidgetProperties =
|
|
383
|
+
| SerializedKpiProperties
|
|
384
|
+
| SerializedChartProperties
|
|
385
|
+
| SerializedGridProperties
|
|
386
|
+
| SerializedProgressListProperties
|
|
387
|
+
| SerializedPanelProperties
|
|
388
|
+
| SerializedDateWidgetProperties
|
|
389
|
+
| SerializedCompaniesWidgetProperties
|
|
390
|
+
| SerializedHeadingProperties
|
|
391
|
+
| SerializedTextProperties
|
|
392
|
+
| SerializedImageProperties
|
|
393
|
+
| SerializedDividerProperties
|
|
394
|
+
| SerializedSpacerProperties
|
|
395
|
+
|
|
396
|
+
export interface SerializedWidget {
|
|
397
|
+
id: string
|
|
398
|
+
title: string
|
|
399
|
+
widget_type: SerializedWidgetType
|
|
400
|
+
section_id: string
|
|
401
|
+
order: number
|
|
402
|
+
col_span: number
|
|
403
|
+
height?: number
|
|
404
|
+
properties: SerializedWidgetProperties
|
|
405
|
+
query_id: string | null
|
|
406
|
+
/** Cor de fundo do widget */
|
|
407
|
+
background_color?: string
|
|
408
|
+
/** Cor do texto do widget */
|
|
409
|
+
text_color?: string
|
|
410
|
+
/** Raio de borda em px */
|
|
411
|
+
border_radius?: number
|
|
412
|
+
/** Ocultar borda do widget */
|
|
413
|
+
borderless?: boolean
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface SerializedQuery {
|
|
417
|
+
id: string
|
|
418
|
+
description: string
|
|
419
|
+
sql_template: string
|
|
420
|
+
sources: string[]
|
|
421
|
+
output_fields: string[]
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface SerializedDashboard {
|
|
425
|
+
metadata: SerializedMetadata
|
|
426
|
+
filters: SerializedFilter[]
|
|
427
|
+
layout: SerializedLayout
|
|
428
|
+
widgets: SerializedWidget[]
|
|
429
|
+
queries: SerializedQuery[]
|
|
430
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/data/serialization/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,EACzB,qBAAqB,EACrB,8BAA8B,EAC9B,mCAAmC,EACnC,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,eAAe,EACf,cAAc,GACf,MAAM,oCAAoC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/data/serialization/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"__CONTEXT_BLOCK__": {
|
|
3
|
+
"block_name": "DB_SCHEMA_SYNTAX",
|
|
4
|
+
"block_role": "SOURCE_OF_TRUTH_FOR_SQL_SYNTAX",
|
|
5
|
+
"llm_instruction": "Este bloco define a sintaxe SQL permitida. Quando houver SQL no TSX, siga este bloco e não misture dialetos."
|
|
6
|
+
},
|
|
7
|
+
"sql_syntax": {
|
|
8
|
+
"clickhouse": [
|
|
9
|
+
"",
|
|
10
|
+
"=== SINTAXE CLICKHOUSE ===",
|
|
11
|
+
"Você está conectado a um banco CLICKHOUSE. Use a sintaxe correta do ClickHouse:",
|
|
12
|
+
"",
|
|
13
|
+
"⚠️ As views já retornam automaticamente a versão mais recente dos dados.",
|
|
14
|
+
"NÃO é necessário usar a palavra-chave FINAL nas queries.",
|
|
15
|
+
"Exemplo: SELECT colunas FROM vw_clientes WHERE condicao;",
|
|
16
|
+
"",
|
|
17
|
+
"FUNÇÕES DE DATA:",
|
|
18
|
+
"- now() - data/hora atual",
|
|
19
|
+
"- today() - data atual",
|
|
20
|
+
"- yesterday() - ontem",
|
|
21
|
+
"- toDate(coluna) - converter para date",
|
|
22
|
+
"- subtractDays(now(), 7) - 7 dias atrás",
|
|
23
|
+
"- subtractMonths(now(), 1) - 1 mês atrás",
|
|
24
|
+
"- dateDiff('day', data1, data2) - diferença em dias",
|
|
25
|
+
"- toYear(coluna) - extrair ano",
|
|
26
|
+
"- toMonth(coluna) - extrair mês (número)",
|
|
27
|
+
"- monthName(coluna) - nome do mês (use monthName, NÃO toMonthName)",
|
|
28
|
+
"- toDayOfMonth(coluna) - dia do mês",
|
|
29
|
+
"- toDayOfWeek(coluna) - dia da semana",
|
|
30
|
+
"- toHour(coluna) - hora",
|
|
31
|
+
"",
|
|
32
|
+
"TRUNCAR DATAS (usar início de período):",
|
|
33
|
+
"⚠️ CRÍTICO: NO CLICKHOUSE NÃO EXISTE FUNÇÃO trunc() PARA DATAS!",
|
|
34
|
+
"- toStartOfDay(coluna) - início do dia (00:00:00)",
|
|
35
|
+
"- toStartOfWeek(coluna) - início da semana (segunda-feira)",
|
|
36
|
+
"- toStartOfMonth(coluna) - primeiro dia do mês",
|
|
37
|
+
"- toStartOfQuarter(coluna) - primeiro dia do trimestre",
|
|
38
|
+
"- toStartOfYear(coluna) - primeiro dia do ano (01/01)",
|
|
39
|
+
"- toStartOfHour(coluna) - início da hora (:00:00)",
|
|
40
|
+
"- toStartOfMinute(coluna) - início do minuto (:00)",
|
|
41
|
+
"",
|
|
42
|
+
"FUNÇÕES DE FORMATAÇÃO:",
|
|
43
|
+
"- formatDateTime(coluna, 'formato') - formatar data/hora",
|
|
44
|
+
"- formatDateTime(coluna, 'formato', 'timezone') - formatar com timezone específico",
|
|
45
|
+
"- toString(coluna) - converter para string",
|
|
46
|
+
"",
|
|
47
|
+
"FORMATAÇÃO DE DATA/HORA COM TIMEZONE:",
|
|
48
|
+
"⚠️ IMPORTANTE: Use timezone 'UTC' ou 'America/Sao_Paulo' quando necessário",
|
|
49
|
+
"- formatDateTime(coluna, '%Y-%m-%d', 'UTC') - formata em UTC",
|
|
50
|
+
"- formatDateTime(coluna, '%d/%m/%Y %H:%M:%S', 'America/Sao_Paulo') - horário de Brasília",
|
|
51
|
+
"- Formatos comuns:",
|
|
52
|
+
" * '%Y-%m-%d' - 2024-11-20",
|
|
53
|
+
" * '%d/%m/%Y' - 20/11/2024",
|
|
54
|
+
" * '%Y-%m-%d %H:%M:%S' - 2024-11-20 14:30:00",
|
|
55
|
+
" * '%d/%m/%Y %H:%M' - 20/11/2024 14:30",
|
|
56
|
+
"",
|
|
57
|
+
"EXEMPLOS CORRETOS:",
|
|
58
|
+
"✅ WHERE data_venda >= subtractDays(today(), 7)",
|
|
59
|
+
"✅ WHERE toYear(data_venda) = toYear(now())",
|
|
60
|
+
"✅ WHERE data_venda >= today() - INTERVAL 7 DAY",
|
|
61
|
+
"✅ WHERE data_venda >= toStartOfMonth(today()) -- Primeiro dia do mês atual",
|
|
62
|
+
"✅ WHERE data_venda >= toStartOfYear(today()) -- Primeiro dia do ano atual",
|
|
63
|
+
"✅ WHERE data_venda >= toStartOfWeek(today()) -- Início da semana (segunda)",
|
|
64
|
+
"✅ SELECT monthName(data_venda) AS mes",
|
|
65
|
+
"✅ SELECT toMonth(data_venda) AS mes_numero -- Retorna 1-12",
|
|
66
|
+
"✅ SELECT formatDateTime(data_venda, '%Y-%m-%d') AS data",
|
|
67
|
+
"✅ SELECT formatDateTime(data_venda, '%d/%m/%Y', 'America/Sao_Paulo') AS data_br",
|
|
68
|
+
"✅ SELECT formatDateTime(now(), '%Y-%m-%d %H:%M:%S', 'UTC') AS data_hora_utc",
|
|
69
|
+
"",
|
|
70
|
+
"EXEMPLOS ERRADOS (NÃO USE NO CLICKHOUSE):",
|
|
71
|
+
"❌ WHERE data_venda >= trunc(today(), 'month') -- trunc() NÃO EXISTE! Use toStartOfMonth()",
|
|
72
|
+
"❌ WHERE data_venda >= TRUNC(SYSDATE, 'MM') -- Sintaxe Oracle, não ClickHouse",
|
|
73
|
+
"❌ WHERE data_venda >= DATE_TRUNC('month', NOW()) -- Sintaxe PostgreSQL, não ClickHouse",
|
|
74
|
+
"❌ SELECT toMonthName(data_venda) -- Função não existe, use monthName()",
|
|
75
|
+
"",
|
|
76
|
+
"EXEMPLOS PRÁTICOS DE PERÍODOS:",
|
|
77
|
+
"-- Mês atual (do dia 1 até hoje)",
|
|
78
|
+
"✅ WHERE data_venda >= toStartOfMonth(today()) AND data_venda <= today()",
|
|
79
|
+
"",
|
|
80
|
+
"-- Ano atual (do dia 1/1 até hoje)",
|
|
81
|
+
"✅ WHERE data_venda >= toStartOfYear(today()) AND data_venda <= today()",
|
|
82
|
+
"",
|
|
83
|
+
"-- Semana atual (de segunda até hoje)",
|
|
84
|
+
"✅ WHERE data_venda >= toStartOfWeek(today()) AND data_venda <= today()",
|
|
85
|
+
"",
|
|
86
|
+
"-- Mês anterior completo",
|
|
87
|
+
"✅ WHERE data_venda >= toStartOfMonth(subtractMonths(today(), 1))",
|
|
88
|
+
" AND data_venda < toStartOfMonth(today())",
|
|
89
|
+
"",
|
|
90
|
+
"PLACEHOLDERS DE FILTRO DINÂMICO (usar em sql_template):",
|
|
91
|
+
"⚠️ CRÍTICO: Use SEMPRE os placeholders abaixo para filtros de período e empresa.",
|
|
92
|
+
"O runtime substitui os placeholders antes de enviar a query ao ClickHouse.",
|
|
93
|
+
"NÃO envie templates literais como '{{startDate}}' sem que o runtime resolva — isso causará erro de parse.",
|
|
94
|
+
"",
|
|
95
|
+
"PLACEHOLDERS CANÔNICOS (formatos aceitos pelo runtime):",
|
|
96
|
+
" {{startDate}} — data inicial do período selecionado (string 'YYYY-MM-DD')",
|
|
97
|
+
" {{endDate}} — data final do período selecionado (string 'YYYY-MM-DD')",
|
|
98
|
+
"",
|
|
99
|
+
"ALIASES TAMBÉM ACEITOS (evite usar, prefira os canônicos acima):",
|
|
100
|
+
" ${startDate} — equivalente a {{startDate}}",
|
|
101
|
+
" ${endDate} — equivalente a {{endDate}}",
|
|
102
|
+
" {{start_date}} — equivalente a {{startDate}}",
|
|
103
|
+
" {{end_date}} — equivalente a {{endDate}}",
|
|
104
|
+
"",
|
|
105
|
+
"EXEMPLOS CORRETOS DE sql_template COM PLACEHOLDERS:",
|
|
106
|
+
"✅ WHERE data_movimento >= '{{startDate}}' AND data_movimento <= '{{endDate}}'",
|
|
107
|
+
"✅ WHERE data_venda >= '{{startDate}}' AND data_venda <= '{{endDate}}'",
|
|
108
|
+
"✅ WHERE data_emissao BETWEEN '{{startDate}}' AND '{{endDate}}'",
|
|
109
|
+
"",
|
|
110
|
+
"EXEMPLOS ERRADOS:",
|
|
111
|
+
"❌ WHERE data_movimento >= subtractDays(today(), 30) -- ignora filtro do usuário",
|
|
112
|
+
"❌ WHERE data_movimento >= '2024-01-01' -- data hardcoded",
|
|
113
|
+
"",
|
|
114
|
+
"RESPOSTA DA API — camelCase:",
|
|
115
|
+
"⚠️ A API retorna os dados em camelCase (camel_case: true).",
|
|
116
|
+
"Use nomes de alias em camelCase nas queries para que o runtime os receba corretamente.",
|
|
117
|
+
"Exemplos:",
|
|
118
|
+
"✅ SELECT sum(valor_total) AS totalFaturamento",
|
|
119
|
+
"✅ SELECT count() AS totalPedidos",
|
|
120
|
+
"✅ SELECT fornecedor AS nomeFornecedor",
|
|
121
|
+
"❌ SELECT sum(valor_total) AS total_faturamento -- snake_case será convertido para totalFaturamento mesmo assim",
|
|
122
|
+
"",
|
|
123
|
+
"AGREGAÇÕES:",
|
|
124
|
+
"- LIMIT 10 (não TOP 10)",
|
|
125
|
+
"- GROUP BY pode usar alias ou índice da coluna",
|
|
126
|
+
"",
|
|
127
|
+
"REGRAS PARA CTEs (Common Table Expressions):",
|
|
128
|
+
"⚠️ CRÍTICO: Estruture CTEs de forma progressiva e linear",
|
|
129
|
+
"1. NUNCA faça JOIN duplicado: se tabela X já foi unida na CTE anterior, use os dados dela diretamente",
|
|
130
|
+
"2. GROUP BY: toda coluna no SELECT deve estar no GROUP BY (exceto agregações)",
|
|
131
|
+
"3. Fluxo correto: Filtros → Agregar granular → JOIN dimensões → Agregar final",
|
|
132
|
+
"4. Valide sempre: 'a coluna X existe no SELECT da CTE anterior?'",
|
|
133
|
+
"5. JOINs com dimensões (produtos, clientes, rotas) só na CTE onde serão agregados",
|
|
134
|
+
"",
|
|
135
|
+
"✅ EXEMPLO CORRETO DE CTE:",
|
|
136
|
+
"WITH vendas_filtradas AS (",
|
|
137
|
+
" SELECT id_cliente, id_produto, SUM(valor_total) AS total",
|
|
138
|
+
" FROM vw_vendas",
|
|
139
|
+
" WHERE data_venda >= toStartOfMonth(today())",
|
|
140
|
+
" GROUP BY id_cliente, id_produto",
|
|
141
|
+
"),",
|
|
142
|
+
"vendas_com_cliente AS (",
|
|
143
|
+
" SELECT vf.*, c.nome_completo",
|
|
144
|
+
" FROM vendas_filtradas vf",
|
|
145
|
+
" INNER JOIN vw_clientes c ON vf.id_cliente = c.id_cliente -- JOIN apenas aqui",
|
|
146
|
+
")",
|
|
147
|
+
"SELECT * FROM vendas_com_cliente",
|
|
148
|
+
"",
|
|
149
|
+
"❌ EXEMPLO ERRADO:",
|
|
150
|
+
"-- Não faça JOIN duplicado em múltiplas CTEs com a mesma tabela",
|
|
151
|
+
"",
|
|
152
|
+
""
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"__CONTEXT_BLOCK__": {
|
|
3
|
+
"block_name": "VIEW_CATEGORIES",
|
|
4
|
+
"block_role": "SOURCE_OF_TRUTH_FOR_VIEW_CATEGORY_RESTRICTIONS",
|
|
5
|
+
"llm_instruction": "Este arquivo define quais views SQL sao permitidas para cada categoria de dashboard. Ao gerar queries, leia project.category de dashboard.context.json e use SOMENTE as views listadas na categoria correspondente. Se a view nao estiver na lista da categoria, ela NAO pode ser usada. O campo __doc__ de cada categoria explica o contexto de negocio."
|
|
6
|
+
},
|
|
7
|
+
"agro": {
|
|
8
|
+
"__doc__": "Agronegocio. Movimentacoes de produtos agricolas, faturamento, fornecedores, logistica agro. Dados importados de sistema agrologico.",
|
|
9
|
+
"views": ["vw_base_agrolog"],
|
|
10
|
+
"strict": true
|
|
11
|
+
},
|
|
12
|
+
"comercial": {
|
|
13
|
+
"__doc__": "Comercial / Vendas. Analises de faturamento, clientes, vendedores, metas, rotas, produtos, precos, positivacao e cobertura.",
|
|
14
|
+
"views": [
|
|
15
|
+
"vw_vendas_validas",
|
|
16
|
+
"vw_clientes",
|
|
17
|
+
"vw_clientes_estatisticas",
|
|
18
|
+
"vw_clientes_rotas",
|
|
19
|
+
"vw_vendedores",
|
|
20
|
+
"vw_rotas",
|
|
21
|
+
"vw_rotas_vendedores",
|
|
22
|
+
"vw_produtos",
|
|
23
|
+
"vw_produtos_precos_detalhes",
|
|
24
|
+
"vw_metas",
|
|
25
|
+
"vw_metas_produtos",
|
|
26
|
+
"vw_empresas",
|
|
27
|
+
"vw_calendario",
|
|
28
|
+
"vw_calendario_rotas",
|
|
29
|
+
"vw_positivacao_semanal_cliente",
|
|
30
|
+
"vw_positivacao_semanal_fornecedor",
|
|
31
|
+
"vw_positivacao_semanal_grupo",
|
|
32
|
+
"vw_positivacao_semanal_produto",
|
|
33
|
+
"vw_positivacao_semanal_secao",
|
|
34
|
+
"vw_positivacao_semanal_subgrupo"
|
|
35
|
+
],
|
|
36
|
+
"strict": true
|
|
37
|
+
},
|
|
38
|
+
"financeiro": {
|
|
39
|
+
"__doc__": "Financeiro. Contas a pagar, contas a receber, movimentacao de contas, plano de contas, fornecedores e empresas.",
|
|
40
|
+
"views": [
|
|
41
|
+
"vw_financ_cp_parcelas",
|
|
42
|
+
"vw_financ_cr_parcelas",
|
|
43
|
+
"vw_financ_mov_contas",
|
|
44
|
+
"vw_plano_contas",
|
|
45
|
+
"vw_fornecedores",
|
|
46
|
+
"vw_clientes",
|
|
47
|
+
"vw_empresas",
|
|
48
|
+
"vw_calendario"
|
|
49
|
+
],
|
|
50
|
+
"strict": true
|
|
51
|
+
},
|
|
52
|
+
"producao": {
|
|
53
|
+
"__doc__": "Producao / Industria. Ordens de producao, fichas tecnicas, componentes, etapas produtivas, equipamentos e custos.",
|
|
54
|
+
"views": [
|
|
55
|
+
"vw_ordem_producao",
|
|
56
|
+
"vw_ordem_producao_etapas",
|
|
57
|
+
"vw_ordem_producao_etapas_equip",
|
|
58
|
+
"vw_ordem_producao_itens",
|
|
59
|
+
"vw_ordem_producao_itens_comp",
|
|
60
|
+
"vw_ficha_tecnica",
|
|
61
|
+
"vw_ficha_tecnica_detalhes",
|
|
62
|
+
"vw_ficha_tecnica_acabados",
|
|
63
|
+
"vw_ficha_tecnica_acabados_emb",
|
|
64
|
+
"vw_produtos",
|
|
65
|
+
"vw_empresas",
|
|
66
|
+
"vw_calendario"
|
|
67
|
+
],
|
|
68
|
+
"strict": true
|
|
69
|
+
},
|
|
70
|
+
"logistica": {
|
|
71
|
+
"__doc__": "Logistica / Frota. Abastecimentos, custos logisticos, estoque e operacoes de movimentacao.",
|
|
72
|
+
"views": [
|
|
73
|
+
"vw_abastecimentos",
|
|
74
|
+
"vw_custos",
|
|
75
|
+
"vw_estoque_operacoes",
|
|
76
|
+
"vw_produtos",
|
|
77
|
+
"vw_fornecedores",
|
|
78
|
+
"vw_empresas",
|
|
79
|
+
"vw_calendario"
|
|
80
|
+
],
|
|
81
|
+
"strict": true
|
|
82
|
+
},
|
|
83
|
+
"geral": {
|
|
84
|
+
"__doc__": "Categoria generica. Sem restricao de views — todas as views listadas em views.wbx sao permitidas.",
|
|
85
|
+
"views": "__ALL__",
|
|
86
|
+
"strict": false
|
|
87
|
+
}
|
|
88
|
+
}
|