@sisense/sdk-ai-core 0.3.1 → 0.4.0
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/engines/chart-builder/chart-builder-engine.d.ts.map +1 -1
- package/dist/engines/chart-builder/update-chart/chart-options-schemas.d.ts +71 -321
- package/dist/engines/chart-builder/update-chart/chart-options-schemas.d.ts.map +1 -1
- package/dist/engines/chart-builder/update-chart/update-chart-data-options.d.ts +24 -2
- package/dist/engines/chart-builder/update-chart/update-chart-data-options.d.ts.map +1 -1
- package/dist/engines/dashboards/dashboards-engine.d.ts +10 -0
- package/dist/engines/dashboards/dashboards-engine.d.ts.map +1 -0
- package/dist/engines/dashboards/index.d.ts +3 -0
- package/dist/engines/dashboards/index.d.ts.map +1 -0
- package/dist/engines/dashboards/types.d.ts +27 -0
- package/dist/engines/dashboards/types.d.ts.map +1 -0
- package/dist/engines/index.d.ts +2 -0
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/recommend-queries/index.d.ts +3 -0
- package/dist/engines/recommend-queries/index.d.ts.map +1 -0
- package/dist/engines/recommend-queries/recommend-queries-engine.d.ts +20 -0
- package/dist/engines/recommend-queries/recommend-queries-engine.d.ts.map +1 -0
- package/dist/engines/recommend-queries/types.d.ts +65 -0
- package/dist/engines/recommend-queries/types.d.ts.map +1 -0
- package/dist/index.js +1299 -1146
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { z as o, ZodFirstPartyTypeKind as
|
|
2
|
-
import { translateQueryJSON as
|
|
3
|
-
import { HttpClient as At, getAuthenticator as
|
|
4
|
-
import
|
|
5
|
-
import { isChartWidgetProps as
|
|
6
|
-
import { convertDataSource as
|
|
7
|
-
const
|
|
1
|
+
import { z as o, ZodFirstPartyTypeKind as f } from "zod";
|
|
2
|
+
import { translateQueryJSON as Ot, translateQueryToJaql as Ct, widgetComposer as Dt, getChartStyleOptions as Le } from "@sisense/sdk-ui/analytics-composer";
|
|
3
|
+
import { HttpClient as At, getAuthenticator as Pt } from "@sisense/sdk-rest-client";
|
|
4
|
+
import Tt from "openai";
|
|
5
|
+
import { isChartWidgetProps as Re, getDashboardModel as _t, dashboardModelTranslator as xt, widgetModelTranslator as De, translateFiltersAndRelationsToDto as $t } from "@sisense/sdk-ui";
|
|
6
|
+
import { convertDataSource as Ue, normalizeName as Ae, DateLevels as jt, convertJaqlDataSourceForDto as pe, isDataSourceInfo as me } from "@sisense/sdk-data";
|
|
7
|
+
const Et = Symbol("Let zodToJsonSchema decide on which parser to use"), kt = {
|
|
8
8
|
name: void 0,
|
|
9
9
|
$refStrategy: "root",
|
|
10
10
|
basePath: ["#"],
|
|
@@ -27,11 +27,11 @@ const $t = Symbol("Let zodToJsonSchema decide on which parser to use"), jt = {
|
|
|
27
27
|
base64Strategy: "contentEncoding:base64",
|
|
28
28
|
nameStrategy: "ref",
|
|
29
29
|
openAiAnyTypeName: "OpenAiAnyType"
|
|
30
|
-
},
|
|
31
|
-
...
|
|
30
|
+
}, Mt = (e) => ({
|
|
31
|
+
...kt,
|
|
32
32
|
...e
|
|
33
|
-
}),
|
|
34
|
-
const t =
|
|
33
|
+
}), Nt = (e) => {
|
|
34
|
+
const t = Mt(e), n = t.name !== void 0 ? [...t.basePath, t.definitionPath, t.name] : t.basePath;
|
|
35
35
|
return {
|
|
36
36
|
...t,
|
|
37
37
|
flags: { hasReferencedOpenAiAnyType: !1 },
|
|
@@ -54,10 +54,10 @@ function ze(e, t, n, a) {
|
|
|
54
54
|
[t]: n
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function v(e, t, n, a, r) {
|
|
58
58
|
e[t] = n, ze(e, t, a, r);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const Be = (e, t) => {
|
|
61
61
|
let n = 0;
|
|
62
62
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++)
|
|
63
63
|
;
|
|
@@ -67,7 +67,7 @@ var m;
|
|
|
67
67
|
(function(e) {
|
|
68
68
|
e.ZodString = "ZodString", e.ZodNumber = "ZodNumber", e.ZodNaN = "ZodNaN", e.ZodBigInt = "ZodBigInt", e.ZodBoolean = "ZodBoolean", e.ZodDate = "ZodDate", e.ZodSymbol = "ZodSymbol", e.ZodUndefined = "ZodUndefined", e.ZodNull = "ZodNull", e.ZodAny = "ZodAny", e.ZodUnknown = "ZodUnknown", e.ZodNever = "ZodNever", e.ZodVoid = "ZodVoid", e.ZodArray = "ZodArray", e.ZodObject = "ZodObject", e.ZodUnion = "ZodUnion", e.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", e.ZodIntersection = "ZodIntersection", e.ZodTuple = "ZodTuple", e.ZodRecord = "ZodRecord", e.ZodMap = "ZodMap", e.ZodSet = "ZodSet", e.ZodFunction = "ZodFunction", e.ZodLazy = "ZodLazy", e.ZodLiteral = "ZodLiteral", e.ZodEnum = "ZodEnum", e.ZodEffects = "ZodEffects", e.ZodNativeEnum = "ZodNativeEnum", e.ZodOptional = "ZodOptional", e.ZodNullable = "ZodNullable", e.ZodDefault = "ZodDefault", e.ZodCatch = "ZodCatch", e.ZodPromise = "ZodPromise", e.ZodBranded = "ZodBranded", e.ZodPipeline = "ZodPipeline", e.ZodReadonly = "ZodReadonly";
|
|
69
69
|
})(m || (m = {}));
|
|
70
|
-
function
|
|
70
|
+
function A(e) {
|
|
71
71
|
if (e.target !== "openAi")
|
|
72
72
|
return {};
|
|
73
73
|
const t = [
|
|
@@ -76,20 +76,20 @@ function C(e) {
|
|
|
76
76
|
e.openAiAnyTypeName
|
|
77
77
|
];
|
|
78
78
|
return e.flags.hasReferencedOpenAiAnyType = !0, {
|
|
79
|
-
$ref: e.$refStrategy === "relative" ?
|
|
79
|
+
$ref: e.$refStrategy === "relative" ? Be(t, e.currentPath) : t.join("/")
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function It(e, t) {
|
|
83
83
|
var a, r, i;
|
|
84
84
|
const n = {
|
|
85
85
|
type: "array"
|
|
86
86
|
};
|
|
87
|
-
return (a = e.type) != null && a._def && ((i = (r = e.type) == null ? void 0 : r._def) == null ? void 0 : i.typeName) !== m.ZodAny && (n.items =
|
|
87
|
+
return (a = e.type) != null && a._def && ((i = (r = e.type) == null ? void 0 : r._def) == null ? void 0 : i.typeName) !== m.ZodAny && (n.items = w(e.type._def, {
|
|
88
88
|
...t,
|
|
89
89
|
currentPath: [...t.currentPath, "items"]
|
|
90
|
-
})), e.minLength &&
|
|
90
|
+
})), e.minLength && v(n, "minItems", e.minLength.value, e.minLength.message, t), e.maxLength && v(n, "maxItems", e.maxLength.value, e.maxLength.message, t), e.exactLength && (v(n, "minItems", e.exactLength.value, e.exactLength.message, t), v(n, "maxItems", e.exactLength.value, e.exactLength.message, t)), n;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Zt(e, t) {
|
|
93
93
|
const n = {
|
|
94
94
|
type: "integer",
|
|
95
95
|
format: "int64"
|
|
@@ -99,31 +99,31 @@ function Nt(e, t) {
|
|
|
99
99
|
for (const a of e.checks)
|
|
100
100
|
switch (a.kind) {
|
|
101
101
|
case "min":
|
|
102
|
-
t.target === "jsonSchema7" ? a.inclusive ?
|
|
102
|
+
t.target === "jsonSchema7" ? a.inclusive ? v(n, "minimum", a.value, a.message, t) : v(n, "exclusiveMinimum", a.value, a.message, t) : (a.inclusive || (n.exclusiveMinimum = !0), v(n, "minimum", a.value, a.message, t));
|
|
103
103
|
break;
|
|
104
104
|
case "max":
|
|
105
|
-
t.target === "jsonSchema7" ? a.inclusive ?
|
|
105
|
+
t.target === "jsonSchema7" ? a.inclusive ? v(n, "maximum", a.value, a.message, t) : v(n, "exclusiveMaximum", a.value, a.message, t) : (a.inclusive || (n.exclusiveMaximum = !0), v(n, "maximum", a.value, a.message, t));
|
|
106
106
|
break;
|
|
107
107
|
case "multipleOf":
|
|
108
|
-
|
|
108
|
+
v(n, "multipleOf", a.value, a.message, t);
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
return n;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Lt() {
|
|
114
114
|
return {
|
|
115
115
|
type: "boolean"
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
118
|
+
function Fe(e, t) {
|
|
119
|
+
return w(e.type._def, t);
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const Rt = (e, t) => w(e.innerType._def, t);
|
|
122
|
+
function qe(e, t, n) {
|
|
123
123
|
const a = n ?? t.dateStrategy;
|
|
124
124
|
if (Array.isArray(a))
|
|
125
125
|
return {
|
|
126
|
-
anyOf: a.map((r, i) =>
|
|
126
|
+
anyOf: a.map((r, i) => qe(e, t, r))
|
|
127
127
|
};
|
|
128
128
|
switch (a) {
|
|
129
129
|
case "string":
|
|
@@ -138,10 +138,10 @@ function Fe(e, t, n) {
|
|
|
138
138
|
format: "date"
|
|
139
139
|
};
|
|
140
140
|
case "integer":
|
|
141
|
-
return
|
|
141
|
+
return Ut(e, t);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const Ut = (e, t) => {
|
|
145
145
|
const n = {
|
|
146
146
|
type: "integer",
|
|
147
147
|
format: "unix-time"
|
|
@@ -151,7 +151,7 @@ const Lt = (e, t) => {
|
|
|
151
151
|
for (const a of e.checks)
|
|
152
152
|
switch (a.kind) {
|
|
153
153
|
case "min":
|
|
154
|
-
|
|
154
|
+
v(
|
|
155
155
|
n,
|
|
156
156
|
"minimum",
|
|
157
157
|
a.value,
|
|
@@ -161,7 +161,7 @@ const Lt = (e, t) => {
|
|
|
161
161
|
);
|
|
162
162
|
break;
|
|
163
163
|
case "max":
|
|
164
|
-
|
|
164
|
+
v(
|
|
165
165
|
n,
|
|
166
166
|
"maximum",
|
|
167
167
|
a.value,
|
|
@@ -173,29 +173,29 @@ const Lt = (e, t) => {
|
|
|
173
173
|
}
|
|
174
174
|
return n;
|
|
175
175
|
};
|
|
176
|
-
function
|
|
176
|
+
function zt(e, t) {
|
|
177
177
|
return {
|
|
178
|
-
...
|
|
178
|
+
...w(e.innerType._def, t),
|
|
179
179
|
default: e.defaultValue()
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
return t.effectStrategy === "input" ?
|
|
182
|
+
function Bt(e, t) {
|
|
183
|
+
return t.effectStrategy === "input" ? w(e.schema._def, t) : A(t);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function Ft(e) {
|
|
186
186
|
return {
|
|
187
187
|
type: "string",
|
|
188
188
|
enum: Array.from(e.values)
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
const
|
|
192
|
-
function
|
|
191
|
+
const qt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
192
|
+
function Ht(e, t) {
|
|
193
193
|
const n = [
|
|
194
|
-
|
|
194
|
+
w(e.left._def, {
|
|
195
195
|
...t,
|
|
196
196
|
currentPath: [...t.currentPath, "allOf", "0"]
|
|
197
197
|
}),
|
|
198
|
-
|
|
198
|
+
w(e.right._def, {
|
|
199
199
|
...t,
|
|
200
200
|
currentPath: [...t.currentPath, "allOf", "1"]
|
|
201
201
|
})
|
|
@@ -203,7 +203,7 @@ function Ft(e, t) {
|
|
|
203
203
|
let a = t.target === "jsonSchema2019-09" ? { unevaluatedProperties: !1 } : void 0;
|
|
204
204
|
const r = [];
|
|
205
205
|
return n.forEach((i) => {
|
|
206
|
-
if (
|
|
206
|
+
if (qt(i))
|
|
207
207
|
r.push(...i.allOf), i.unevaluatedProperties === void 0 && (a = void 0);
|
|
208
208
|
else {
|
|
209
209
|
let s = i;
|
|
@@ -219,7 +219,7 @@ function Ft(e, t) {
|
|
|
219
219
|
...a
|
|
220
220
|
} : void 0;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Wt(e, t) {
|
|
223
223
|
const n = typeof e.value;
|
|
224
224
|
return n !== "bigint" && n !== "number" && n !== "boolean" && n !== "string" ? {
|
|
225
225
|
type: Array.isArray(e.value) ? "array" : "object"
|
|
@@ -231,7 +231,7 @@ function qt(e, t) {
|
|
|
231
231
|
const: e.value
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
let
|
|
234
|
+
let ce;
|
|
235
235
|
const T = {
|
|
236
236
|
/**
|
|
237
237
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
@@ -254,7 +254,7 @@ const T = {
|
|
|
254
254
|
* Fix in Zod:
|
|
255
255
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
256
256
|
*/
|
|
257
|
-
emoji: () => (
|
|
257
|
+
emoji: () => (ce === void 0 && (ce = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), ce),
|
|
258
258
|
/**
|
|
259
259
|
* Unused
|
|
260
260
|
*/
|
|
@@ -274,7 +274,7 @@ const T = {
|
|
|
274
274
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
275
275
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
276
276
|
};
|
|
277
|
-
function
|
|
277
|
+
function He(e, t) {
|
|
278
278
|
const n = {
|
|
279
279
|
type: "string"
|
|
280
280
|
};
|
|
@@ -282,18 +282,18 @@ function qe(e, t) {
|
|
|
282
282
|
for (const a of e.checks)
|
|
283
283
|
switch (a.kind) {
|
|
284
284
|
case "min":
|
|
285
|
-
|
|
285
|
+
v(n, "minLength", typeof n.minLength == "number" ? Math.max(n.minLength, a.value) : a.value, a.message, t);
|
|
286
286
|
break;
|
|
287
287
|
case "max":
|
|
288
|
-
|
|
288
|
+
v(n, "maxLength", typeof n.maxLength == "number" ? Math.min(n.maxLength, a.value) : a.value, a.message, t);
|
|
289
289
|
break;
|
|
290
290
|
case "email":
|
|
291
291
|
switch (t.emailStrategy) {
|
|
292
292
|
case "format:email":
|
|
293
|
-
|
|
293
|
+
_(n, "email", a.message, t);
|
|
294
294
|
break;
|
|
295
295
|
case "format:idn-email":
|
|
296
|
-
|
|
296
|
+
_(n, "idn-email", a.message, t);
|
|
297
297
|
break;
|
|
298
298
|
case "pattern:zod":
|
|
299
299
|
D(n, T.email, a.message, t);
|
|
@@ -301,10 +301,10 @@ function qe(e, t) {
|
|
|
301
301
|
}
|
|
302
302
|
break;
|
|
303
303
|
case "url":
|
|
304
|
-
|
|
304
|
+
_(n, "uri", a.message, t);
|
|
305
305
|
break;
|
|
306
306
|
case "uuid":
|
|
307
|
-
|
|
307
|
+
_(n, "uuid", a.message, t);
|
|
308
308
|
break;
|
|
309
309
|
case "regex":
|
|
310
310
|
D(n, a.regex, a.message, t);
|
|
@@ -316,32 +316,32 @@ function qe(e, t) {
|
|
|
316
316
|
D(n, T.cuid2, a.message, t);
|
|
317
317
|
break;
|
|
318
318
|
case "startsWith":
|
|
319
|
-
D(n, RegExp(`^${
|
|
319
|
+
D(n, RegExp(`^${ue(a.value, t)}`), a.message, t);
|
|
320
320
|
break;
|
|
321
321
|
case "endsWith":
|
|
322
|
-
D(n, RegExp(`${
|
|
322
|
+
D(n, RegExp(`${ue(a.value, t)}$`), a.message, t);
|
|
323
323
|
break;
|
|
324
324
|
case "datetime":
|
|
325
|
-
|
|
325
|
+
_(n, "date-time", a.message, t);
|
|
326
326
|
break;
|
|
327
327
|
case "date":
|
|
328
|
-
|
|
328
|
+
_(n, "date", a.message, t);
|
|
329
329
|
break;
|
|
330
330
|
case "time":
|
|
331
|
-
|
|
331
|
+
_(n, "time", a.message, t);
|
|
332
332
|
break;
|
|
333
333
|
case "duration":
|
|
334
|
-
|
|
334
|
+
_(n, "duration", a.message, t);
|
|
335
335
|
break;
|
|
336
336
|
case "length":
|
|
337
|
-
|
|
337
|
+
v(n, "minLength", typeof n.minLength == "number" ? Math.max(n.minLength, a.value) : a.value, a.message, t), v(n, "maxLength", typeof n.maxLength == "number" ? Math.min(n.maxLength, a.value) : a.value, a.message, t);
|
|
338
338
|
break;
|
|
339
339
|
case "includes": {
|
|
340
|
-
D(n, RegExp(
|
|
340
|
+
D(n, RegExp(ue(a.value, t)), a.message, t);
|
|
341
341
|
break;
|
|
342
342
|
}
|
|
343
343
|
case "ip": {
|
|
344
|
-
a.version !== "v6" &&
|
|
344
|
+
a.version !== "v6" && _(n, "ipv4", a.message, t), a.version !== "v4" && _(n, "ipv6", a.message, t);
|
|
345
345
|
break;
|
|
346
346
|
}
|
|
347
347
|
case "base64url":
|
|
@@ -364,11 +364,11 @@ function qe(e, t) {
|
|
|
364
364
|
case "base64": {
|
|
365
365
|
switch (t.base64Strategy) {
|
|
366
366
|
case "format:binary": {
|
|
367
|
-
|
|
367
|
+
_(n, "binary", a.message, t);
|
|
368
368
|
break;
|
|
369
369
|
}
|
|
370
370
|
case "contentEncoding:base64": {
|
|
371
|
-
|
|
371
|
+
v(n, "contentEncoding", "base64", a.message, t);
|
|
372
372
|
break;
|
|
373
373
|
}
|
|
374
374
|
case "pattern:zod": {
|
|
@@ -383,17 +383,17 @@ function qe(e, t) {
|
|
|
383
383
|
}
|
|
384
384
|
return n;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
return t.patternStrategy === "escape" ?
|
|
386
|
+
function ue(e, t) {
|
|
387
|
+
return t.patternStrategy === "escape" ? Jt(e) : e;
|
|
388
388
|
}
|
|
389
|
-
const
|
|
390
|
-
function
|
|
389
|
+
const Vt = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
390
|
+
function Jt(e) {
|
|
391
391
|
let t = "";
|
|
392
392
|
for (let n = 0; n < e.length; n++)
|
|
393
|
-
|
|
393
|
+
Vt.has(e[n]) || (t += "\\"), t += e[n];
|
|
394
394
|
return t;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function _(e, t, n, a) {
|
|
397
397
|
var r;
|
|
398
398
|
e.format || (r = e.anyOf) != null && r.some((i) => i.format) ? (e.anyOf || (e.anyOf = []), e.format && (e.anyOf.push({
|
|
399
399
|
format: e.format,
|
|
@@ -403,7 +403,7 @@ function x(e, t, n, a) {
|
|
|
403
403
|
}), delete e.format, e.errorMessage && (delete e.errorMessage.format, Object.keys(e.errorMessage).length === 0 && delete e.errorMessage)), e.anyOf.push({
|
|
404
404
|
format: t,
|
|
405
405
|
...n && a.errorMessages && { errorMessage: { format: n } }
|
|
406
|
-
})) :
|
|
406
|
+
})) : v(e, "format", t, n, a);
|
|
407
407
|
}
|
|
408
408
|
function D(e, t, n, a) {
|
|
409
409
|
var r;
|
|
@@ -413,11 +413,11 @@ function D(e, t, n, a) {
|
|
|
413
413
|
errorMessage: { pattern: e.errorMessage.pattern }
|
|
414
414
|
}
|
|
415
415
|
}), delete e.pattern, e.errorMessage && (delete e.errorMessage.pattern, Object.keys(e.errorMessage).length === 0 && delete e.errorMessage)), e.allOf.push({
|
|
416
|
-
pattern:
|
|
416
|
+
pattern: Pe(t, a),
|
|
417
417
|
...n && a.errorMessages && { errorMessage: { pattern: n } }
|
|
418
|
-
})) :
|
|
418
|
+
})) : v(e, "pattern", Pe(t, a), n, a);
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function Pe(e, t) {
|
|
421
421
|
var c;
|
|
422
422
|
if (!t.applyRegexFlags || !e.flags)
|
|
423
423
|
return e.source;
|
|
@@ -470,7 +470,7 @@ function Ce(e, t) {
|
|
|
470
470
|
}
|
|
471
471
|
return r;
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function We(e, t) {
|
|
474
474
|
var a, r, i, s, l, c;
|
|
475
475
|
if (t.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), t.target === "openApi3" && ((a = e.keyType) == null ? void 0 : a._def.typeName) === m.ZodEnum)
|
|
476
476
|
return {
|
|
@@ -478,16 +478,16 @@ function He(e, t) {
|
|
|
478
478
|
required: e.keyType._def.values,
|
|
479
479
|
properties: e.keyType._def.values.reduce((d, u) => ({
|
|
480
480
|
...d,
|
|
481
|
-
[u]:
|
|
481
|
+
[u]: w(e.valueType._def, {
|
|
482
482
|
...t,
|
|
483
483
|
currentPath: [...t.currentPath, "properties", u]
|
|
484
|
-
}) ??
|
|
484
|
+
}) ?? A(t)
|
|
485
485
|
}), {}),
|
|
486
486
|
additionalProperties: t.rejectedAdditionalProperties
|
|
487
487
|
};
|
|
488
488
|
const n = {
|
|
489
489
|
type: "object",
|
|
490
|
-
additionalProperties:
|
|
490
|
+
additionalProperties: w(e.valueType._def, {
|
|
491
491
|
...t,
|
|
492
492
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
493
493
|
}) ?? t.allowedAdditionalProperties
|
|
@@ -495,7 +495,7 @@ function He(e, t) {
|
|
|
495
495
|
if (t.target === "openApi3")
|
|
496
496
|
return n;
|
|
497
497
|
if (((r = e.keyType) == null ? void 0 : r._def.typeName) === m.ZodString && ((i = e.keyType._def.checks) != null && i.length)) {
|
|
498
|
-
const { type: d, ...u } =
|
|
498
|
+
const { type: d, ...u } = He(e.keyType._def, t);
|
|
499
499
|
return {
|
|
500
500
|
...n,
|
|
501
501
|
propertyNames: u
|
|
@@ -509,7 +509,7 @@ function He(e, t) {
|
|
|
509
509
|
}
|
|
510
510
|
};
|
|
511
511
|
if (((l = e.keyType) == null ? void 0 : l._def.typeName) === m.ZodBranded && e.keyType._def.type._def.typeName === m.ZodString && ((c = e.keyType._def.type._def.checks) != null && c.length)) {
|
|
512
|
-
const { type: d, ...u } =
|
|
512
|
+
const { type: d, ...u } = Fe(e.keyType._def, t);
|
|
513
513
|
return {
|
|
514
514
|
...n,
|
|
515
515
|
propertyNames: u
|
|
@@ -518,16 +518,16 @@ function He(e, t) {
|
|
|
518
518
|
}
|
|
519
519
|
return n;
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function Yt(e, t) {
|
|
522
522
|
if (t.mapStrategy === "record")
|
|
523
|
-
return
|
|
524
|
-
const n =
|
|
523
|
+
return We(e, t);
|
|
524
|
+
const n = w(e.keyType._def, {
|
|
525
525
|
...t,
|
|
526
526
|
currentPath: [...t.currentPath, "items", "items", "0"]
|
|
527
|
-
}) ||
|
|
527
|
+
}) || A(t), a = w(e.valueType._def, {
|
|
528
528
|
...t,
|
|
529
529
|
currentPath: [...t.currentPath, "items", "items", "1"]
|
|
530
|
-
}) ||
|
|
530
|
+
}) || A(t);
|
|
531
531
|
return {
|
|
532
532
|
type: "array",
|
|
533
533
|
maxItems: 125,
|
|
@@ -539,22 +539,22 @@ function Vt(e, t) {
|
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function Qt(e) {
|
|
543
543
|
const t = e.values, a = Object.keys(e.values).filter((i) => typeof t[t[i]] != "number").map((i) => t[i]), r = Array.from(new Set(a.map((i) => typeof i)));
|
|
544
544
|
return {
|
|
545
545
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
546
546
|
enum: a
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function Gt(e) {
|
|
550
550
|
return e.target === "openAi" ? void 0 : {
|
|
551
|
-
not:
|
|
551
|
+
not: A({
|
|
552
552
|
...e,
|
|
553
553
|
currentPath: [...e.currentPath, "not"]
|
|
554
554
|
})
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Xt(e) {
|
|
558
558
|
return e.target === "openApi3" ? {
|
|
559
559
|
enum: ["null"],
|
|
560
560
|
nullable: !0
|
|
@@ -562,20 +562,20 @@ function Gt(e) {
|
|
|
562
562
|
type: "null"
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
-
const
|
|
565
|
+
const K = {
|
|
566
566
|
ZodString: "string",
|
|
567
567
|
ZodNumber: "number",
|
|
568
568
|
ZodBigInt: "integer",
|
|
569
569
|
ZodBoolean: "boolean",
|
|
570
570
|
ZodNull: "null"
|
|
571
571
|
};
|
|
572
|
-
function
|
|
572
|
+
function Kt(e, t) {
|
|
573
573
|
if (t.target === "openApi3")
|
|
574
|
-
return
|
|
574
|
+
return Te(e, t);
|
|
575
575
|
const n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
576
|
-
if (n.every((a) => a._def.typeName in
|
|
576
|
+
if (n.every((a) => a._def.typeName in K && (!a._def.checks || !a._def.checks.length))) {
|
|
577
577
|
const a = n.reduce((r, i) => {
|
|
578
|
-
const s =
|
|
578
|
+
const s = K[i._def.typeName];
|
|
579
579
|
return s && !r.includes(s) ? [...r, s] : r;
|
|
580
580
|
}, []);
|
|
581
581
|
return {
|
|
@@ -616,40 +616,40 @@ function Qt(e, t) {
|
|
|
616
616
|
...r._def.values.filter((i) => !a.includes(i))
|
|
617
617
|
], [])
|
|
618
618
|
};
|
|
619
|
-
return
|
|
619
|
+
return Te(e, t);
|
|
620
620
|
}
|
|
621
|
-
const
|
|
622
|
-
const n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((a, r) =>
|
|
621
|
+
const Te = (e, t) => {
|
|
622
|
+
const n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((a, r) => w(a._def, {
|
|
623
623
|
...t,
|
|
624
624
|
currentPath: [...t.currentPath, "anyOf", `${r}`]
|
|
625
625
|
})).filter((a) => !!a && (!t.strictUnions || typeof a == "object" && Object.keys(a).length > 0));
|
|
626
626
|
return n.length ? { anyOf: n } : void 0;
|
|
627
627
|
};
|
|
628
|
-
function
|
|
628
|
+
function en(e, t) {
|
|
629
629
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length))
|
|
630
630
|
return t.target === "openApi3" ? {
|
|
631
|
-
type:
|
|
631
|
+
type: K[e.innerType._def.typeName],
|
|
632
632
|
nullable: !0
|
|
633
633
|
} : {
|
|
634
634
|
type: [
|
|
635
|
-
|
|
635
|
+
K[e.innerType._def.typeName],
|
|
636
636
|
"null"
|
|
637
637
|
]
|
|
638
638
|
};
|
|
639
639
|
if (t.target === "openApi3") {
|
|
640
|
-
const a =
|
|
640
|
+
const a = w(e.innerType._def, {
|
|
641
641
|
...t,
|
|
642
642
|
currentPath: [...t.currentPath]
|
|
643
643
|
});
|
|
644
644
|
return a && "$ref" in a ? { allOf: [a], nullable: !0 } : a && { ...a, nullable: !0 };
|
|
645
645
|
}
|
|
646
|
-
const n =
|
|
646
|
+
const n = w(e.innerType._def, {
|
|
647
647
|
...t,
|
|
648
648
|
currentPath: [...t.currentPath, "anyOf", "0"]
|
|
649
649
|
});
|
|
650
650
|
return n && { anyOf: [n, { type: "null" }] };
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function tn(e, t) {
|
|
653
653
|
const n = {
|
|
654
654
|
type: "number"
|
|
655
655
|
};
|
|
@@ -661,18 +661,18 @@ function Kt(e, t) {
|
|
|
661
661
|
n.type = "integer", ze(n, "type", a.message, t);
|
|
662
662
|
break;
|
|
663
663
|
case "min":
|
|
664
|
-
t.target === "jsonSchema7" ? a.inclusive ?
|
|
664
|
+
t.target === "jsonSchema7" ? a.inclusive ? v(n, "minimum", a.value, a.message, t) : v(n, "exclusiveMinimum", a.value, a.message, t) : (a.inclusive || (n.exclusiveMinimum = !0), v(n, "minimum", a.value, a.message, t));
|
|
665
665
|
break;
|
|
666
666
|
case "max":
|
|
667
|
-
t.target === "jsonSchema7" ? a.inclusive ?
|
|
667
|
+
t.target === "jsonSchema7" ? a.inclusive ? v(n, "maximum", a.value, a.message, t) : v(n, "exclusiveMaximum", a.value, a.message, t) : (a.inclusive || (n.exclusiveMaximum = !0), v(n, "maximum", a.value, a.message, t));
|
|
668
668
|
break;
|
|
669
669
|
case "multipleOf":
|
|
670
|
-
|
|
670
|
+
v(n, "multipleOf", a.value, a.message, t);
|
|
671
671
|
break;
|
|
672
672
|
}
|
|
673
673
|
return n;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function nn(e, t) {
|
|
676
676
|
const n = t.target === "openAi", a = {
|
|
677
677
|
type: "object",
|
|
678
678
|
properties: {}
|
|
@@ -681,9 +681,9 @@ function en(e, t) {
|
|
|
681
681
|
let c = i[l];
|
|
682
682
|
if (c === void 0 || c._def === void 0)
|
|
683
683
|
continue;
|
|
684
|
-
let d =
|
|
684
|
+
let d = rn(c);
|
|
685
685
|
d && n && (c._def.typeName === "ZodOptional" && (c = c._def.innerType), c.isNullable() || (c = c.nullable()), d = !1);
|
|
686
|
-
const u =
|
|
686
|
+
const u = w(c._def, {
|
|
687
687
|
...t,
|
|
688
688
|
currentPath: [...t.currentPath, "properties", l],
|
|
689
689
|
propertyPath: [...t.currentPath, "properties", l]
|
|
@@ -691,12 +691,12 @@ function en(e, t) {
|
|
|
691
691
|
u !== void 0 && (a.properties[l] = u, d || r.push(l));
|
|
692
692
|
}
|
|
693
693
|
r.length && (a.required = r);
|
|
694
|
-
const s =
|
|
694
|
+
const s = an(e, t);
|
|
695
695
|
return s !== void 0 && (a.additionalProperties = s), a;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function an(e, t) {
|
|
698
698
|
if (e.catchall._def.typeName !== "ZodNever")
|
|
699
|
-
return
|
|
699
|
+
return w(e.catchall._def, {
|
|
700
700
|
...t,
|
|
701
701
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
702
702
|
});
|
|
@@ -709,38 +709,38 @@ function tn(e, t) {
|
|
|
709
709
|
return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function rn(e) {
|
|
713
713
|
try {
|
|
714
714
|
return e.isOptional();
|
|
715
715
|
} catch {
|
|
716
716
|
return !0;
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
const
|
|
719
|
+
const on = (e, t) => {
|
|
720
720
|
var a;
|
|
721
721
|
if (t.currentPath.toString() === ((a = t.propertyPath) == null ? void 0 : a.toString()))
|
|
722
|
-
return
|
|
723
|
-
const n =
|
|
722
|
+
return w(e.innerType._def, t);
|
|
723
|
+
const n = w(e.innerType._def, {
|
|
724
724
|
...t,
|
|
725
725
|
currentPath: [...t.currentPath, "anyOf", "1"]
|
|
726
726
|
});
|
|
727
727
|
return n ? {
|
|
728
728
|
anyOf: [
|
|
729
729
|
{
|
|
730
|
-
not:
|
|
730
|
+
not: A(t)
|
|
731
731
|
},
|
|
732
732
|
n
|
|
733
733
|
]
|
|
734
|
-
} :
|
|
735
|
-
},
|
|
734
|
+
} : A(t);
|
|
735
|
+
}, sn = (e, t) => {
|
|
736
736
|
if (t.pipeStrategy === "input")
|
|
737
|
-
return
|
|
737
|
+
return w(e.in._def, t);
|
|
738
738
|
if (t.pipeStrategy === "output")
|
|
739
|
-
return
|
|
740
|
-
const n =
|
|
739
|
+
return w(e.out._def, t);
|
|
740
|
+
const n = w(e.in._def, {
|
|
741
741
|
...t,
|
|
742
742
|
currentPath: [...t.currentPath, "allOf", "0"]
|
|
743
|
-
}), a =
|
|
743
|
+
}), a = w(e.out._def, {
|
|
744
744
|
...t,
|
|
745
745
|
currentPath: [...t.currentPath, "allOf", n ? "1" : "0"]
|
|
746
746
|
});
|
|
@@ -748,29 +748,29 @@ const an = (e, t) => {
|
|
|
748
748
|
allOf: [n, a].filter((r) => r !== void 0)
|
|
749
749
|
};
|
|
750
750
|
};
|
|
751
|
-
function
|
|
752
|
-
return
|
|
751
|
+
function ln(e, t) {
|
|
752
|
+
return w(e.type._def, t);
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function cn(e, t) {
|
|
755
755
|
const a = {
|
|
756
756
|
type: "array",
|
|
757
757
|
uniqueItems: !0,
|
|
758
|
-
items:
|
|
758
|
+
items: w(e.valueType._def, {
|
|
759
759
|
...t,
|
|
760
760
|
currentPath: [...t.currentPath, "items"]
|
|
761
761
|
})
|
|
762
762
|
};
|
|
763
|
-
return e.minSize &&
|
|
763
|
+
return e.minSize && v(a, "minItems", e.minSize.value, e.minSize.message, t), e.maxSize && v(a, "maxItems", e.maxSize.value, e.maxSize.message, t), a;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function un(e, t) {
|
|
766
766
|
return e.rest ? {
|
|
767
767
|
type: "array",
|
|
768
768
|
minItems: e.items.length,
|
|
769
|
-
items: e.items.map((n, a) =>
|
|
769
|
+
items: e.items.map((n, a) => w(n._def, {
|
|
770
770
|
...t,
|
|
771
771
|
currentPath: [...t.currentPath, "items", `${a}`]
|
|
772
772
|
})).reduce((n, a) => a === void 0 ? n : [...n, a], []),
|
|
773
|
-
additionalItems:
|
|
773
|
+
additionalItems: w(e.rest._def, {
|
|
774
774
|
...t,
|
|
775
775
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
776
776
|
})
|
|
@@ -778,86 +778,86 @@ function ln(e, t) {
|
|
|
778
778
|
type: "array",
|
|
779
779
|
minItems: e.items.length,
|
|
780
780
|
maxItems: e.items.length,
|
|
781
|
-
items: e.items.map((n, a) =>
|
|
781
|
+
items: e.items.map((n, a) => w(n._def, {
|
|
782
782
|
...t,
|
|
783
783
|
currentPath: [...t.currentPath, "items", `${a}`]
|
|
784
784
|
})).reduce((n, a) => a === void 0 ? n : [...n, a], [])
|
|
785
785
|
};
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function dn(e) {
|
|
788
788
|
return {
|
|
789
|
-
not:
|
|
789
|
+
not: A(e)
|
|
790
790
|
};
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
return
|
|
792
|
+
function pn(e) {
|
|
793
|
+
return A(e);
|
|
794
794
|
}
|
|
795
|
-
const
|
|
795
|
+
const mn = (e, t) => w(e.innerType._def, t), hn = (e, t, n) => {
|
|
796
796
|
switch (t) {
|
|
797
797
|
case m.ZodString:
|
|
798
|
-
return
|
|
798
|
+
return He(e, n);
|
|
799
799
|
case m.ZodNumber:
|
|
800
|
-
return
|
|
800
|
+
return tn(e, n);
|
|
801
801
|
case m.ZodObject:
|
|
802
|
-
return
|
|
802
|
+
return nn(e, n);
|
|
803
803
|
case m.ZodBigInt:
|
|
804
|
-
return
|
|
804
|
+
return Zt(e, n);
|
|
805
805
|
case m.ZodBoolean:
|
|
806
|
-
return
|
|
806
|
+
return Lt();
|
|
807
807
|
case m.ZodDate:
|
|
808
|
-
return
|
|
808
|
+
return qe(e, n);
|
|
809
809
|
case m.ZodUndefined:
|
|
810
|
-
return
|
|
810
|
+
return dn(n);
|
|
811
811
|
case m.ZodNull:
|
|
812
|
-
return
|
|
812
|
+
return Xt(n);
|
|
813
813
|
case m.ZodArray:
|
|
814
|
-
return
|
|
814
|
+
return It(e, n);
|
|
815
815
|
case m.ZodUnion:
|
|
816
816
|
case m.ZodDiscriminatedUnion:
|
|
817
|
-
return
|
|
817
|
+
return Kt(e, n);
|
|
818
818
|
case m.ZodIntersection:
|
|
819
|
-
return
|
|
819
|
+
return Ht(e, n);
|
|
820
820
|
case m.ZodTuple:
|
|
821
|
-
return
|
|
821
|
+
return un(e, n);
|
|
822
822
|
case m.ZodRecord:
|
|
823
|
-
return
|
|
823
|
+
return We(e, n);
|
|
824
824
|
case m.ZodLiteral:
|
|
825
|
-
return
|
|
825
|
+
return Wt(e, n);
|
|
826
826
|
case m.ZodEnum:
|
|
827
|
-
return
|
|
827
|
+
return Ft(e);
|
|
828
828
|
case m.ZodNativeEnum:
|
|
829
|
-
return
|
|
829
|
+
return Qt(e);
|
|
830
830
|
case m.ZodNullable:
|
|
831
|
-
return
|
|
831
|
+
return en(e, n);
|
|
832
832
|
case m.ZodOptional:
|
|
833
|
-
return
|
|
833
|
+
return on(e, n);
|
|
834
834
|
case m.ZodMap:
|
|
835
|
-
return
|
|
835
|
+
return Yt(e, n);
|
|
836
836
|
case m.ZodSet:
|
|
837
|
-
return
|
|
837
|
+
return cn(e, n);
|
|
838
838
|
case m.ZodLazy:
|
|
839
839
|
return () => e.getter()._def;
|
|
840
840
|
case m.ZodPromise:
|
|
841
|
-
return
|
|
841
|
+
return ln(e, n);
|
|
842
842
|
case m.ZodNaN:
|
|
843
843
|
case m.ZodNever:
|
|
844
|
-
return
|
|
844
|
+
return Gt(n);
|
|
845
845
|
case m.ZodEffects:
|
|
846
|
-
return
|
|
846
|
+
return Bt(e, n);
|
|
847
847
|
case m.ZodAny:
|
|
848
|
-
return
|
|
848
|
+
return A(n);
|
|
849
849
|
case m.ZodUnknown:
|
|
850
|
-
return
|
|
850
|
+
return pn(n);
|
|
851
851
|
case m.ZodDefault:
|
|
852
|
-
return
|
|
852
|
+
return zt(e, n);
|
|
853
853
|
case m.ZodBranded:
|
|
854
|
-
return
|
|
854
|
+
return Fe(e, n);
|
|
855
855
|
case m.ZodReadonly:
|
|
856
|
-
return
|
|
856
|
+
return mn(e, n);
|
|
857
857
|
case m.ZodCatch:
|
|
858
|
-
return
|
|
858
|
+
return Rt(e, n);
|
|
859
859
|
case m.ZodPipeline:
|
|
860
|
-
return
|
|
860
|
+
return sn(e, n);
|
|
861
861
|
case m.ZodFunction:
|
|
862
862
|
case m.ZodVoid:
|
|
863
863
|
case m.ZodSymbol:
|
|
@@ -867,46 +867,46 @@ const dn = (e, t) => v(e.innerType._def, t), pn = (e, t, n) => {
|
|
|
867
867
|
})();
|
|
868
868
|
}
|
|
869
869
|
};
|
|
870
|
-
function
|
|
870
|
+
function w(e, t, n = !1) {
|
|
871
871
|
var l;
|
|
872
872
|
const a = t.seen.get(e);
|
|
873
873
|
if (t.override) {
|
|
874
874
|
const c = (l = t.override) == null ? void 0 : l.call(t, e, t, a, n);
|
|
875
|
-
if (c !==
|
|
875
|
+
if (c !== Et)
|
|
876
876
|
return c;
|
|
877
877
|
}
|
|
878
878
|
if (a && !n) {
|
|
879
|
-
const c =
|
|
879
|
+
const c = gn(a, t);
|
|
880
880
|
if (c !== void 0)
|
|
881
881
|
return c;
|
|
882
882
|
}
|
|
883
883
|
const r = { def: e, path: t.currentPath, jsonSchema: void 0 };
|
|
884
884
|
t.seen.set(e, r);
|
|
885
|
-
const i =
|
|
886
|
-
if (s &&
|
|
885
|
+
const i = hn(e, e.typeName, t), s = typeof i == "function" ? w(i(), t) : i;
|
|
886
|
+
if (s && fn(e, t, s), t.postProcess) {
|
|
887
887
|
const c = t.postProcess(s, e, t);
|
|
888
888
|
return r.jsonSchema = s, c;
|
|
889
889
|
}
|
|
890
890
|
return r.jsonSchema = s, s;
|
|
891
891
|
}
|
|
892
|
-
const
|
|
892
|
+
const gn = (e, t) => {
|
|
893
893
|
switch (t.$refStrategy) {
|
|
894
894
|
case "root":
|
|
895
895
|
return { $ref: e.path.join("/") };
|
|
896
896
|
case "relative":
|
|
897
|
-
return { $ref:
|
|
897
|
+
return { $ref: Be(t.currentPath, e.path) };
|
|
898
898
|
case "none":
|
|
899
899
|
case "seen":
|
|
900
|
-
return e.path.length < t.currentPath.length && e.path.every((n, a) => t.currentPath[a] === n) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),
|
|
900
|
+
return e.path.length < t.currentPath.length && e.path.every((n, a) => t.currentPath[a] === n) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), A(t)) : t.$refStrategy === "seen" ? A(t) : void 0;
|
|
901
901
|
}
|
|
902
|
-
},
|
|
903
|
-
const n =
|
|
902
|
+
}, fn = (e, t, n) => (e.description && (n.description = e.description, t.markdownDescription && (n.markdownDescription = e.description)), n), bn = (e, t) => {
|
|
903
|
+
const n = Nt(t);
|
|
904
904
|
let a;
|
|
905
|
-
const r = t == null ? void 0 : t.name, i =
|
|
905
|
+
const r = t == null ? void 0 : t.name, i = w(
|
|
906
906
|
e._def,
|
|
907
907
|
n,
|
|
908
908
|
!1
|
|
909
|
-
) ??
|
|
909
|
+
) ?? A(n);
|
|
910
910
|
n.flags.hasReferencedOpenAiAnyType && (a || (a = {}), a[n.openAiAnyTypeName] || (a[n.openAiAnyTypeName] = {
|
|
911
911
|
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
912
912
|
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
@@ -933,7 +933,7 @@ const mn = (e, t) => {
|
|
|
933
933
|
}
|
|
934
934
|
};
|
|
935
935
|
return n.target === "jsonSchema7" ? s.$schema = "http://json-schema.org/draft-07/schema#" : (n.target === "jsonSchema2019-09" || n.target === "openAi") && (s.$schema = "https://json-schema.org/draft/2019-09/schema#"), n.target === "openAi" && ("anyOf" in s || "oneOf" in s || "allOf" in s || "type" in s && Array.isArray(s.type)) && console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."), s;
|
|
936
|
-
},
|
|
936
|
+
}, _e = (e) => " ".repeat(e), X = (e, t) => {
|
|
937
937
|
let n = e;
|
|
938
938
|
for (; n instanceof o.ZodOptional || n instanceof o.ZodNullable; )
|
|
939
939
|
n = n.unwrap();
|
|
@@ -949,17 +949,17 @@ const mn = (e, t) => {
|
|
|
949
949
|
return !0;
|
|
950
950
|
}
|
|
951
951
|
return !1;
|
|
952
|
-
},
|
|
952
|
+
}, M = (e, t, n) => {
|
|
953
953
|
if (e instanceof o.ZodOptional)
|
|
954
954
|
return o.ZodOptional.create(
|
|
955
|
-
|
|
955
|
+
M(e.unwrap(), t, n)
|
|
956
956
|
);
|
|
957
957
|
if (e instanceof o.ZodNullable)
|
|
958
958
|
return o.ZodNullable.create(
|
|
959
|
-
|
|
959
|
+
M(e.unwrap(), t, n)
|
|
960
960
|
);
|
|
961
961
|
if (e instanceof o.ZodArray) {
|
|
962
|
-
const a =
|
|
962
|
+
const a = M(
|
|
963
963
|
e.element,
|
|
964
964
|
t,
|
|
965
965
|
n
|
|
@@ -968,7 +968,7 @@ const mn = (e, t) => {
|
|
|
968
968
|
}
|
|
969
969
|
if (e instanceof o.ZodUnion) {
|
|
970
970
|
const a = e.options.map(
|
|
971
|
-
(r) =>
|
|
971
|
+
(r) => M(r, t, n)
|
|
972
972
|
);
|
|
973
973
|
return o.ZodUnion.create(a);
|
|
974
974
|
}
|
|
@@ -979,7 +979,7 @@ const mn = (e, t) => {
|
|
|
979
979
|
if (t.includes(i))
|
|
980
980
|
a.push([i, s]);
|
|
981
981
|
else if (X(s, t)) {
|
|
982
|
-
const l =
|
|
982
|
+
const l = M(
|
|
983
983
|
s,
|
|
984
984
|
t,
|
|
985
985
|
n
|
|
@@ -987,7 +987,7 @@ const mn = (e, t) => {
|
|
|
987
987
|
a.push([i, l]);
|
|
988
988
|
}
|
|
989
989
|
} else if (!t.includes(i)) {
|
|
990
|
-
const l =
|
|
990
|
+
const l = M(
|
|
991
991
|
s,
|
|
992
992
|
t,
|
|
993
993
|
n
|
|
@@ -1000,13 +1000,13 @@ const mn = (e, t) => {
|
|
|
1000
1000
|
return o.ZodObject.create(r, e._def);
|
|
1001
1001
|
}
|
|
1002
1002
|
return e;
|
|
1003
|
-
},
|
|
1003
|
+
}, ye = (e, t) => M(e, t, "include"), yn = (e, t) => M(e, t, "exclude"), I = (e, t = 0, n, a) => e instanceof o.ZodOptional ? I(e.unwrap(), t) : e instanceof o.ZodNullable ? I(e.unwrap(), t) + " | null" : e instanceof o.ZodArray ? `Array<${I(e.element, t)}>${e.description ? ` - ${e.description}` : ""}` : e instanceof o.ZodObject ? `{
|
|
1004
1004
|
${Object.entries(e.shape).map(
|
|
1005
|
-
([i, s]) => `${
|
|
1005
|
+
([i, s]) => `${_e(t + 1)}${i}${s.isOptional() ? "?" : ""}: ${I(s, t + 1, i, s.isOptional())}${s.description ? ` - ${s.description}` : ""}`
|
|
1006
1006
|
).join(`,
|
|
1007
1007
|
`)}
|
|
1008
|
-
${
|
|
1009
|
-
function
|
|
1008
|
+
${_e(t)}}` + (e.description ? ` - ${e.description}` : "") : e instanceof o.ZodEnum ? e.options.map((i) => `"${i}"`).join(" | ") + (e.description ? ` - ${e.description}` : "") : e instanceof o.ZodUnion ? e.options.map((r) => I(r, t)).join(" | ") : e instanceof o.ZodLiteral ? JSON.stringify(e.value) : e instanceof o.ZodString ? "string" : e instanceof o.ZodNumber ? "number" : e instanceof o.ZodBoolean ? "boolean" : "any";
|
|
1009
|
+
function wn({
|
|
1010
1010
|
function: e,
|
|
1011
1011
|
schema: t,
|
|
1012
1012
|
description: n = "",
|
|
@@ -1020,7 +1020,7 @@ function bn({
|
|
|
1020
1020
|
name: a ?? e.name,
|
|
1021
1021
|
description: n,
|
|
1022
1022
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1023
|
-
parameters:
|
|
1023
|
+
parameters: bn(t),
|
|
1024
1024
|
strict: r,
|
|
1025
1025
|
parse(i) {
|
|
1026
1026
|
const s = JSON.parse(i);
|
|
@@ -1029,7 +1029,7 @@ function bn({
|
|
|
1029
1029
|
}
|
|
1030
1030
|
};
|
|
1031
1031
|
}
|
|
1032
|
-
const
|
|
1032
|
+
const Ve = o.enum(["bar", "column", "area", "line", "polar"]), Je = o.enum(["pie", "funnel", "treemap", "sunburst"]), vn = o.enum([
|
|
1033
1033
|
"scatter",
|
|
1034
1034
|
"table",
|
|
1035
1035
|
"indicator",
|
|
@@ -1037,20 +1037,20 @@ const We = o.enum(["bar", "column", "area", "line", "polar"]), Ve = o.enum(["pie
|
|
|
1037
1037
|
"areamap",
|
|
1038
1038
|
"scattermap",
|
|
1039
1039
|
"arearange"
|
|
1040
|
-
]),
|
|
1041
|
-
...We.options,
|
|
1040
|
+
]), re = o.enum([
|
|
1042
1041
|
...Ve.options,
|
|
1043
|
-
...
|
|
1044
|
-
|
|
1045
|
-
|
|
1042
|
+
...Je.options,
|
|
1043
|
+
...vn.options
|
|
1044
|
+
]), Sn = o.object({
|
|
1045
|
+
type: Ve,
|
|
1046
1046
|
category: o.array(o.number()),
|
|
1047
1047
|
value: o.array(o.number()),
|
|
1048
1048
|
breakBy: o.array(o.number())
|
|
1049
|
-
}).strict(),
|
|
1050
|
-
type:
|
|
1049
|
+
}).strict(), On = o.object({
|
|
1050
|
+
type: Je,
|
|
1051
1051
|
category: o.array(o.number()),
|
|
1052
1052
|
value: o.array(o.number())
|
|
1053
|
-
}).strict(),
|
|
1053
|
+
}).strict(), Cn = o.object({
|
|
1054
1054
|
type: o.literal("scatter"),
|
|
1055
1055
|
x: o.array(o.number()),
|
|
1056
1056
|
y: o.array(o.number()),
|
|
@@ -1058,7 +1058,7 @@ const We = o.enum(["bar", "column", "area", "line", "polar"]), Ve = o.enum(["pie
|
|
|
1058
1058
|
breakByColor: o.array(o.number()),
|
|
1059
1059
|
size: o.array(o.number())
|
|
1060
1060
|
// showLegend: z.boolean(),
|
|
1061
|
-
}).strict(),
|
|
1061
|
+
}).strict(), Dn = o.object({
|
|
1062
1062
|
type: o.literal("table"),
|
|
1063
1063
|
columns: o.array(o.number()),
|
|
1064
1064
|
pagination: o.boolean(),
|
|
@@ -1068,13 +1068,13 @@ const We = o.enum(["bar", "column", "area", "line", "polar"]), Ve = o.enum(["pie
|
|
|
1068
1068
|
category: o.array(o.number()),
|
|
1069
1069
|
value: o.array(o.number()),
|
|
1070
1070
|
breakBy: o.array(o.number())
|
|
1071
|
-
}).strict(),
|
|
1071
|
+
}).strict(), Pn = o.object({
|
|
1072
1072
|
type: o.literal("indicator"),
|
|
1073
1073
|
value: o.array(o.number()),
|
|
1074
1074
|
secondary: o.array(o.number()),
|
|
1075
1075
|
min: o.array(o.number()),
|
|
1076
1076
|
max: o.array(o.number())
|
|
1077
|
-
}).strict(),
|
|
1077
|
+
}).strict(), Tn = o.object({
|
|
1078
1078
|
type: o.literal("boxplot"),
|
|
1079
1079
|
category: o.array(o.number()),
|
|
1080
1080
|
value: o.array(o.number()),
|
|
@@ -1084,31 +1084,31 @@ const We = o.enum(["bar", "column", "area", "line", "polar"]), Ve = o.enum(["pie
|
|
|
1084
1084
|
type: o.literal("areamap"),
|
|
1085
1085
|
geo: o.array(o.number()),
|
|
1086
1086
|
color: o.array(o.number())
|
|
1087
|
-
}).strict(),
|
|
1087
|
+
}).strict(), xn = o.object({
|
|
1088
1088
|
type: o.literal("scattermap"),
|
|
1089
1089
|
geo: o.array(o.number()),
|
|
1090
1090
|
size: o.array(o.number()),
|
|
1091
1091
|
colorBy: o.array(o.number()),
|
|
1092
1092
|
details: o.array(o.number()),
|
|
1093
1093
|
locationLevel: o.enum(["auto", "country", "state", "city"])
|
|
1094
|
-
}).strict(),
|
|
1095
|
-
vn,
|
|
1096
|
-
wn,
|
|
1094
|
+
}).strict(), $n = o.discriminatedUnion("type", [
|
|
1097
1095
|
Sn,
|
|
1098
1096
|
On,
|
|
1099
|
-
An,
|
|
1100
|
-
Dn,
|
|
1101
1097
|
Cn,
|
|
1098
|
+
Dn,
|
|
1099
|
+
An,
|
|
1100
|
+
Pn,
|
|
1101
|
+
Tn,
|
|
1102
1102
|
_n,
|
|
1103
|
-
|
|
1104
|
-
]),
|
|
1103
|
+
xn
|
|
1104
|
+
]), jn = re.nullable().describe(
|
|
1105
1105
|
"If the user prompt does not specify a known chart type, pass null; otherwise, pass the specified chart type"
|
|
1106
|
-
),
|
|
1106
|
+
), En = o.string().describe(
|
|
1107
1107
|
'The ID of the chart to update. If not provided, use value "chart_id_placeholder"'
|
|
1108
|
-
).default("chart_id_placeholder"),
|
|
1109
|
-
chartType:
|
|
1110
|
-
axesMapping:
|
|
1111
|
-
}),
|
|
1108
|
+
).default("chart_id_placeholder"), kn = o.object({
|
|
1109
|
+
chartType: re,
|
|
1110
|
+
axesMapping: $n
|
|
1111
|
+
}), ni = o.object({
|
|
1112
1112
|
dataSourceTitle: o.string().describe("Data source title"),
|
|
1113
1113
|
userPrompt: o.string().describe(
|
|
1114
1114
|
`Combined natural language user prompt describing multiple actions on a chart. Do not split the user prompt into multiple requests.
|
|
@@ -1117,21 +1117,21 @@ When responding to changes involving an existing chart:
|
|
|
1117
1117
|
- If the prompt involves **enhancing** how existing fields are displayed (e.g., "show cost on the right axis", "add trend line", "change color", "adjust scale"), apply the changes **to the existing chart**.
|
|
1118
1118
|
`
|
|
1119
1119
|
)
|
|
1120
|
-
}),
|
|
1120
|
+
}), Ye = o.object({
|
|
1121
1121
|
userPrompt: o.string().describe(
|
|
1122
1122
|
"Natural language user prompt describing a single action on a chart"
|
|
1123
1123
|
)
|
|
1124
|
-
}),
|
|
1125
|
-
chartType:
|
|
1124
|
+
}), Mn = Ye.extend({
|
|
1125
|
+
chartType: jn,
|
|
1126
1126
|
chartTitle: o.string().describe("The new chart title")
|
|
1127
|
-
}),
|
|
1128
|
-
chartId:
|
|
1129
|
-
}),
|
|
1127
|
+
}), Z = Ye.extend({
|
|
1128
|
+
chartId: En
|
|
1129
|
+
}), Nn = Z.extend({
|
|
1130
1130
|
chartTitle: o.string().describe("The new chart title")
|
|
1131
|
-
}),
|
|
1132
|
-
chartType:
|
|
1133
|
-
}),
|
|
1134
|
-
let
|
|
1131
|
+
}), In = Z.extend({
|
|
1132
|
+
chartType: re
|
|
1133
|
+
}), Zn = Z, Ln = Z, Rn = Z, Un = Z, zn = Z;
|
|
1134
|
+
let Bn = (e) => crypto.getRandomValues(new Uint8Array(e)), Fn = (e, t, n) => {
|
|
1135
1135
|
let a = (2 << Math.log2(e.length - 1)) - 1, r = -~(1.6 * a * t / e.length);
|
|
1136
1136
|
return (i = t) => {
|
|
1137
1137
|
let s = "";
|
|
@@ -1141,13 +1141,13 @@ let zn = (e) => crypto.getRandomValues(new Uint8Array(e)), Un = (e, t, n) => {
|
|
|
1141
1141
|
if (s += e[l[c] & a] || "", s.length >= i) return s;
|
|
1142
1142
|
}
|
|
1143
1143
|
};
|
|
1144
|
-
},
|
|
1145
|
-
const
|
|
1146
|
-
function
|
|
1147
|
-
const t =
|
|
1144
|
+
}, Qe = (e, t = 21) => Fn(e, t | 0, Bn);
|
|
1145
|
+
const W = Qe("0123456789abcdef", 24);
|
|
1146
|
+
function ee() {
|
|
1147
|
+
const t = Qe("0123456789abcdef", 32)();
|
|
1148
1148
|
return t.substring(0, 8) + "-" + t.substring(8, 12) + "-4" + t.substring(13, 16) + "-" + (parseInt(t[16], 16) & 3 | 8).toString(16) + t.substring(17, 20) + "-" + t.substring(20);
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function qn(e, t) {
|
|
1151
1151
|
const n = { ...e };
|
|
1152
1152
|
return Object.defineProperties(n, {
|
|
1153
1153
|
$brand: {
|
|
@@ -1160,7 +1160,7 @@ function Bn(e, t) {
|
|
|
1160
1160
|
}
|
|
1161
1161
|
}), n;
|
|
1162
1162
|
}
|
|
1163
|
-
const
|
|
1163
|
+
const Hn = Symbol("Let zodToJsonSchema decide on which parser to use"), xe = {
|
|
1164
1164
|
name: void 0,
|
|
1165
1165
|
$refStrategy: "root",
|
|
1166
1166
|
effectStrategy: "input",
|
|
@@ -1179,26 +1179,26 @@ const Fn = Symbol("Let zodToJsonSchema decide on which parser to use"), Te = {
|
|
|
1179
1179
|
emailStrategy: "format:email",
|
|
1180
1180
|
base64Strategy: "contentEncoding:base64",
|
|
1181
1181
|
nameStrategy: "ref"
|
|
1182
|
-
},
|
|
1183
|
-
...
|
|
1182
|
+
}, Wn = (e) => typeof e == "string" ? {
|
|
1183
|
+
...xe,
|
|
1184
1184
|
basePath: ["#"],
|
|
1185
1185
|
definitions: {},
|
|
1186
1186
|
name: e
|
|
1187
1187
|
} : {
|
|
1188
|
-
...
|
|
1188
|
+
...xe,
|
|
1189
1189
|
basePath: ["#"],
|
|
1190
1190
|
definitions: {},
|
|
1191
1191
|
...e
|
|
1192
1192
|
}, he = (e) => "_def" in e ? e._def : e;
|
|
1193
|
-
function
|
|
1193
|
+
function Vn(e) {
|
|
1194
1194
|
if (!e)
|
|
1195
1195
|
return !0;
|
|
1196
1196
|
for (const t in e)
|
|
1197
1197
|
return !1;
|
|
1198
1198
|
return !0;
|
|
1199
1199
|
}
|
|
1200
|
-
const
|
|
1201
|
-
const t =
|
|
1200
|
+
const Jn = (e) => {
|
|
1201
|
+
const t = Wn(e), n = t.name !== void 0 ? [...t.basePath, t.definitionPath, t.name] : t.basePath;
|
|
1202
1202
|
return {
|
|
1203
1203
|
...t,
|
|
1204
1204
|
currentPath: n,
|
|
@@ -1224,20 +1224,20 @@ function Ge(e, t, n, a) {
|
|
|
1224
1224
|
function S(e, t, n, a, r) {
|
|
1225
1225
|
e[t] = n, Ge(e, t, a, r);
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1227
|
+
function Yn() {
|
|
1228
1228
|
return {};
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function Qn(e, t) {
|
|
1231
1231
|
var a, r;
|
|
1232
1232
|
const n = {
|
|
1233
1233
|
type: "array"
|
|
1234
1234
|
};
|
|
1235
|
-
return ((r = (a = e.type) == null ? void 0 : a._def) == null ? void 0 : r.typeName) !==
|
|
1235
|
+
return ((r = (a = e.type) == null ? void 0 : a._def) == null ? void 0 : r.typeName) !== f.ZodAny && (n.items = y(e.type._def, {
|
|
1236
1236
|
...t,
|
|
1237
1237
|
currentPath: [...t.currentPath, "items"]
|
|
1238
1238
|
})), e.minLength && S(n, "minItems", e.minLength.value, e.minLength.message, t), e.maxLength && S(n, "maxItems", e.maxLength.value, e.maxLength.message, t), e.exactLength && (S(n, "minItems", e.exactLength.value, e.exactLength.message, t), S(n, "maxItems", e.exactLength.value, e.exactLength.message, t)), n;
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1240
|
+
function Gn(e, t) {
|
|
1241
1241
|
const n = {
|
|
1242
1242
|
type: "integer",
|
|
1243
1243
|
format: "int64"
|
|
@@ -1258,20 +1258,20 @@ function Yn(e, t) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
return n;
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function Xn() {
|
|
1262
1262
|
return {
|
|
1263
1263
|
type: "boolean"
|
|
1264
1264
|
};
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1266
|
+
function Kn(e, t) {
|
|
1267
1267
|
return y(e.type._def, t);
|
|
1268
1268
|
}
|
|
1269
|
-
const
|
|
1270
|
-
function
|
|
1269
|
+
const ea = (e, t) => y(e.innerType._def, t);
|
|
1270
|
+
function Xe(e, t, n) {
|
|
1271
1271
|
const a = n ?? t.dateStrategy;
|
|
1272
1272
|
if (Array.isArray(a))
|
|
1273
1273
|
return {
|
|
1274
|
-
anyOf: a.map((r, i) =>
|
|
1274
|
+
anyOf: a.map((r, i) => Xe(e, t, r))
|
|
1275
1275
|
};
|
|
1276
1276
|
switch (a) {
|
|
1277
1277
|
case "string":
|
|
@@ -1286,10 +1286,10 @@ function Qe(e, t, n) {
|
|
|
1286
1286
|
format: "date"
|
|
1287
1287
|
};
|
|
1288
1288
|
case "integer":
|
|
1289
|
-
return
|
|
1289
|
+
return ta(e, t);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
const
|
|
1292
|
+
const ta = (e, t) => {
|
|
1293
1293
|
const n = {
|
|
1294
1294
|
type: "integer",
|
|
1295
1295
|
format: "unix-time"
|
|
@@ -1321,23 +1321,23 @@ const Kn = (e, t) => {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
return n;
|
|
1323
1323
|
};
|
|
1324
|
-
function
|
|
1324
|
+
function na(e, t) {
|
|
1325
1325
|
return {
|
|
1326
1326
|
...y(e.innerType._def, t),
|
|
1327
1327
|
default: e.defaultValue()
|
|
1328
1328
|
};
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1330
|
+
function aa(e, t, n) {
|
|
1331
1331
|
return t.effectStrategy === "input" ? y(e.schema._def, t, n) : {};
|
|
1332
1332
|
}
|
|
1333
|
-
function
|
|
1333
|
+
function ra(e) {
|
|
1334
1334
|
return {
|
|
1335
1335
|
type: "string",
|
|
1336
1336
|
enum: [...e.values]
|
|
1337
1337
|
};
|
|
1338
1338
|
}
|
|
1339
|
-
const
|
|
1340
|
-
function
|
|
1339
|
+
const oa = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
1340
|
+
function ia(e, t) {
|
|
1341
1341
|
const n = [
|
|
1342
1342
|
y(e.left._def, {
|
|
1343
1343
|
...t,
|
|
@@ -1351,7 +1351,7 @@ function ra(e, t) {
|
|
|
1351
1351
|
let a = t.target === "jsonSchema2019-09" ? { unevaluatedProperties: !1 } : void 0;
|
|
1352
1352
|
const r = [];
|
|
1353
1353
|
return n.forEach((i) => {
|
|
1354
|
-
if (
|
|
1354
|
+
if (oa(i))
|
|
1355
1355
|
r.push(...i.allOf), i.unevaluatedProperties === void 0 && (a = void 0);
|
|
1356
1356
|
else {
|
|
1357
1357
|
let s = i;
|
|
@@ -1367,7 +1367,7 @@ function ra(e, t) {
|
|
|
1367
1367
|
...a
|
|
1368
1368
|
} : void 0;
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function sa(e, t) {
|
|
1371
1371
|
const n = typeof e.value;
|
|
1372
1372
|
return n !== "bigint" && n !== "number" && n !== "boolean" && n !== "string" ? {
|
|
1373
1373
|
type: Array.isArray(e.value) ? "array" : "object"
|
|
@@ -1380,7 +1380,7 @@ function oa(e, t) {
|
|
|
1380
1380
|
};
|
|
1381
1381
|
}
|
|
1382
1382
|
let de;
|
|
1383
|
-
const
|
|
1383
|
+
const N = {
|
|
1384
1384
|
/**
|
|
1385
1385
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
1386
1386
|
*/
|
|
@@ -1406,12 +1406,12 @@ const I = {
|
|
|
1406
1406
|
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
1407
1407
|
nanoid: /^[a-zA-Z0-9_-]{21}$/
|
|
1408
1408
|
};
|
|
1409
|
-
function
|
|
1409
|
+
function Ke(e, t) {
|
|
1410
1410
|
const n = {
|
|
1411
1411
|
type: "string"
|
|
1412
1412
|
};
|
|
1413
1413
|
function a(r) {
|
|
1414
|
-
return t.patternStrategy === "escape" ?
|
|
1414
|
+
return t.patternStrategy === "escape" ? la(r) : r;
|
|
1415
1415
|
}
|
|
1416
1416
|
if (e.checks)
|
|
1417
1417
|
for (const r of e.checks)
|
|
@@ -1425,71 +1425,71 @@ function Xe(e, t) {
|
|
|
1425
1425
|
case "email":
|
|
1426
1426
|
switch (t.emailStrategy) {
|
|
1427
1427
|
case "format:email":
|
|
1428
|
-
|
|
1428
|
+
x(n, "email", r.message, t);
|
|
1429
1429
|
break;
|
|
1430
1430
|
case "format:idn-email":
|
|
1431
|
-
|
|
1431
|
+
x(n, "idn-email", r.message, t);
|
|
1432
1432
|
break;
|
|
1433
1433
|
case "pattern:zod":
|
|
1434
|
-
|
|
1434
|
+
$(n, N.email, r.message, t);
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
1437
|
break;
|
|
1438
1438
|
case "url":
|
|
1439
|
-
|
|
1439
|
+
x(n, "uri", r.message, t);
|
|
1440
1440
|
break;
|
|
1441
1441
|
case "uuid":
|
|
1442
|
-
|
|
1442
|
+
x(n, "uuid", r.message, t);
|
|
1443
1443
|
break;
|
|
1444
1444
|
case "regex":
|
|
1445
|
-
|
|
1445
|
+
$(n, r.regex, r.message, t);
|
|
1446
1446
|
break;
|
|
1447
1447
|
case "cuid":
|
|
1448
|
-
|
|
1448
|
+
$(n, N.cuid, r.message, t);
|
|
1449
1449
|
break;
|
|
1450
1450
|
case "cuid2":
|
|
1451
|
-
|
|
1451
|
+
$(n, N.cuid2, r.message, t);
|
|
1452
1452
|
break;
|
|
1453
1453
|
case "startsWith":
|
|
1454
|
-
|
|
1454
|
+
$(n, RegExp(`^${a(r.value)}`), r.message, t);
|
|
1455
1455
|
break;
|
|
1456
1456
|
case "endsWith":
|
|
1457
|
-
|
|
1457
|
+
$(n, RegExp(`${a(r.value)}$`), r.message, t);
|
|
1458
1458
|
break;
|
|
1459
1459
|
case "datetime":
|
|
1460
|
-
|
|
1460
|
+
x(n, "date-time", r.message, t);
|
|
1461
1461
|
break;
|
|
1462
1462
|
case "date":
|
|
1463
|
-
|
|
1463
|
+
x(n, "date", r.message, t);
|
|
1464
1464
|
break;
|
|
1465
1465
|
case "time":
|
|
1466
|
-
|
|
1466
|
+
x(n, "time", r.message, t);
|
|
1467
1467
|
break;
|
|
1468
1468
|
case "duration":
|
|
1469
|
-
|
|
1469
|
+
x(n, "duration", r.message, t);
|
|
1470
1470
|
break;
|
|
1471
1471
|
case "length":
|
|
1472
1472
|
S(n, "minLength", typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, r.message, t), S(n, "maxLength", typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value, r.message, t);
|
|
1473
1473
|
break;
|
|
1474
1474
|
case "includes": {
|
|
1475
|
-
|
|
1475
|
+
$(n, RegExp(a(r.value)), r.message, t);
|
|
1476
1476
|
break;
|
|
1477
1477
|
}
|
|
1478
1478
|
case "ip": {
|
|
1479
|
-
r.version !== "v6" &&
|
|
1479
|
+
r.version !== "v6" && x(n, "ipv4", r.message, t), r.version !== "v4" && x(n, "ipv6", r.message, t);
|
|
1480
1480
|
break;
|
|
1481
1481
|
}
|
|
1482
1482
|
case "emoji":
|
|
1483
|
-
|
|
1483
|
+
$(n, N.emoji, r.message, t);
|
|
1484
1484
|
break;
|
|
1485
1485
|
case "ulid": {
|
|
1486
|
-
|
|
1486
|
+
$(n, N.ulid, r.message, t);
|
|
1487
1487
|
break;
|
|
1488
1488
|
}
|
|
1489
1489
|
case "base64": {
|
|
1490
1490
|
switch (t.base64Strategy) {
|
|
1491
1491
|
case "format:binary": {
|
|
1492
|
-
|
|
1492
|
+
x(n, "binary", r.message, t);
|
|
1493
1493
|
break;
|
|
1494
1494
|
}
|
|
1495
1495
|
case "contentEncoding:base64": {
|
|
@@ -1497,18 +1497,18 @@ function Xe(e, t) {
|
|
|
1497
1497
|
break;
|
|
1498
1498
|
}
|
|
1499
1499
|
case "pattern:zod": {
|
|
1500
|
-
|
|
1500
|
+
$(n, N.base64, r.message, t);
|
|
1501
1501
|
break;
|
|
1502
1502
|
}
|
|
1503
1503
|
}
|
|
1504
1504
|
break;
|
|
1505
1505
|
}
|
|
1506
1506
|
case "nanoid":
|
|
1507
|
-
|
|
1507
|
+
$(n, N.nanoid, r.message, t);
|
|
1508
1508
|
}
|
|
1509
1509
|
return n;
|
|
1510
1510
|
}
|
|
1511
|
-
const
|
|
1511
|
+
const la = (e) => Array.from(e).map((t) => /[a-zA-Z0-9]/.test(t) ? t : `\\${t}`).join(""), x = (e, t, n, a) => {
|
|
1512
1512
|
var r;
|
|
1513
1513
|
e.format || (r = e.anyOf) != null && r.some((i) => i.format) ? (e.anyOf || (e.anyOf = []), e.format && (e.anyOf.push({
|
|
1514
1514
|
format: e.format,
|
|
@@ -1519,7 +1519,7 @@ const ia = (e) => Array.from(e).map((t) => /[a-zA-Z0-9]/.test(t) ? t : `\\${t}`)
|
|
|
1519
1519
|
format: t,
|
|
1520
1520
|
...n && a.errorMessages && { errorMessage: { format: n } }
|
|
1521
1521
|
})) : S(e, "format", t, n, a);
|
|
1522
|
-
},
|
|
1522
|
+
}, $ = (e, t, n, a) => {
|
|
1523
1523
|
var r;
|
|
1524
1524
|
e.pattern || (r = e.allOf) != null && r.some((i) => i.pattern) ? (e.allOf || (e.allOf = []), e.pattern && (e.allOf.push({
|
|
1525
1525
|
pattern: e.pattern,
|
|
@@ -1527,10 +1527,10 @@ const ia = (e) => Array.from(e).map((t) => /[a-zA-Z0-9]/.test(t) ? t : `\\${t}`)
|
|
|
1527
1527
|
errorMessage: { pattern: e.errorMessage.pattern }
|
|
1528
1528
|
}
|
|
1529
1529
|
}), delete e.pattern, e.errorMessage && (delete e.errorMessage.pattern, Object.keys(e.errorMessage).length === 0 && delete e.errorMessage)), e.allOf.push({
|
|
1530
|
-
pattern:
|
|
1530
|
+
pattern: $e(t, a),
|
|
1531
1531
|
...n && a.errorMessages && { errorMessage: { pattern: n } }
|
|
1532
|
-
})) : S(e, "pattern",
|
|
1533
|
-
},
|
|
1532
|
+
})) : S(e, "pattern", $e(t, a), n, a);
|
|
1533
|
+
}, $e = (e, t) => {
|
|
1534
1534
|
var d;
|
|
1535
1535
|
const n = typeof e == "function" ? e() : e;
|
|
1536
1536
|
if (!t.applyRegexFlags || !n.flags)
|
|
@@ -1584,9 +1584,9 @@ const ia = (e) => Array.from(e).map((t) => /[a-zA-Z0-9]/.test(t) ? t : `\\${t}`)
|
|
|
1584
1584
|
}
|
|
1585
1585
|
return i;
|
|
1586
1586
|
};
|
|
1587
|
-
function
|
|
1587
|
+
function et(e, t) {
|
|
1588
1588
|
var a, r, i, s;
|
|
1589
|
-
if (t.target === "openApi3" && ((a = e.keyType) == null ? void 0 : a._def.typeName) ===
|
|
1589
|
+
if (t.target === "openApi3" && ((a = e.keyType) == null ? void 0 : a._def.typeName) === f.ZodEnum)
|
|
1590
1590
|
return {
|
|
1591
1591
|
type: "object",
|
|
1592
1592
|
required: e.keyType._def.values,
|
|
@@ -1608,13 +1608,13 @@ function Ke(e, t) {
|
|
|
1608
1608
|
};
|
|
1609
1609
|
if (t.target === "openApi3")
|
|
1610
1610
|
return n;
|
|
1611
|
-
if (((r = e.keyType) == null ? void 0 : r._def.typeName) ===
|
|
1612
|
-
const l = Object.entries(
|
|
1611
|
+
if (((r = e.keyType) == null ? void 0 : r._def.typeName) === f.ZodString && ((i = e.keyType._def.checks) != null && i.length)) {
|
|
1612
|
+
const l = Object.entries(Ke(e.keyType._def, t)).reduce((c, [d, u]) => d === "type" ? c : { ...c, [d]: u }, {});
|
|
1613
1613
|
return {
|
|
1614
1614
|
...n,
|
|
1615
1615
|
propertyNames: l
|
|
1616
1616
|
};
|
|
1617
|
-
} else if (((s = e.keyType) == null ? void 0 : s._def.typeName) ===
|
|
1617
|
+
} else if (((s = e.keyType) == null ? void 0 : s._def.typeName) === f.ZodEnum)
|
|
1618
1618
|
return {
|
|
1619
1619
|
...n,
|
|
1620
1620
|
propertyNames: {
|
|
@@ -1623,9 +1623,9 @@ function Ke(e, t) {
|
|
|
1623
1623
|
};
|
|
1624
1624
|
return n;
|
|
1625
1625
|
}
|
|
1626
|
-
function
|
|
1626
|
+
function ca(e, t) {
|
|
1627
1627
|
if (t.mapStrategy === "record")
|
|
1628
|
-
return
|
|
1628
|
+
return et(e, t);
|
|
1629
1629
|
const n = y(e.keyType._def, {
|
|
1630
1630
|
...t,
|
|
1631
1631
|
currentPath: [...t.currentPath, "items", "items", "0"]
|
|
@@ -1644,19 +1644,19 @@ function sa(e, t) {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
};
|
|
1646
1646
|
}
|
|
1647
|
-
function
|
|
1647
|
+
function ua(e) {
|
|
1648
1648
|
const t = e.values, a = Object.keys(e.values).filter((i) => typeof t[t[i]] != "number").map((i) => t[i]), r = Array.from(new Set(a.map((i) => typeof i)));
|
|
1649
1649
|
return {
|
|
1650
1650
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
1651
1651
|
enum: a
|
|
1652
1652
|
};
|
|
1653
1653
|
}
|
|
1654
|
-
function
|
|
1654
|
+
function da() {
|
|
1655
1655
|
return {
|
|
1656
1656
|
not: {}
|
|
1657
1657
|
};
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1659
|
+
function pa(e) {
|
|
1660
1660
|
return e.target === "openApi3" ? {
|
|
1661
1661
|
enum: ["null"],
|
|
1662
1662
|
nullable: !0
|
|
@@ -1664,20 +1664,20 @@ function ua(e) {
|
|
|
1664
1664
|
type: "null"
|
|
1665
1665
|
};
|
|
1666
1666
|
}
|
|
1667
|
-
const
|
|
1667
|
+
const te = {
|
|
1668
1668
|
ZodString: "string",
|
|
1669
1669
|
ZodNumber: "number",
|
|
1670
1670
|
ZodBigInt: "integer",
|
|
1671
1671
|
ZodBoolean: "boolean",
|
|
1672
1672
|
ZodNull: "null"
|
|
1673
1673
|
};
|
|
1674
|
-
function
|
|
1674
|
+
function ma(e, t) {
|
|
1675
1675
|
if (t.target === "openApi3")
|
|
1676
|
-
return
|
|
1676
|
+
return je(e, t);
|
|
1677
1677
|
const n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
1678
|
-
if (n.every((a) => a._def.typeName in
|
|
1678
|
+
if (n.every((a) => a._def.typeName in te && (!a._def.checks || !a._def.checks.length))) {
|
|
1679
1679
|
const a = n.reduce((r, i) => {
|
|
1680
|
-
const s =
|
|
1680
|
+
const s = te[i._def.typeName];
|
|
1681
1681
|
return s && !r.includes(s) ? [...r, s] : r;
|
|
1682
1682
|
}, []);
|
|
1683
1683
|
return {
|
|
@@ -1715,22 +1715,22 @@ function da(e, t) {
|
|
|
1715
1715
|
type: "string",
|
|
1716
1716
|
enum: n.reduce((a, r) => [...a, ...r._def.values.filter((i) => !a.includes(i))], [])
|
|
1717
1717
|
};
|
|
1718
|
-
return
|
|
1718
|
+
return je(e, t);
|
|
1719
1719
|
}
|
|
1720
|
-
const
|
|
1720
|
+
const je = (e, t) => {
|
|
1721
1721
|
const n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((a, r) => y(a._def, {
|
|
1722
1722
|
...t,
|
|
1723
1723
|
currentPath: [...t.currentPath, "anyOf", `${r}`]
|
|
1724
1724
|
})).filter((a) => !!a && (!t.strictUnions || typeof a == "object" && Object.keys(a).length > 0));
|
|
1725
1725
|
return n.length ? { anyOf: n } : void 0;
|
|
1726
1726
|
};
|
|
1727
|
-
function
|
|
1727
|
+
function ha(e, t) {
|
|
1728
1728
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length))
|
|
1729
1729
|
return t.target === "openApi3" || t.nullableStrategy === "property" ? {
|
|
1730
|
-
type:
|
|
1730
|
+
type: te[e.innerType._def.typeName],
|
|
1731
1731
|
nullable: !0
|
|
1732
1732
|
} : {
|
|
1733
|
-
type: [
|
|
1733
|
+
type: [te[e.innerType._def.typeName], "null"]
|
|
1734
1734
|
};
|
|
1735
1735
|
if (t.target === "openApi3") {
|
|
1736
1736
|
const a = y(e.innerType._def, {
|
|
@@ -1745,7 +1745,7 @@ function pa(e, t) {
|
|
|
1745
1745
|
});
|
|
1746
1746
|
return n && { anyOf: [n, { type: "null" }] };
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1748
|
+
function ga(e, t) {
|
|
1749
1749
|
const n = {
|
|
1750
1750
|
type: "number"
|
|
1751
1751
|
};
|
|
@@ -1768,7 +1768,7 @@ function ma(e, t) {
|
|
|
1768
1768
|
}
|
|
1769
1769
|
return n;
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function fa(e, t) {
|
|
1772
1772
|
return t.removeAdditionalStrategy === "strict" ? e.catchall._def.typeName === "ZodNever" ? e.unknownKeys !== "strict" : y(e.catchall._def, {
|
|
1773
1773
|
...t,
|
|
1774
1774
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
@@ -1777,7 +1777,7 @@ function ha(e, t) {
|
|
|
1777
1777
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1778
1778
|
}) ?? !0;
|
|
1779
1779
|
}
|
|
1780
|
-
function
|
|
1780
|
+
function ba(e, t) {
|
|
1781
1781
|
const n = {
|
|
1782
1782
|
type: "object",
|
|
1783
1783
|
...Object.entries(e.shape()).reduce((a, [r, i]) => {
|
|
@@ -1797,11 +1797,11 @@ This will become an error in a future version of the SDK.`), {
|
|
|
1797
1797
|
required: i.isOptional() && !t.openaiStrictMode ? a.required : [...a.required, r]
|
|
1798
1798
|
});
|
|
1799
1799
|
}, { properties: {}, required: [] }),
|
|
1800
|
-
additionalProperties:
|
|
1800
|
+
additionalProperties: fa(e, t)
|
|
1801
1801
|
};
|
|
1802
1802
|
return n.required.length || delete n.required, n;
|
|
1803
1803
|
}
|
|
1804
|
-
const
|
|
1804
|
+
const ya = (e, t) => {
|
|
1805
1805
|
var a;
|
|
1806
1806
|
if (t.currentPath.toString() === ((a = t.propertyPath) == null ? void 0 : a.toString()))
|
|
1807
1807
|
return y(e.innerType._def, t);
|
|
@@ -1817,7 +1817,7 @@ const fa = (e, t) => {
|
|
|
1817
1817
|
n
|
|
1818
1818
|
]
|
|
1819
1819
|
} : {};
|
|
1820
|
-
},
|
|
1820
|
+
}, wa = (e, t) => {
|
|
1821
1821
|
if (t.pipeStrategy === "input")
|
|
1822
1822
|
return y(e.in._def, t);
|
|
1823
1823
|
if (t.pipeStrategy === "output")
|
|
@@ -1833,10 +1833,10 @@ const fa = (e, t) => {
|
|
|
1833
1833
|
allOf: [n, a].filter((r) => r !== void 0)
|
|
1834
1834
|
};
|
|
1835
1835
|
};
|
|
1836
|
-
function
|
|
1836
|
+
function va(e, t) {
|
|
1837
1837
|
return y(e.type._def, t);
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1839
|
+
function Sa(e, t) {
|
|
1840
1840
|
const a = {
|
|
1841
1841
|
type: "array",
|
|
1842
1842
|
uniqueItems: !0,
|
|
@@ -1847,7 +1847,7 @@ function va(e, t) {
|
|
|
1847
1847
|
};
|
|
1848
1848
|
return e.minSize && S(a, "minItems", e.minSize.value, e.minSize.message, t), e.maxSize && S(a, "maxItems", e.maxSize.value, e.maxSize.message, t), a;
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1850
|
+
function Oa(e, t) {
|
|
1851
1851
|
return e.rest ? {
|
|
1852
1852
|
type: "array",
|
|
1853
1853
|
minItems: e.items.length,
|
|
@@ -1869,12 +1869,12 @@ function wa(e, t) {
|
|
|
1869
1869
|
})).reduce((n, a) => a === void 0 ? n : [...n, a], [])
|
|
1870
1870
|
};
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1872
|
+
function Ca() {
|
|
1873
1873
|
return {
|
|
1874
1874
|
not: {}
|
|
1875
1875
|
};
|
|
1876
1876
|
}
|
|
1877
|
-
function
|
|
1877
|
+
function Da() {
|
|
1878
1878
|
return {};
|
|
1879
1879
|
}
|
|
1880
1880
|
const Aa = (e, t) => y(e.innerType._def, t);
|
|
@@ -1883,20 +1883,20 @@ function y(e, t, n = !1) {
|
|
|
1883
1883
|
const a = t.seen.get(e);
|
|
1884
1884
|
if (t.override) {
|
|
1885
1885
|
const l = (s = t.override) == null ? void 0 : s.call(t, e, t, a, n);
|
|
1886
|
-
if (l !==
|
|
1886
|
+
if (l !== Hn)
|
|
1887
1887
|
return l;
|
|
1888
1888
|
}
|
|
1889
1889
|
if (a && !n) {
|
|
1890
|
-
const l =
|
|
1890
|
+
const l = Pa(a, t);
|
|
1891
1891
|
if (l !== void 0)
|
|
1892
1892
|
return "$ref" in l && t.seenRefs.add(l.$ref), l;
|
|
1893
1893
|
}
|
|
1894
1894
|
const r = { def: e, path: t.currentPath, jsonSchema: void 0 };
|
|
1895
1895
|
t.seen.set(e, r);
|
|
1896
1896
|
const i = _a(e, e.typeName, t, n);
|
|
1897
|
-
return i &&
|
|
1897
|
+
return i && xa(e, t, i), r.jsonSchema = i, i;
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1899
|
+
const Pa = (e, t) => {
|
|
1900
1900
|
switch (t.$refStrategy) {
|
|
1901
1901
|
case "root":
|
|
1902
1902
|
return { $ref: e.path.join("/") };
|
|
@@ -1904,106 +1904,106 @@ const Da = (e, t) => {
|
|
|
1904
1904
|
const n = e.path.slice(t.basePath.length + 1).join("_");
|
|
1905
1905
|
return n !== t.name && t.nameStrategy === "duplicate-ref" && (t.definitions[n] = e.def), { $ref: [...t.basePath, t.definitionPath, n].join("/") };
|
|
1906
1906
|
case "relative":
|
|
1907
|
-
return { $ref:
|
|
1907
|
+
return { $ref: Ta(t.currentPath, e.path) };
|
|
1908
1908
|
case "none":
|
|
1909
1909
|
case "seen":
|
|
1910
1910
|
return e.path.length < t.currentPath.length && e.path.every((a, r) => t.currentPath[r] === a) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), {}) : t.$refStrategy === "seen" ? {} : void 0;
|
|
1911
1911
|
}
|
|
1912
|
-
},
|
|
1912
|
+
}, Ta = (e, t) => {
|
|
1913
1913
|
let n = 0;
|
|
1914
1914
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++)
|
|
1915
1915
|
;
|
|
1916
1916
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1917
1917
|
}, _a = (e, t, n, a) => {
|
|
1918
1918
|
switch (t) {
|
|
1919
|
-
case
|
|
1919
|
+
case f.ZodString:
|
|
1920
|
+
return Ke(e, n);
|
|
1921
|
+
case f.ZodNumber:
|
|
1922
|
+
return ga(e, n);
|
|
1923
|
+
case f.ZodObject:
|
|
1924
|
+
return ba(e, n);
|
|
1925
|
+
case f.ZodBigInt:
|
|
1926
|
+
return Gn(e, n);
|
|
1927
|
+
case f.ZodBoolean:
|
|
1928
|
+
return Xn();
|
|
1929
|
+
case f.ZodDate:
|
|
1920
1930
|
return Xe(e, n);
|
|
1921
|
-
case
|
|
1931
|
+
case f.ZodUndefined:
|
|
1932
|
+
return Ca();
|
|
1933
|
+
case f.ZodNull:
|
|
1934
|
+
return pa(n);
|
|
1935
|
+
case f.ZodArray:
|
|
1936
|
+
return Qn(e, n);
|
|
1937
|
+
case f.ZodUnion:
|
|
1938
|
+
case f.ZodDiscriminatedUnion:
|
|
1922
1939
|
return ma(e, n);
|
|
1923
|
-
case
|
|
1924
|
-
return
|
|
1925
|
-
case
|
|
1926
|
-
return
|
|
1927
|
-
case
|
|
1928
|
-
return
|
|
1929
|
-
case
|
|
1930
|
-
return Qe(e, n);
|
|
1931
|
-
case g.ZodUndefined:
|
|
1932
|
-
return Sa();
|
|
1933
|
-
case g.ZodNull:
|
|
1934
|
-
return ua(n);
|
|
1935
|
-
case g.ZodArray:
|
|
1936
|
-
return Jn(e, n);
|
|
1937
|
-
case g.ZodUnion:
|
|
1938
|
-
case g.ZodDiscriminatedUnion:
|
|
1939
|
-
return da(e, n);
|
|
1940
|
-
case g.ZodIntersection:
|
|
1941
|
-
return ra(e, n);
|
|
1942
|
-
case g.ZodTuple:
|
|
1943
|
-
return wa(e, n);
|
|
1944
|
-
case g.ZodRecord:
|
|
1945
|
-
return Ke(e, n);
|
|
1946
|
-
case g.ZodLiteral:
|
|
1947
|
-
return oa(e, n);
|
|
1948
|
-
case g.ZodEnum:
|
|
1949
|
-
return na(e);
|
|
1950
|
-
case g.ZodNativeEnum:
|
|
1951
|
-
return la(e);
|
|
1952
|
-
case g.ZodNullable:
|
|
1953
|
-
return pa(e, n);
|
|
1954
|
-
case g.ZodOptional:
|
|
1955
|
-
return fa(e, n);
|
|
1956
|
-
case g.ZodMap:
|
|
1940
|
+
case f.ZodIntersection:
|
|
1941
|
+
return ia(e, n);
|
|
1942
|
+
case f.ZodTuple:
|
|
1943
|
+
return Oa(e, n);
|
|
1944
|
+
case f.ZodRecord:
|
|
1945
|
+
return et(e, n);
|
|
1946
|
+
case f.ZodLiteral:
|
|
1957
1947
|
return sa(e, n);
|
|
1958
|
-
case
|
|
1959
|
-
return
|
|
1960
|
-
case
|
|
1961
|
-
return
|
|
1962
|
-
case
|
|
1948
|
+
case f.ZodEnum:
|
|
1949
|
+
return ra(e);
|
|
1950
|
+
case f.ZodNativeEnum:
|
|
1951
|
+
return ua(e);
|
|
1952
|
+
case f.ZodNullable:
|
|
1953
|
+
return ha(e, n);
|
|
1954
|
+
case f.ZodOptional:
|
|
1963
1955
|
return ya(e, n);
|
|
1964
|
-
case
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
case
|
|
1974
|
-
return
|
|
1975
|
-
case
|
|
1976
|
-
return
|
|
1977
|
-
case
|
|
1956
|
+
case f.ZodMap:
|
|
1957
|
+
return ca(e, n);
|
|
1958
|
+
case f.ZodSet:
|
|
1959
|
+
return Sa(e, n);
|
|
1960
|
+
case f.ZodLazy:
|
|
1961
|
+
return y(e.getter()._def, n);
|
|
1962
|
+
case f.ZodPromise:
|
|
1963
|
+
return va(e, n);
|
|
1964
|
+
case f.ZodNaN:
|
|
1965
|
+
case f.ZodNever:
|
|
1966
|
+
return da();
|
|
1967
|
+
case f.ZodEffects:
|
|
1968
|
+
return aa(e, n, a);
|
|
1969
|
+
case f.ZodAny:
|
|
1970
|
+
return Yn();
|
|
1971
|
+
case f.ZodUnknown:
|
|
1972
|
+
return Da();
|
|
1973
|
+
case f.ZodDefault:
|
|
1974
|
+
return na(e, n);
|
|
1975
|
+
case f.ZodBranded:
|
|
1976
|
+
return Kn(e, n);
|
|
1977
|
+
case f.ZodReadonly:
|
|
1978
1978
|
return Aa(e, n);
|
|
1979
|
-
case
|
|
1980
|
-
return
|
|
1981
|
-
case
|
|
1982
|
-
return
|
|
1983
|
-
case
|
|
1984
|
-
case
|
|
1985
|
-
case
|
|
1979
|
+
case f.ZodCatch:
|
|
1980
|
+
return ea(e, n);
|
|
1981
|
+
case f.ZodPipeline:
|
|
1982
|
+
return wa(e, n);
|
|
1983
|
+
case f.ZodFunction:
|
|
1984
|
+
case f.ZodVoid:
|
|
1985
|
+
case f.ZodSymbol:
|
|
1986
1986
|
return;
|
|
1987
1987
|
default:
|
|
1988
1988
|
return /* @__PURE__ */ ((r) => {
|
|
1989
1989
|
})();
|
|
1990
1990
|
}
|
|
1991
|
-
},
|
|
1992
|
-
const n =
|
|
1991
|
+
}, xa = (e, t, n) => (e.description && (n.description = e.description, t.markdownDescription && (n.markdownDescription = e.description)), n), $a = (e, t) => {
|
|
1992
|
+
const n = Jn(t), a = typeof t == "string" ? t : (t == null ? void 0 : t.nameStrategy) === "title" || t == null ? void 0 : t.name, r = y(e._def, a === void 0 ? n : {
|
|
1993
1993
|
...n,
|
|
1994
1994
|
currentPath: [...n.basePath, n.definitionPath, a]
|
|
1995
1995
|
}, !1) ?? {}, i = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1996
1996
|
i !== void 0 && (r.title = i);
|
|
1997
1997
|
const s = (() => {
|
|
1998
|
-
if (
|
|
1998
|
+
if (Vn(n.definitions))
|
|
1999
1999
|
return;
|
|
2000
2000
|
const c = {}, d = /* @__PURE__ */ new Set();
|
|
2001
2001
|
for (let u = 0; u < 500; u++) {
|
|
2002
|
-
const p = Object.entries(n.definitions).filter(([
|
|
2002
|
+
const p = Object.entries(n.definitions).filter(([g]) => !d.has(g));
|
|
2003
2003
|
if (p.length === 0)
|
|
2004
2004
|
break;
|
|
2005
|
-
for (const [
|
|
2006
|
-
c[
|
|
2005
|
+
for (const [g, h] of p)
|
|
2006
|
+
c[g] = y(he(h), { ...n, currentPath: [...n.basePath, n.definitionPath, g] }, !0) ?? {}, d.add(g);
|
|
2007
2007
|
}
|
|
2008
2008
|
return c;
|
|
2009
2009
|
})(), l = a === void 0 ? s ? {
|
|
@@ -2028,8 +2028,8 @@ const Da = (e, t) => {
|
|
|
2028
2028
|
};
|
|
2029
2029
|
return n.target === "jsonSchema7" ? l.$schema = "http://json-schema.org/draft-07/schema#" : n.target === "jsonSchema2019-09" && (l.$schema = "https://json-schema.org/draft/2019-09/schema#"), l;
|
|
2030
2030
|
};
|
|
2031
|
-
function
|
|
2032
|
-
return
|
|
2031
|
+
function ja(e, t) {
|
|
2032
|
+
return $a(e, {
|
|
2033
2033
|
openaiStrictMode: !0,
|
|
2034
2034
|
name: t.name,
|
|
2035
2035
|
nameStrategy: "duplicate-ref",
|
|
@@ -2037,21 +2037,21 @@ function xa(e, t) {
|
|
|
2037
2037
|
nullableStrategy: "property"
|
|
2038
2038
|
});
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2041
|
-
return
|
|
2040
|
+
function Ea(e, t, n) {
|
|
2041
|
+
return qn({
|
|
2042
2042
|
type: "json_schema",
|
|
2043
2043
|
json_schema: {
|
|
2044
2044
|
...n,
|
|
2045
2045
|
name: t,
|
|
2046
2046
|
strict: !0,
|
|
2047
|
-
schema:
|
|
2047
|
+
schema: ja(e, { name: t })
|
|
2048
2048
|
}
|
|
2049
2049
|
}, (a) => e.parse(JSON.parse(a)));
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2051
|
+
function we(e) {
|
|
2052
2052
|
return e.endsWith("/") ? e : `${e}/`;
|
|
2053
2053
|
}
|
|
2054
|
-
const
|
|
2054
|
+
const ai = (e) => {
|
|
2055
2055
|
if (e instanceof Error)
|
|
2056
2056
|
try {
|
|
2057
2057
|
return JSON.parse(e.message);
|
|
@@ -2060,7 +2060,7 @@ const zo = (e) => {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
return e;
|
|
2062
2062
|
};
|
|
2063
|
-
function
|
|
2063
|
+
function ka() {
|
|
2064
2064
|
try {
|
|
2065
2065
|
const e = window.location.host, {
|
|
2066
2066
|
tenant: { tenantDomainNames: t, name: n }
|
|
@@ -2070,25 +2070,25 @@ function ja() {
|
|
|
2070
2070
|
return console.debug("no tenant prefix", e), "";
|
|
2071
2071
|
}
|
|
2072
2072
|
}
|
|
2073
|
-
const
|
|
2074
|
-
function
|
|
2075
|
-
return
|
|
2073
|
+
const ne = "x-user-action-id", ae = "traceparent";
|
|
2074
|
+
function Ma() {
|
|
2075
|
+
return ee();
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2078
|
-
const e =
|
|
2077
|
+
function Na() {
|
|
2078
|
+
const e = W(32), t = W(16);
|
|
2079
2079
|
return `00-${e}-${t}-01`;
|
|
2080
2080
|
}
|
|
2081
|
-
class
|
|
2081
|
+
class Ia {
|
|
2082
2082
|
constructor() {
|
|
2083
2083
|
this.currentActionId = null, this.currentTraceparent = null;
|
|
2084
2084
|
}
|
|
2085
2085
|
startAction() {
|
|
2086
|
-
return this.currentActionId =
|
|
2086
|
+
return this.currentActionId = Ma(), this.currentTraceparent = Na(), this.getHeaders();
|
|
2087
2087
|
}
|
|
2088
2088
|
getHeaders() {
|
|
2089
2089
|
return !this.currentActionId || !this.currentTraceparent ? this.startAction() : {
|
|
2090
|
-
[
|
|
2091
|
-
[
|
|
2090
|
+
[ne]: this.currentActionId,
|
|
2091
|
+
[ae]: this.currentTraceparent
|
|
2092
2092
|
};
|
|
2093
2093
|
}
|
|
2094
2094
|
endAction() {
|
|
@@ -2101,18 +2101,18 @@ class Ma {
|
|
|
2101
2101
|
return this.currentActionId;
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
|
-
const
|
|
2105
|
-
function
|
|
2106
|
-
return
|
|
2104
|
+
const oe = new Ia();
|
|
2105
|
+
function ri() {
|
|
2106
|
+
return oe.startAction();
|
|
2107
2107
|
}
|
|
2108
|
-
function
|
|
2109
|
-
return
|
|
2108
|
+
function Za() {
|
|
2109
|
+
return oe.getHeaders();
|
|
2110
2110
|
}
|
|
2111
|
-
const
|
|
2111
|
+
const La = {
|
|
2112
2112
|
Accept: "application/json, text/plain, */*",
|
|
2113
2113
|
"Content-Type": "application/json;charset=UTF-8"
|
|
2114
2114
|
};
|
|
2115
|
-
function
|
|
2115
|
+
function Ra(e) {
|
|
2116
2116
|
if (!e)
|
|
2117
2117
|
return {};
|
|
2118
2118
|
if (e instanceof Headers) {
|
|
@@ -2129,61 +2129,61 @@ function Za(e) {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
return { ...e };
|
|
2131
2131
|
}
|
|
2132
|
-
function
|
|
2133
|
-
const t =
|
|
2132
|
+
function Y(e = {}) {
|
|
2133
|
+
const t = oe.getHeaders(), n = Ra(e.headers);
|
|
2134
2134
|
return {
|
|
2135
2135
|
...e,
|
|
2136
2136
|
headers: {
|
|
2137
|
-
...
|
|
2137
|
+
...La,
|
|
2138
2138
|
...n,
|
|
2139
2139
|
...t
|
|
2140
2140
|
}
|
|
2141
2141
|
};
|
|
2142
2142
|
}
|
|
2143
|
-
function
|
|
2144
|
-
|
|
2143
|
+
function oi() {
|
|
2144
|
+
oe.endAction();
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2147
|
-
let n =
|
|
2146
|
+
function tt(e, t) {
|
|
2147
|
+
let n = ka();
|
|
2148
2148
|
n.startsWith("/") && (n = n.slice(1));
|
|
2149
2149
|
const a = new At(
|
|
2150
|
-
`${
|
|
2150
|
+
`${we(e)}${n}`,
|
|
2151
2151
|
t,
|
|
2152
|
-
"sdk-ai-core-0.
|
|
2152
|
+
"sdk-ai-core-0.4.0"
|
|
2153
2153
|
);
|
|
2154
2154
|
return a.login(), a;
|
|
2155
2155
|
}
|
|
2156
|
-
function
|
|
2157
|
-
const t =
|
|
2156
|
+
function Ua(e) {
|
|
2157
|
+
const t = Pt(e);
|
|
2158
2158
|
if (!t)
|
|
2159
2159
|
throw new Error("Invalid authentication method");
|
|
2160
|
-
return
|
|
2160
|
+
return tt(e.url, t);
|
|
2161
2161
|
}
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2164
|
-
|
|
2162
|
+
const za = [
|
|
2163
|
+
ne.toLowerCase(),
|
|
2164
|
+
ae.toLowerCase()
|
|
2165
2165
|
];
|
|
2166
|
-
function
|
|
2166
|
+
function Ba(e) {
|
|
2167
2167
|
return async (t, n) => {
|
|
2168
2168
|
if (!t.toString().includes("chat/completions"))
|
|
2169
2169
|
throw new Error("Use httpClient for non-completion requests");
|
|
2170
2170
|
const a = new Headers(), r = e.auth.type === "bearer";
|
|
2171
2171
|
n != null && n.headers && new Headers(n.headers).forEach((c, d) => {
|
|
2172
2172
|
const u = d.toLowerCase();
|
|
2173
|
-
(
|
|
2173
|
+
(za.includes(u) || !u.startsWith("x-") && (r || u !== "authorization")) && a.set(d, c);
|
|
2174
2174
|
});
|
|
2175
|
-
const i =
|
|
2175
|
+
const i = Za();
|
|
2176
2176
|
a.set(
|
|
2177
|
-
|
|
2178
|
-
i[
|
|
2179
|
-
), a.set(
|
|
2177
|
+
ne,
|
|
2178
|
+
i[ne]
|
|
2179
|
+
), a.set(ae, i[ae]), e.auth.applyHeaders(a);
|
|
2180
2180
|
const s = { ...n || {}, headers: a };
|
|
2181
2181
|
return fetch(t, s);
|
|
2182
2182
|
};
|
|
2183
2183
|
}
|
|
2184
|
-
const
|
|
2185
|
-
function
|
|
2186
|
-
return new
|
|
2184
|
+
const Fa = "api/v2/ai";
|
|
2185
|
+
function qa(e, t) {
|
|
2186
|
+
return new Tt({
|
|
2187
2187
|
// @ts-expect-error - OpenAI client requires apiKey but we're using custom auth
|
|
2188
2188
|
apiKey: null,
|
|
2189
2189
|
dangerouslyAllowBrowser: !0,
|
|
@@ -2191,12 +2191,12 @@ function Ba(e, t) {
|
|
|
2191
2191
|
fetch: t
|
|
2192
2192
|
});
|
|
2193
2193
|
}
|
|
2194
|
-
function
|
|
2195
|
-
const t =
|
|
2196
|
-
return
|
|
2194
|
+
function nt(e) {
|
|
2195
|
+
const t = we(e.url) + Fa;
|
|
2196
|
+
return qa(t, Ba(e));
|
|
2197
2197
|
}
|
|
2198
2198
|
let ge = null;
|
|
2199
|
-
function
|
|
2199
|
+
function at(e) {
|
|
2200
2200
|
ge = e;
|
|
2201
2201
|
}
|
|
2202
2202
|
function b() {
|
|
@@ -2206,30 +2206,30 @@ function b() {
|
|
|
2206
2206
|
);
|
|
2207
2207
|
return ge;
|
|
2208
2208
|
}
|
|
2209
|
-
function
|
|
2210
|
-
const e = b(), t = e.url, n = e.auth, a =
|
|
2211
|
-
|
|
2209
|
+
function ii() {
|
|
2210
|
+
const e = b(), t = e.url, n = e.auth, a = tt(t, n);
|
|
2211
|
+
at(a);
|
|
2212
2212
|
}
|
|
2213
2213
|
let fe = null;
|
|
2214
|
-
function
|
|
2214
|
+
function rt(e) {
|
|
2215
2215
|
fe = e;
|
|
2216
2216
|
}
|
|
2217
|
-
function
|
|
2217
|
+
function ot() {
|
|
2218
2218
|
if (!fe)
|
|
2219
2219
|
throw new Error(
|
|
2220
2220
|
"OpenAI client not initialized. Create one using createOpenAIClient() and then initialize it using initializeOpenAIClient()."
|
|
2221
2221
|
);
|
|
2222
2222
|
return fe;
|
|
2223
2223
|
}
|
|
2224
|
-
function
|
|
2225
|
-
const e =
|
|
2226
|
-
|
|
2224
|
+
function si() {
|
|
2225
|
+
const e = nt(b());
|
|
2226
|
+
rt(e);
|
|
2227
2227
|
}
|
|
2228
|
-
function
|
|
2229
|
-
const t =
|
|
2230
|
-
|
|
2231
|
-
const n =
|
|
2232
|
-
|
|
2228
|
+
function li(e) {
|
|
2229
|
+
const t = Ua(e);
|
|
2230
|
+
at(t);
|
|
2231
|
+
const n = nt(t);
|
|
2232
|
+
rt(n);
|
|
2233
2233
|
}
|
|
2234
2234
|
async function ve(e) {
|
|
2235
2235
|
const {
|
|
@@ -2239,8 +2239,8 @@ async function ve(e) {
|
|
|
2239
2239
|
model: r = "gpt-4o-mini",
|
|
2240
2240
|
temperature: i = 0,
|
|
2241
2241
|
sessionId: s,
|
|
2242
|
-
openAIClient: l =
|
|
2243
|
-
} = e, c = a.type === "json_schema" ?
|
|
2242
|
+
openAIClient: l = ot()
|
|
2243
|
+
} = e, c = a.type === "json_schema" ? Ea(a.schema, a.name) : { type: "json_object" }, u = (await l.beta.chat.completions.parse({
|
|
2244
2244
|
model: r,
|
|
2245
2245
|
messages: [
|
|
2246
2246
|
{ role: "system", content: t },
|
|
@@ -2254,22 +2254,22 @@ async function ve(e) {
|
|
|
2254
2254
|
})).choices[0].message;
|
|
2255
2255
|
if (a.type === "json_schema") {
|
|
2256
2256
|
if (u.tool_calls && u.tool_calls.length > 0) {
|
|
2257
|
-
const
|
|
2258
|
-
if (
|
|
2259
|
-
return JSON.parse(
|
|
2257
|
+
const g = u.tool_calls[0];
|
|
2258
|
+
if (g.function && g.function.arguments)
|
|
2259
|
+
return JSON.parse(g.function.arguments);
|
|
2260
2260
|
}
|
|
2261
2261
|
const p = u.parsed;
|
|
2262
2262
|
if (!p)
|
|
2263
2263
|
throw new Error("No valid response from AI");
|
|
2264
2264
|
return p;
|
|
2265
2265
|
} else {
|
|
2266
|
-
const p = u.content || "{}",
|
|
2267
|
-
if (!
|
|
2266
|
+
const p = u.content || "{}", g = JSON.parse(p);
|
|
2267
|
+
if (!g)
|
|
2268
2268
|
throw new Error("No valid response from AI");
|
|
2269
|
-
return
|
|
2269
|
+
return g;
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
|
-
async function
|
|
2272
|
+
async function Ha(e) {
|
|
2273
2273
|
const {
|
|
2274
2274
|
systemPrompt: t,
|
|
2275
2275
|
userPrompt: n,
|
|
@@ -2277,7 +2277,7 @@ async function Fa(e) {
|
|
|
2277
2277
|
model: r = "gpt-4o-mini",
|
|
2278
2278
|
temperature: i = 0,
|
|
2279
2279
|
toolChoice: s = "auto",
|
|
2280
|
-
openAIClient: l =
|
|
2280
|
+
openAIClient: l = ot()
|
|
2281
2281
|
} = e;
|
|
2282
2282
|
return new Promise((c) => {
|
|
2283
2283
|
const d = [], u = [];
|
|
@@ -2305,29 +2305,29 @@ async function Fa(e) {
|
|
|
2305
2305
|
}).on("message", (p) => {
|
|
2306
2306
|
p.role === "tool" ? d.push(p) : p.role === "assistant" && p.content && u.push(p.content);
|
|
2307
2307
|
}).on("end", () => {
|
|
2308
|
-
let p = !1,
|
|
2308
|
+
let p = !1, g = "";
|
|
2309
2309
|
try {
|
|
2310
|
-
const
|
|
2310
|
+
const h = d.map(
|
|
2311
2311
|
(P) => JSON.parse(P.content).message
|
|
2312
2312
|
).join(`
|
|
2313
|
-
`),
|
|
2313
|
+
`), O = u.join(`
|
|
2314
2314
|
`);
|
|
2315
|
-
d.length === 0 && u.length > 0 ? (p = !0,
|
|
2316
|
-
|
|
2317
|
-
|
|
2315
|
+
d.length === 0 && u.length > 0 ? (p = !0, g = O) : d.length === 0 && u.length === 0 ? (p = !0, g = "No tools executed and no response from LLM") : (g = [
|
|
2316
|
+
h,
|
|
2317
|
+
O
|
|
2318
2318
|
].filter(Boolean).join(`
|
|
2319
|
-
`),
|
|
2319
|
+
`), g.trim() === "" && (p = !0, g = "Tools executed but returned empty results"));
|
|
2320
2320
|
} catch {
|
|
2321
|
-
p = !0,
|
|
2321
|
+
p = !0, g = "Malformed tool response detected";
|
|
2322
2322
|
}
|
|
2323
2323
|
c({
|
|
2324
2324
|
toolMessages: d,
|
|
2325
2325
|
assistantMessages: u,
|
|
2326
|
-
combinedMessage:
|
|
2326
|
+
combinedMessage: g,
|
|
2327
2327
|
isError: p
|
|
2328
2328
|
});
|
|
2329
2329
|
}).on("error", (p) => {
|
|
2330
|
-
const
|
|
2330
|
+
const g = p instanceof Error ? JSON.stringify(
|
|
2331
2331
|
{
|
|
2332
2332
|
name: p.name,
|
|
2333
2333
|
message: p.message,
|
|
@@ -2339,13 +2339,13 @@ async function Fa(e) {
|
|
|
2339
2339
|
c({
|
|
2340
2340
|
toolMessages: [],
|
|
2341
2341
|
assistantMessages: [],
|
|
2342
|
-
combinedMessage:
|
|
2342
|
+
combinedMessage: g,
|
|
2343
2343
|
isError: !0
|
|
2344
2344
|
});
|
|
2345
2345
|
});
|
|
2346
2346
|
});
|
|
2347
2347
|
}
|
|
2348
|
-
const
|
|
2348
|
+
const Wa = `
|
|
2349
2349
|
You are an expert in chart visualization and data query structuring. Your task is to assist users in generating the optimal chart type and axes mapping based on their input, adhering to the provided schema (schema object with chartType and axesMapping). Your goal is to interpret the user's prompt, analyze the provided column data, select an appropriate chart type (unless specified by the user), and map column indices to the axes mapping arrays in a way that produces a valid, effective visualization.
|
|
2350
2350
|
|
|
2351
2351
|
DO NOT use any tools.
|
|
@@ -2384,33 +2384,33 @@ Return a JSON object matching the schema structure, with:
|
|
|
2384
2384
|
- axesMapping: The populated axes mapping object per the relevant schema.
|
|
2385
2385
|
Provide a brief explanation of your chart type choice and axes mapping decisions, referencing the prompt and column data.
|
|
2386
2386
|
`;
|
|
2387
|
-
function
|
|
2387
|
+
function Va(e, t) {
|
|
2388
2388
|
return e ? e.map((n) => ({
|
|
2389
2389
|
column: t[n]
|
|
2390
2390
|
})).filter(({ column: n }) => !!n) : [];
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2392
|
+
function Ja(e, t) {
|
|
2393
2393
|
if (!e) return e;
|
|
2394
2394
|
const n = e.axesMapping, a = {
|
|
2395
2395
|
chartType: e.chartType,
|
|
2396
2396
|
axesMapping: {}
|
|
2397
2397
|
};
|
|
2398
2398
|
for (const [r, i] of Object.entries(n))
|
|
2399
|
-
r !== "type" && (Array.isArray(i) ? a.axesMapping[r] =
|
|
2399
|
+
r !== "type" && (Array.isArray(i) ? a.axesMapping[r] = Va(i, t) : a.axesMapping[r] = i);
|
|
2400
2400
|
return a;
|
|
2401
2401
|
}
|
|
2402
|
-
const
|
|
2402
|
+
const it = async (e, t = [], n, a) => {
|
|
2403
2403
|
var d;
|
|
2404
2404
|
const r = [];
|
|
2405
2405
|
let i = 0;
|
|
2406
2406
|
for (const u of t) {
|
|
2407
|
-
const p = "column" in u ? (d = u.column) == null ? void 0 : d.name : u.name,
|
|
2407
|
+
const p = "column" in u ? (d = u.column) == null ? void 0 : d.name : u.name, g = (() => {
|
|
2408
2408
|
if ("column" in u && u.column && "type" in u.column)
|
|
2409
2409
|
return u.column.type;
|
|
2410
2410
|
if ("type" in u && typeof u.type == "string")
|
|
2411
2411
|
return u.type;
|
|
2412
2412
|
})();
|
|
2413
|
-
r.push({ id: i++, name: p, type:
|
|
2413
|
+
r.push({ id: i++, name: p, type: g });
|
|
2414
2414
|
}
|
|
2415
2415
|
let s = e + `
|
|
2416
2416
|
|
|
@@ -2420,15 +2420,15 @@ ${JSON.stringify(r)}`;
|
|
|
2420
2420
|
|
|
2421
2421
|
`);
|
|
2422
2422
|
const l = await ve({
|
|
2423
|
-
systemPrompt:
|
|
2423
|
+
systemPrompt: Wa,
|
|
2424
2424
|
userPrompt: s,
|
|
2425
2425
|
responseFormat: {
|
|
2426
2426
|
type: "json_schema",
|
|
2427
|
-
schema:
|
|
2427
|
+
schema: kn,
|
|
2428
2428
|
name: "chartRecommendations"
|
|
2429
2429
|
},
|
|
2430
2430
|
openAIClient: a
|
|
2431
|
-
}), c =
|
|
2431
|
+
}), c = Ja(
|
|
2432
2432
|
l,
|
|
2433
2433
|
t
|
|
2434
2434
|
);
|
|
@@ -2442,41 +2442,41 @@ ${JSON.stringify(r)}`;
|
|
|
2442
2442
|
}
|
|
2443
2443
|
return c;
|
|
2444
2444
|
};
|
|
2445
|
-
async function
|
|
2445
|
+
async function ci(e, t, n) {
|
|
2446
2446
|
return await (n ?? b()).post(
|
|
2447
2447
|
`api/v2/ai/nlq/query/${e}`,
|
|
2448
2448
|
t,
|
|
2449
|
-
|
|
2449
|
+
Y()
|
|
2450
2450
|
) ?? null;
|
|
2451
2451
|
}
|
|
2452
|
-
async function
|
|
2452
|
+
async function Ya(e, t, n) {
|
|
2453
2453
|
return await (n ?? b()).post(
|
|
2454
2454
|
`api/v2/ai/nlq/query-light/${e}`,
|
|
2455
2455
|
t,
|
|
2456
|
-
|
|
2456
|
+
Y()
|
|
2457
2457
|
) ?? null;
|
|
2458
2458
|
}
|
|
2459
|
-
async function
|
|
2459
|
+
async function Qa(e, t, n) {
|
|
2460
2460
|
return await (n ?? b()).post(
|
|
2461
2461
|
`api/v2/ai/nlq/smartQuery/${e}`,
|
|
2462
2462
|
t,
|
|
2463
|
-
|
|
2463
|
+
Y()
|
|
2464
2464
|
) ?? null;
|
|
2465
2465
|
}
|
|
2466
|
-
async function
|
|
2466
|
+
async function ui(e, t, n) {
|
|
2467
2467
|
return await (n ?? b()).get(
|
|
2468
2468
|
`api/v2/ai/recommendations/query/${e}/${t.numOfRecommendations}`,
|
|
2469
|
-
|
|
2469
|
+
Y()
|
|
2470
2470
|
) ?? null;
|
|
2471
2471
|
}
|
|
2472
|
-
async function
|
|
2472
|
+
async function Ga(e, t, n) {
|
|
2473
2473
|
return await (n ?? b()).get(
|
|
2474
2474
|
`api/v2/ai/recommendations/query-light/${e}/${t.numOfRecommendations}${t.userPrompt ? `?userPrompt=${t.userPrompt}` : ""}`,
|
|
2475
|
-
|
|
2475
|
+
Y()
|
|
2476
2476
|
) ?? null;
|
|
2477
2477
|
}
|
|
2478
|
-
const
|
|
2479
|
-
const a = await
|
|
2478
|
+
const st = async (e, t, n) => {
|
|
2479
|
+
const a = await Ya(
|
|
2480
2480
|
e,
|
|
2481
2481
|
{
|
|
2482
2482
|
text: t,
|
|
@@ -2488,7 +2488,7 @@ const it = async (e, t, n) => {
|
|
|
2488
2488
|
throw new Error(
|
|
2489
2489
|
"Error: Failed to get NLQ result. Ask the user to specify the data source again."
|
|
2490
2490
|
);
|
|
2491
|
-
const r =
|
|
2491
|
+
const r = Dt.toWidgetProps(
|
|
2492
2492
|
{ ...a, chartRecommendations: {} },
|
|
2493
2493
|
{
|
|
2494
2494
|
useCustomizedStyleOptions: !0
|
|
@@ -2496,12 +2496,12 @@ const it = async (e, t, n) => {
|
|
|
2496
2496
|
);
|
|
2497
2497
|
if (!r)
|
|
2498
2498
|
throw new Error("Error: Failed to generate widget props");
|
|
2499
|
-
if (r.nlqResponse = a, !
|
|
2499
|
+
if (r.nlqResponse = a, !Re(r))
|
|
2500
2500
|
throw new Error("Error: Non-chart widget props not supported yet");
|
|
2501
2501
|
return r.title = r.title || a.nlqPrompt || t, r;
|
|
2502
|
-
},
|
|
2502
|
+
}, Xa = async (e, t, n) => {
|
|
2503
2503
|
try {
|
|
2504
|
-
const a = await
|
|
2504
|
+
const a = await Qa(
|
|
2505
2505
|
e,
|
|
2506
2506
|
{
|
|
2507
2507
|
text: t,
|
|
@@ -2514,7 +2514,7 @@ const it = async (e, t, n) => {
|
|
|
2514
2514
|
const r = a.dataSchema;
|
|
2515
2515
|
if (!r)
|
|
2516
2516
|
throw new Error("Error: Data schema not found");
|
|
2517
|
-
const i =
|
|
2517
|
+
const i = Ot({
|
|
2518
2518
|
data: a.chartState,
|
|
2519
2519
|
context: r
|
|
2520
2520
|
});
|
|
@@ -2522,16 +2522,16 @@ const it = async (e, t, n) => {
|
|
|
2522
2522
|
throw new Error(
|
|
2523
2523
|
"Error: Failed to translate query JSON: " + JSON.stringify(i.errors)
|
|
2524
2524
|
);
|
|
2525
|
-
const s = i.data, l =
|
|
2525
|
+
const s = i.data, l = Ct(
|
|
2526
2526
|
s,
|
|
2527
|
-
|
|
2527
|
+
Ue(r.dataSource)
|
|
2528
2528
|
), c = [
|
|
2529
2529
|
...s.dimensions || [],
|
|
2530
2530
|
...s.measures || []
|
|
2531
2531
|
];
|
|
2532
2532
|
return {
|
|
2533
2533
|
title: t,
|
|
2534
|
-
id:
|
|
2534
|
+
id: W(),
|
|
2535
2535
|
widgetType: "chart",
|
|
2536
2536
|
dataSource: s.dataSource,
|
|
2537
2537
|
chartType: "table",
|
|
@@ -2551,27 +2551,27 @@ const it = async (e, t, n) => {
|
|
|
2551
2551
|
return console.error(
|
|
2552
2552
|
"Error: Failed to generate chart table from NLQ V3. Falling back to NLQ V2.",
|
|
2553
2553
|
a
|
|
2554
|
-
),
|
|
2554
|
+
), st(
|
|
2555
2555
|
e,
|
|
2556
2556
|
t,
|
|
2557
2557
|
n
|
|
2558
2558
|
);
|
|
2559
2559
|
}
|
|
2560
|
-
},
|
|
2560
|
+
}, Ka = async (e, t, n, a) => n ? (console.debug("Generating chart table from NLQ V3"), Xa(
|
|
2561
2561
|
e,
|
|
2562
2562
|
t,
|
|
2563
2563
|
a
|
|
2564
|
-
)) : (console.debug("Generating chart table from NLQ V2"),
|
|
2564
|
+
)) : (console.debug("Generating chart table from NLQ V2"), st(
|
|
2565
2565
|
e,
|
|
2566
2566
|
t,
|
|
2567
2567
|
a
|
|
2568
|
-
)),
|
|
2569
|
-
const i = await
|
|
2568
|
+
)), lt = async ({ dataSourceTitle: e, userPrompt: t, chartType: n, chartTitle: a }, r) => {
|
|
2569
|
+
const i = await Ka(
|
|
2570
2570
|
e,
|
|
2571
2571
|
t,
|
|
2572
2572
|
r.isNlqV3Enabled ?? !1,
|
|
2573
2573
|
r.httpClient
|
|
2574
|
-
), s = i.dataOptions.columns, l = await
|
|
2574
|
+
), s = i.dataOptions.columns, l = await it(
|
|
2575
2575
|
t,
|
|
2576
2576
|
s,
|
|
2577
2577
|
n,
|
|
@@ -2580,7 +2580,7 @@ const it = async (e, t, n) => {
|
|
|
2580
2580
|
i.nlqResponse.chartRecommendations = l || i.nlqResponse.chartRecommendations;
|
|
2581
2581
|
const { axesMapping: c, chartType: d } = l;
|
|
2582
2582
|
i.dataOptions = c, i.chartType = d, i.title = a;
|
|
2583
|
-
const u =
|
|
2583
|
+
const u = Le(
|
|
2584
2584
|
d,
|
|
2585
2585
|
i.dataOptions,
|
|
2586
2586
|
{},
|
|
@@ -2591,10 +2591,10 @@ const it = async (e, t, n) => {
|
|
|
2591
2591
|
..."legend" in u ? { legend: { enabled: !0, position: "bottom" } } : {}
|
|
2592
2592
|
}, {
|
|
2593
2593
|
...i,
|
|
2594
|
-
artifactId:
|
|
2594
|
+
artifactId: W(),
|
|
2595
2595
|
dataColumns: s
|
|
2596
2596
|
};
|
|
2597
|
-
},
|
|
2597
|
+
}, er = async ({ userPrompt: e, chartType: t, chartTitle: n }, a) => {
|
|
2598
2598
|
var l;
|
|
2599
2599
|
console.debug("toolCall", "createChart", e, t, n);
|
|
2600
2600
|
const r = a.dataSourceTitle;
|
|
@@ -2602,7 +2602,7 @@ const it = async (e, t, n) => {
|
|
|
2602
2602
|
throw new Error(
|
|
2603
2603
|
"Error: Please ask the user to specify a data source title"
|
|
2604
2604
|
);
|
|
2605
|
-
const i = a.toolCallId, s = await
|
|
2605
|
+
const i = a.toolCallId, s = await lt(
|
|
2606
2606
|
{
|
|
2607
2607
|
dataSourceTitle: r,
|
|
2608
2608
|
userPrompt: e,
|
|
@@ -2614,37 +2614,37 @@ const it = async (e, t, n) => {
|
|
|
2614
2614
|
return (l = a.saveChart) == null || l.call(a, i, s), {
|
|
2615
2615
|
message: `New chart (chartId: ${i}) created successfully`
|
|
2616
2616
|
};
|
|
2617
|
-
},
|
|
2617
|
+
}, tr = ({
|
|
2618
2618
|
chartTitle: e,
|
|
2619
2619
|
chartWidgetProps: t
|
|
2620
2620
|
}) => ({
|
|
2621
2621
|
...t,
|
|
2622
2622
|
title: e
|
|
2623
|
-
}),
|
|
2623
|
+
}), nr = async ({ chartId: e, chartTitle: t }, n) => {
|
|
2624
2624
|
var i, s;
|
|
2625
2625
|
console.debug("toolCall", "updateChartTitle", e, t);
|
|
2626
2626
|
const a = (i = n.retrieveChart) == null ? void 0 : i.call(n, e);
|
|
2627
2627
|
if (!a)
|
|
2628
2628
|
throw new Error("Chart not found");
|
|
2629
|
-
const r =
|
|
2629
|
+
const r = tr({
|
|
2630
2630
|
chartTitle: t,
|
|
2631
2631
|
chartWidgetProps: a
|
|
2632
2632
|
});
|
|
2633
2633
|
return (s = n.saveChart) == null || s.call(n, e, r), {
|
|
2634
2634
|
message: "Chart title updated successfully"
|
|
2635
2635
|
};
|
|
2636
|
-
},
|
|
2636
|
+
}, ar = async ({
|
|
2637
2637
|
userPrompt: e,
|
|
2638
2638
|
chartType: t,
|
|
2639
2639
|
chartWidgetProps: n
|
|
2640
2640
|
}) => {
|
|
2641
|
-
const { dataColumns: a, styleOptions: r } = n, i = await
|
|
2641
|
+
const { dataColumns: a, styleOptions: r } = n, i = await it(
|
|
2642
2642
|
e,
|
|
2643
2643
|
a,
|
|
2644
2644
|
t
|
|
2645
2645
|
), { axesMapping: s, chartType: l } = i;
|
|
2646
2646
|
n.dataOptions = s, n.chartType = l;
|
|
2647
|
-
const c =
|
|
2647
|
+
const c = Le(
|
|
2648
2648
|
l,
|
|
2649
2649
|
n.dataOptions,
|
|
2650
2650
|
{},
|
|
@@ -2661,7 +2661,7 @@ const it = async (e, t, n) => {
|
|
|
2661
2661
|
..."markerSize" in r && "markerSize" in c ? { markerSize: r.markerSize } : {}
|
|
2662
2662
|
} : c;
|
|
2663
2663
|
return n.styleOptions = d, n;
|
|
2664
|
-
},
|
|
2664
|
+
}, rr = async ({ chartId: e, userPrompt: t, chartType: n }, a) => {
|
|
2665
2665
|
var s, l;
|
|
2666
2666
|
console.debug(
|
|
2667
2667
|
"toolCall",
|
|
@@ -2673,7 +2673,7 @@ const it = async (e, t, n) => {
|
|
|
2673
2673
|
const r = (s = a.retrieveChart) == null ? void 0 : s.call(a, e);
|
|
2674
2674
|
if (!r)
|
|
2675
2675
|
throw new Error("Chart not found");
|
|
2676
|
-
const i = await
|
|
2676
|
+
const i = await ar({
|
|
2677
2677
|
userPrompt: t,
|
|
2678
2678
|
chartType: n,
|
|
2679
2679
|
chartWidgetProps: r
|
|
@@ -2681,9 +2681,9 @@ const it = async (e, t, n) => {
|
|
|
2681
2681
|
return (l = a.saveChart) == null || l.call(a, e, i), {
|
|
2682
2682
|
message: "Chart type updated successfully"
|
|
2683
2683
|
};
|
|
2684
|
-
},
|
|
2684
|
+
}, or = o.object({
|
|
2685
2685
|
width: o.enum(["thin", "bold", "thick"])
|
|
2686
|
-
}),
|
|
2686
|
+
}), ir = o.enum(["line/basic", "line/spline"]), j = o.object({
|
|
2687
2687
|
enabled: o.boolean().optional().describe(
|
|
2688
2688
|
"Boolean flag that defines if legend should be shown on the chart"
|
|
2689
2689
|
),
|
|
@@ -2696,7 +2696,7 @@ const it = async (e, t, n) => {
|
|
|
2696
2696
|
showPercentage: o.boolean().optional(),
|
|
2697
2697
|
fontSize: o.string().optional()
|
|
2698
2698
|
// color: z.string().optional(),
|
|
2699
|
-
}).strict(),
|
|
2699
|
+
}).strict(), Se = o.object({
|
|
2700
2700
|
enabled: o.boolean().optional(),
|
|
2701
2701
|
title: o.object({
|
|
2702
2702
|
enabled: o.boolean().default(!0).optional(),
|
|
@@ -2722,7 +2722,7 @@ const it = async (e, t, n) => {
|
|
|
2722
2722
|
templateMainYHasGridLines: o.boolean().optional().describe(
|
|
2723
2723
|
"Boolean flag that defines if the Y axis should have grid lines extending the ticks across the plot area"
|
|
2724
2724
|
)
|
|
2725
|
-
}).strict(), B =
|
|
2725
|
+
}).strict(), B = Se.describe("X-axis configuration"), F = Se.describe("Y-axis configuration"), q = Se.describe("Y2-axis configuration"), Q = o.object({
|
|
2726
2726
|
enabled: o.boolean().optional().describe(
|
|
2727
2727
|
"Boolean flag that defines if markers should be shown on the chart"
|
|
2728
2728
|
),
|
|
@@ -2730,7 +2730,7 @@ const it = async (e, t, n) => {
|
|
|
2730
2730
|
size: o.enum(["small", "medium", "large"]).optional().describe("Size of markers")
|
|
2731
2731
|
}).describe(
|
|
2732
2732
|
"Options that define markers - symbols or data points that highlight specific values."
|
|
2733
|
-
).strict(),
|
|
2733
|
+
).strict(), ie = o.object({
|
|
2734
2734
|
enabled: o.boolean().optional().describe(
|
|
2735
2735
|
"Boolean flag that defines if navigator should be shown on the chart"
|
|
2736
2736
|
),
|
|
@@ -2742,32 +2742,32 @@ const it = async (e, t, n) => {
|
|
|
2742
2742
|
)
|
|
2743
2743
|
}).describe(
|
|
2744
2744
|
"Options that define navigator - zoom/pan tool for large datasets in a chart."
|
|
2745
|
-
).strict(),
|
|
2745
|
+
).strict(), L = o.object({
|
|
2746
2746
|
categoriesCapacity: o.number().optional().describe("Maximum number of categories to chart"),
|
|
2747
2747
|
seriesCapacity: o.number().optional().describe("Maximum number of series to chart")
|
|
2748
2748
|
}).describe(
|
|
2749
2749
|
"Configuration that limits the series or categories that are charted."
|
|
2750
|
-
).strict(),
|
|
2751
|
-
lineWidth:
|
|
2752
|
-
subtype:
|
|
2753
|
-
markers:
|
|
2754
|
-
navigator:
|
|
2755
|
-
dataLimits:
|
|
2756
|
-
legend:
|
|
2750
|
+
).strict(), sr = o.object({
|
|
2751
|
+
lineWidth: or.optional(),
|
|
2752
|
+
subtype: ir.optional(),
|
|
2753
|
+
markers: Q.optional(),
|
|
2754
|
+
navigator: ie.optional(),
|
|
2755
|
+
dataLimits: L.optional(),
|
|
2756
|
+
legend: j.optional(),
|
|
2757
2757
|
xAxis: B.optional(),
|
|
2758
2758
|
yAxis: F.optional(),
|
|
2759
2759
|
y2Axis: q.optional(),
|
|
2760
2760
|
seriesLabels: E.optional()
|
|
2761
|
-
}).strict(),
|
|
2761
|
+
}).strict(), Ee = o.object({
|
|
2762
2762
|
subtype: o.enum(["bar/classic", "bar/stacked", "bar/stacked100"]).optional(),
|
|
2763
|
-
markers:
|
|
2764
|
-
navigator:
|
|
2765
|
-
legend:
|
|
2763
|
+
markers: Q.optional(),
|
|
2764
|
+
navigator: ie.optional(),
|
|
2765
|
+
legend: j.optional(),
|
|
2766
2766
|
xAxis: B.optional(),
|
|
2767
2767
|
yAxis: F.optional(),
|
|
2768
2768
|
y2Axis: q.optional(),
|
|
2769
2769
|
seriesLabels: E.optional()
|
|
2770
|
-
}).strict(),
|
|
2770
|
+
}).strict(), lr = o.object({
|
|
2771
2771
|
enabled: o.boolean().optional().describe(
|
|
2772
2772
|
"Boolean flag that defines if convolution ability should be enabled on chart"
|
|
2773
2773
|
),
|
|
@@ -2780,25 +2780,25 @@ const it = async (e, t, n) => {
|
|
|
2780
2780
|
selectedConvolutionType: o.enum(["byPercentage", "bySlicesCount"]).optional().describe("Selected type of convolution behavior")
|
|
2781
2781
|
}).describe(
|
|
2782
2782
|
'Configuration that defines the ability of the Pie chart to collapse (convolve) and hide part of the data under the single category "Others".'
|
|
2783
|
-
).strict(),
|
|
2783
|
+
).strict(), cr = o.object({
|
|
2784
2784
|
subtype: o.enum(["pie/basic", "pie/donut", "pie/ring"]).optional(),
|
|
2785
2785
|
seriesLabels: E.optional(),
|
|
2786
|
-
legend:
|
|
2787
|
-
convolution:
|
|
2788
|
-
}).strict(),
|
|
2789
|
-
markers:
|
|
2790
|
-
dataLimits:
|
|
2786
|
+
legend: j.optional(),
|
|
2787
|
+
convolution: lr.optional()
|
|
2788
|
+
}).strict(), ur = o.object({
|
|
2789
|
+
markers: Q.optional(),
|
|
2790
|
+
dataLimits: L.optional(),
|
|
2791
2791
|
markerSize: o.object({
|
|
2792
2792
|
scatterBubbleMaxSize: o.number().optional().describe("Maximum size of markers"),
|
|
2793
2793
|
scatterBubbleMinSize: o.number().optional().describe("Minimum size of markers"),
|
|
2794
2794
|
scatterDefaultSize: o.number().optional().describe("Default size of markers")
|
|
2795
2795
|
}).optional().describe("Size of markers"),
|
|
2796
|
-
legend:
|
|
2796
|
+
legend: j.optional(),
|
|
2797
2797
|
xAxis: B.optional(),
|
|
2798
2798
|
yAxis: F.optional(),
|
|
2799
2799
|
y2Axis: q.optional(),
|
|
2800
2800
|
seriesLabels: E.optional()
|
|
2801
|
-
}).strict(),
|
|
2801
|
+
}).strict(), dr = o.object({
|
|
2802
2802
|
subtype: o.enum([
|
|
2803
2803
|
"area/basic",
|
|
2804
2804
|
"area/spline",
|
|
@@ -2808,14 +2808,14 @@ const it = async (e, t, n) => {
|
|
|
2808
2808
|
"area/stackedspline100"
|
|
2809
2809
|
]).optional(),
|
|
2810
2810
|
opacity: o.number().optional(),
|
|
2811
|
-
navigator:
|
|
2812
|
-
legend:
|
|
2811
|
+
navigator: ie.optional(),
|
|
2812
|
+
legend: j.optional(),
|
|
2813
2813
|
xAxis: B.optional(),
|
|
2814
2814
|
yAxis: F.optional(),
|
|
2815
2815
|
y2Axis: q.optional(),
|
|
2816
2816
|
seriesLabels: E.optional()
|
|
2817
|
-
}).strict(),
|
|
2818
|
-
dataLimits:
|
|
2817
|
+
}).strict(), pr = o.object({
|
|
2818
|
+
dataLimits: L.optional(),
|
|
2819
2819
|
funnelDirection: o.enum(["inverted", "regular"]).optional().describe("Direction of FunnelChart narrowing"),
|
|
2820
2820
|
funnelSize: o.enum(["narrow", "regular", "wide"]).optional().describe(
|
|
2821
2821
|
"Visual size of the lowest slice (degree of funnel narrowing from highest to lowest slices)"
|
|
@@ -2825,9 +2825,9 @@ const it = async (e, t, n) => {
|
|
|
2825
2825
|
neckHeight: o.number().optional(),
|
|
2826
2826
|
neckWidth: o.number().optional(),
|
|
2827
2827
|
seriesLabels: E.optional(),
|
|
2828
|
-
legend:
|
|
2829
|
-
}).strict(),
|
|
2830
|
-
dataLimits:
|
|
2828
|
+
legend: j.optional()
|
|
2829
|
+
}).strict(), mr = o.object({
|
|
2830
|
+
dataLimits: L.optional(),
|
|
2831
2831
|
layout: o.enum([
|
|
2832
2832
|
"squarified",
|
|
2833
2833
|
"stripes",
|
|
@@ -2837,54 +2837,54 @@ const it = async (e, t, n) => {
|
|
|
2837
2837
|
borderWidth: o.number().optional(),
|
|
2838
2838
|
borderColor: o.string().optional(),
|
|
2839
2839
|
seriesLabels: E.optional(),
|
|
2840
|
-
legend:
|
|
2840
|
+
legend: j.optional(),
|
|
2841
2841
|
tooltip: o.object({
|
|
2842
2842
|
mode: o.enum(["contribution", "value"]).optional().describe("Define mode of data showing")
|
|
2843
2843
|
})
|
|
2844
|
-
}).strict(),
|
|
2845
|
-
dataLimits:
|
|
2844
|
+
}).strict(), hr = o.object({
|
|
2845
|
+
dataLimits: L.optional(),
|
|
2846
2846
|
levels: o.number().optional(),
|
|
2847
2847
|
borderWidth: o.number().optional(),
|
|
2848
2848
|
borderColor: o.string().optional(),
|
|
2849
2849
|
seriesLabels: E.optional(),
|
|
2850
|
-
legend:
|
|
2851
|
-
}).strict(),
|
|
2852
|
-
dataLimits:
|
|
2850
|
+
legend: j.optional()
|
|
2851
|
+
}).strict(), gr = o.object({
|
|
2852
|
+
dataLimits: L.optional(),
|
|
2853
2853
|
subtype: o.enum(["boxplot/full", "boxplot/hollow"]).optional(),
|
|
2854
2854
|
boxType: o.enum(["iqr", "extremums", "standardDeviation"]).optional(),
|
|
2855
2855
|
outliersEnabled: o.boolean().optional(),
|
|
2856
2856
|
width: o.number().optional(),
|
|
2857
|
-
legend:
|
|
2857
|
+
legend: j.optional(),
|
|
2858
2858
|
xAxis: B.optional(),
|
|
2859
2859
|
yAxis: F.optional(),
|
|
2860
2860
|
y2Axis: q.optional(),
|
|
2861
|
-
markers:
|
|
2861
|
+
markers: Q.optional(),
|
|
2862
2862
|
seriesLabels: E.optional()
|
|
2863
|
-
}).strict(),
|
|
2863
|
+
}).strict(), fr = o.object({
|
|
2864
2864
|
subtype: o.enum(["indicator/numeric", "indicator/gauge"]).optional(),
|
|
2865
2865
|
value: o.number().optional(),
|
|
2866
2866
|
min: o.number().optional(),
|
|
2867
2867
|
max: o.number().optional(),
|
|
2868
2868
|
thresholds: o.array(o.number()).optional(),
|
|
2869
2869
|
seriesLabels: E.optional(),
|
|
2870
|
-
legend:
|
|
2870
|
+
legend: j.optional(),
|
|
2871
2871
|
forceTickerView: o.boolean().optional().describe(
|
|
2872
2872
|
"Boolean flag to force render indicator in ticker mode regardless of display size"
|
|
2873
2873
|
),
|
|
2874
2874
|
skin: o.enum(["1", "2"]).optional().describe("Skin gauge indicator")
|
|
2875
|
-
}).strict(),
|
|
2876
|
-
dataLimits:
|
|
2875
|
+
}).strict(), br = o.object({
|
|
2876
|
+
dataLimits: L.optional(),
|
|
2877
2877
|
height: o.number().optional(),
|
|
2878
2878
|
width: o.number().optional(),
|
|
2879
|
-
legend:
|
|
2880
|
-
markers:
|
|
2881
|
-
navigator:
|
|
2879
|
+
legend: j.optional(),
|
|
2880
|
+
markers: Q.optional(),
|
|
2881
|
+
navigator: ie.optional(),
|
|
2882
2882
|
subtype: o.enum(["polar/area", "polar/column", "polar/line"]).optional(),
|
|
2883
2883
|
xAxis: B.optional(),
|
|
2884
2884
|
yAxis: F.optional(),
|
|
2885
2885
|
y2Axis: q.optional(),
|
|
2886
2886
|
seriesLabels: E.optional()
|
|
2887
|
-
}),
|
|
2887
|
+
}), ct = o.object({
|
|
2888
2888
|
columns: o.object({
|
|
2889
2889
|
alternatingColor: o.object({
|
|
2890
2890
|
enabled: o.boolean().optional(),
|
|
@@ -2910,34 +2910,34 @@ const it = async (e, t, n) => {
|
|
|
2910
2910
|
rowsPerPage: o.number().optional().describe("Number of rows per page"),
|
|
2911
2911
|
paddingHorizontal: o.number().optional().describe("Horizontal padding around whole table"),
|
|
2912
2912
|
paddingVertical: o.number().optional().describe("Vertical padding around whole table")
|
|
2913
|
-
}),
|
|
2914
|
-
line:
|
|
2915
|
-
bar:
|
|
2916
|
-
area:
|
|
2917
|
-
column:
|
|
2913
|
+
}), yr = {
|
|
2914
|
+
line: sr,
|
|
2915
|
+
bar: Ee,
|
|
2916
|
+
area: dr,
|
|
2917
|
+
column: Ee,
|
|
2918
2918
|
// Assuming column is similar to bar; adjust as needed
|
|
2919
|
-
pie:
|
|
2920
|
-
scatter:
|
|
2921
|
-
funnel:
|
|
2922
|
-
treemap:
|
|
2923
|
-
sunburst:
|
|
2924
|
-
boxplot:
|
|
2925
|
-
indicator:
|
|
2926
|
-
polar:
|
|
2927
|
-
table:
|
|
2919
|
+
pie: cr,
|
|
2920
|
+
scatter: ur,
|
|
2921
|
+
funnel: pr,
|
|
2922
|
+
treemap: mr,
|
|
2923
|
+
sunburst: hr,
|
|
2924
|
+
boxplot: gr,
|
|
2925
|
+
indicator: fr,
|
|
2926
|
+
polar: br,
|
|
2927
|
+
table: ct,
|
|
2928
2928
|
arearange: o.object({}),
|
|
2929
2929
|
scattermap: o.object({}),
|
|
2930
2930
|
areamap: o.object({}),
|
|
2931
2931
|
"calendar-heatmap": o.object({}),
|
|
2932
2932
|
streamgraph: o.object({})
|
|
2933
|
-
},
|
|
2934
|
-
chartType:
|
|
2933
|
+
}, wr = o.object({
|
|
2934
|
+
chartType: re
|
|
2935
2935
|
});
|
|
2936
|
-
function
|
|
2937
|
-
const t =
|
|
2936
|
+
function vr(e) {
|
|
2937
|
+
const t = yr[e];
|
|
2938
2938
|
if (!t)
|
|
2939
2939
|
throw new Error(`Unsupported chart type: ${e}`);
|
|
2940
|
-
return
|
|
2940
|
+
return wr.extend({
|
|
2941
2941
|
styleOptions: t
|
|
2942
2942
|
});
|
|
2943
2943
|
}
|
|
@@ -2962,9 +2962,9 @@ o.object({
|
|
|
2962
2962
|
const ke = o.object({
|
|
2963
2963
|
name: o.string(),
|
|
2964
2964
|
title: o.string()
|
|
2965
|
-
}),
|
|
2965
|
+
}), V = o.string().describe("hex color code for the measure.");
|
|
2966
2966
|
o.object({
|
|
2967
|
-
color:
|
|
2967
|
+
color: V,
|
|
2968
2968
|
type: o.enum(["uniform"]).describe("Type of color to be used for the measure.")
|
|
2969
2969
|
}).describe(
|
|
2970
2970
|
"Uniform color options for data similar to the Single Color option in the Sisense UI."
|
|
@@ -2972,12 +2972,12 @@ o.object({
|
|
|
2972
2972
|
o.object({
|
|
2973
2973
|
conditions: o.array(
|
|
2974
2974
|
o.object({
|
|
2975
|
-
color:
|
|
2975
|
+
color: V,
|
|
2976
2976
|
expression: o.string(),
|
|
2977
2977
|
operator: o.enum(["<", ">", ">=", "<="])
|
|
2978
2978
|
})
|
|
2979
2979
|
).describe("Array of color conditions"),
|
|
2980
|
-
defaultColor:
|
|
2980
|
+
defaultColor: V.describe(
|
|
2981
2981
|
"Default color when no condition is met"
|
|
2982
2982
|
),
|
|
2983
2983
|
type: o.enum(["conditional"]).describe("Color options type")
|
|
@@ -2988,7 +2988,7 @@ o.object({
|
|
|
2988
2988
|
color: o.string().describe("hex color code for the measure.")
|
|
2989
2989
|
});
|
|
2990
2990
|
o.object({
|
|
2991
|
-
maxColor:
|
|
2991
|
+
maxColor: V.describe(
|
|
2992
2992
|
"End color of the range"
|
|
2993
2993
|
).optional(),
|
|
2994
2994
|
maxValue: o.number().describe(
|
|
@@ -2997,7 +2997,7 @@ o.object({
|
|
|
2997
2997
|
midValue: o.number().describe(
|
|
2998
2998
|
"Middle value explicitly set to override the middle value of the data"
|
|
2999
2999
|
).optional(),
|
|
3000
|
-
minColor:
|
|
3000
|
+
minColor: V.describe(
|
|
3001
3001
|
"Start color of the range"
|
|
3002
3002
|
).optional(),
|
|
3003
3003
|
minValue: o.number().describe(
|
|
@@ -3006,7 +3006,7 @@ o.object({
|
|
|
3006
3006
|
steps: o.number().describe("Distinct number of colors in the range").optional(),
|
|
3007
3007
|
type: o.enum(["range"]).describe("Color options type")
|
|
3008
3008
|
}).describe("Color options for range color.");
|
|
3009
|
-
const
|
|
3009
|
+
const Me = o.object({
|
|
3010
3010
|
bilion: o.boolean().optional().describe(
|
|
3011
3011
|
"Boolean flag whether to show an abbreviation for a number greater than or equal one billion - e.g. 1B"
|
|
3012
3012
|
),
|
|
@@ -3028,7 +3028,7 @@ const Ee = o.object({
|
|
|
3028
3028
|
trillion: o.boolean().optional().describe(
|
|
3029
3029
|
"Boolean flag whether to show an abbreviation for a number greater than or equal one trillion - e.g. 1T"
|
|
3030
3030
|
)
|
|
3031
|
-
}),
|
|
3031
|
+
}), Sr = o.object({
|
|
3032
3032
|
ignoreAnomalies: o.boolean().optional().describe(
|
|
3033
3033
|
"Boolean flag that enables the function to automatically identify and ignore anomalous values in the series. This can be particularly useful when you want to maintain the integrity of your analysis by avoiding potential outliers. default is false"
|
|
3034
3034
|
),
|
|
@@ -3040,7 +3040,7 @@ const Ee = o.object({
|
|
|
3040
3040
|
]).optional().describe(
|
|
3041
3041
|
"Trend analysis model type to be used for the operation. default is linear"
|
|
3042
3042
|
)
|
|
3043
|
-
}).describe("Trend analysis options for the measure"),
|
|
3043
|
+
}).describe("Trend analysis options for the measure"), Or = o.object({
|
|
3044
3044
|
confidenceInterval: o.number().optional().describe(
|
|
3045
3045
|
"Confidence interval showing the probabilistic upper and lower limits of the forecasted series according to the uncertainty level. The valid range is (0.8 <= X < 1). default is 0.8"
|
|
3046
3046
|
),
|
|
@@ -3065,7 +3065,7 @@ const Ee = o.object({
|
|
|
3065
3065
|
upperBound: o.number().optional().describe(
|
|
3066
3066
|
"Expected upper limit to improve the forecast accuracy when reaching the limit. Note that values in the confidence interval can exceed this limit."
|
|
3067
3067
|
)
|
|
3068
|
-
}).describe("Forecast analysis options for the measure"),
|
|
3068
|
+
}).describe("Forecast analysis options for the measure"), C = {
|
|
3069
3069
|
measures: o.object({
|
|
3070
3070
|
column: ke,
|
|
3071
3071
|
chartType: o.enum(["line", "bar", "column", "area"]).describe(
|
|
@@ -3084,7 +3084,7 @@ const Ee = o.object({
|
|
|
3084
3084
|
dataBarsColor: o.string().describe(
|
|
3085
3085
|
"pivot table only - Color options for data bars for this measure in the pivot table"
|
|
3086
3086
|
),
|
|
3087
|
-
numberFormatConfig:
|
|
3087
|
+
numberFormatConfig: Me.describe(
|
|
3088
3088
|
"Configuration for number formatting."
|
|
3089
3089
|
),
|
|
3090
3090
|
seriesStyleOptions: o.object({}).describe(
|
|
@@ -3099,8 +3099,8 @@ const Ee = o.object({
|
|
|
3099
3099
|
treatNullDataAsZeros: o.boolean().describe(
|
|
3100
3100
|
"Boolean flag whether null values are treated as zeros in the chart"
|
|
3101
3101
|
),
|
|
3102
|
-
trend:
|
|
3103
|
-
forecast:
|
|
3102
|
+
trend: Sr.optional().describe("Trend analysis options for the measure."),
|
|
3103
|
+
forecast: Or.optional().describe("Forecast analysis options for the measure.")
|
|
3104
3104
|
}).describe("Configuration for measures.StyledMeasure"),
|
|
3105
3105
|
dimensions: o.object({
|
|
3106
3106
|
column: ke,
|
|
@@ -3128,145 +3128,147 @@ const Ee = o.object({
|
|
|
3128
3128
|
isHtml: o.boolean().describe(
|
|
3129
3129
|
"Boolean flag whether to render category/column value as HTML in the Table component."
|
|
3130
3130
|
),
|
|
3131
|
-
numberFormatConfig:
|
|
3131
|
+
numberFormatConfig: Me.describe(
|
|
3132
3132
|
"Configuration for number formatting."
|
|
3133
3133
|
),
|
|
3134
3134
|
sortType: o.enum(["sortAsc", "sortDesc", "sortNone"]).describe(
|
|
3135
3135
|
"Sorting configuration that represents either SortDirection or PivotRowsSort for the pivot table"
|
|
3136
3136
|
)
|
|
3137
3137
|
}).describe("Configuration for dimensions. StyledColumn")
|
|
3138
|
-
},
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
breakBy: o.array(
|
|
3138
|
+
}, U = o.object({
|
|
3139
|
+
value: o.array(C.measures),
|
|
3140
|
+
category: o.array(C.dimensions),
|
|
3141
|
+
breakBy: o.array(C.dimensions),
|
|
3142
|
+
seriesToColorMap: o.object({}).describe(
|
|
3143
|
+
"Optional mapping of each of the series to colors. (key: color)"
|
|
3144
|
+
)
|
|
3145
|
+
}), H = o.object({
|
|
3146
|
+
value: o.array(C.measures),
|
|
3147
|
+
category: o.array(C.dimensions),
|
|
3142
3148
|
seriesToColorMap: o.object({}).describe(
|
|
3143
3149
|
"Optional mapping of each of the series to colors. (key: color)"
|
|
3144
3150
|
)
|
|
3145
|
-
}), Z = o.object({
|
|
3146
|
-
values: o.array(O.measures),
|
|
3147
|
-
categories: o.array(O.dimensions),
|
|
3148
|
-
seriesToColorMap: o.object({}).describe("Color mapping for series to color.")
|
|
3149
|
-
}), ct = o.object({
|
|
3150
|
-
y: O.measures,
|
|
3151
|
-
x: O.dimensions,
|
|
3152
|
-
breakByColor: O.measures,
|
|
3153
|
-
breakBySize: O.measures,
|
|
3154
|
-
seriesToColorMap: O.measures,
|
|
3155
|
-
size: O.measures
|
|
3156
3151
|
}), ut = o.object({
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3152
|
+
y: C.measures,
|
|
3153
|
+
x: C.measures,
|
|
3154
|
+
breakByColor: C.measures,
|
|
3155
|
+
breakByPoint: C.dimensions,
|
|
3156
|
+
size: C.measures,
|
|
3157
|
+
seriesToColorMap: o.object({}).describe(
|
|
3158
|
+
"Optional mapping of each of the series to colors. (key: color)"
|
|
3159
|
+
)
|
|
3161
3160
|
}), dt = o.object({
|
|
3161
|
+
min: o.array(C.measures),
|
|
3162
|
+
max: o.array(C.measures),
|
|
3163
|
+
secondary: o.array(C.measures),
|
|
3164
|
+
value: o.array(C.measures)
|
|
3165
|
+
}), pt = o.object({
|
|
3162
3166
|
boxType: o.enum(["extremums", "iqr", "standardDeviation"]),
|
|
3163
|
-
category: o.array(
|
|
3167
|
+
category: o.array(C.dimensions),
|
|
3164
3168
|
outliersEnabled: o.boolean().optional(),
|
|
3165
|
-
value: o.array(
|
|
3166
|
-
}),
|
|
3167
|
-
colorBy:
|
|
3169
|
+
value: o.array(C.measures)
|
|
3170
|
+
}), Cr = o.object({
|
|
3171
|
+
colorBy: C.measures,
|
|
3168
3172
|
// todo: or statement dimensions or measures
|
|
3169
|
-
details:
|
|
3170
|
-
geo: o.array(
|
|
3171
|
-
size:
|
|
3172
|
-
}),
|
|
3173
|
-
color: o.array(
|
|
3174
|
-
geo: o.array(
|
|
3175
|
-
}),
|
|
3176
|
-
date: o.array(
|
|
3177
|
-
value: o.array(
|
|
3178
|
-
}),
|
|
3179
|
-
columns: o.array(
|
|
3180
|
-
}),
|
|
3173
|
+
details: C.dimensions,
|
|
3174
|
+
geo: o.array(C.dimensions),
|
|
3175
|
+
size: C.measures
|
|
3176
|
+
}), Dr = o.object({
|
|
3177
|
+
color: o.array(C.measures),
|
|
3178
|
+
geo: o.array(C.dimensions)
|
|
3179
|
+
}), mt = o.object({
|
|
3180
|
+
date: o.array(C.dimensions),
|
|
3181
|
+
value: o.array(C.measures)
|
|
3182
|
+
}), Ar = o.object({
|
|
3183
|
+
columns: o.array(C.dimensions)
|
|
3184
|
+
}), G = (e) => {
|
|
3181
3185
|
switch (e) {
|
|
3182
3186
|
case "line":
|
|
3183
3187
|
case "bar":
|
|
3184
3188
|
case "column":
|
|
3185
3189
|
case "area":
|
|
3186
3190
|
case "polar":
|
|
3187
|
-
return
|
|
3191
|
+
return U;
|
|
3188
3192
|
case "pie":
|
|
3189
3193
|
case "funnel":
|
|
3190
3194
|
case "treemap":
|
|
3191
3195
|
case "sunburst":
|
|
3192
|
-
return
|
|
3196
|
+
return H;
|
|
3193
3197
|
case "scatter":
|
|
3194
|
-
return ct;
|
|
3195
|
-
case "indicator":
|
|
3196
3198
|
return ut;
|
|
3199
|
+
case "indicator":
|
|
3200
|
+
return dt;
|
|
3197
3201
|
case "table":
|
|
3198
|
-
return
|
|
3202
|
+
return Ar;
|
|
3199
3203
|
case "boxplot":
|
|
3200
|
-
return
|
|
3204
|
+
return pt;
|
|
3201
3205
|
case "scattermap":
|
|
3202
|
-
return
|
|
3206
|
+
return Cr;
|
|
3203
3207
|
case "areamap":
|
|
3204
|
-
return
|
|
3208
|
+
return Dr;
|
|
3205
3209
|
case "calendar-heatmap":
|
|
3206
|
-
return
|
|
3210
|
+
return mt;
|
|
3207
3211
|
default:
|
|
3208
3212
|
return o.object({});
|
|
3209
3213
|
}
|
|
3210
|
-
},
|
|
3211
|
-
line:
|
|
3212
|
-
bar:
|
|
3213
|
-
area:
|
|
3214
|
-
column:
|
|
3214
|
+
}, di = {
|
|
3215
|
+
line: U,
|
|
3216
|
+
bar: U,
|
|
3217
|
+
area: U,
|
|
3218
|
+
column: U,
|
|
3215
3219
|
// Assuming column is similar to bar; adjust as needed
|
|
3216
|
-
pie:
|
|
3217
|
-
scatter:
|
|
3218
|
-
funnel:
|
|
3219
|
-
treemap:
|
|
3220
|
-
sunburst:
|
|
3221
|
-
boxplot:
|
|
3222
|
-
indicator:
|
|
3223
|
-
polar:
|
|
3224
|
-
table:
|
|
3220
|
+
pie: H,
|
|
3221
|
+
scatter: ut,
|
|
3222
|
+
funnel: H,
|
|
3223
|
+
treemap: H,
|
|
3224
|
+
sunburst: H,
|
|
3225
|
+
boxplot: pt,
|
|
3226
|
+
indicator: dt,
|
|
3227
|
+
polar: U,
|
|
3228
|
+
table: ct,
|
|
3225
3229
|
arearange: o.object({}),
|
|
3226
3230
|
scattermap: o.object({}),
|
|
3227
3231
|
areamap: o.object({}),
|
|
3228
|
-
"calendar-heatmap":
|
|
3232
|
+
"calendar-heatmap": mt,
|
|
3229
3233
|
streamgraph: o.object({})
|
|
3230
|
-
},
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
});
|
|
3238
|
-
const s = `
|
|
3234
|
+
}, se = (e, t, n) => {
|
|
3235
|
+
const { dataOptions: a } = e;
|
|
3236
|
+
if (!(t instanceof o.ZodObject))
|
|
3237
|
+
throw new Error(
|
|
3238
|
+
"Expected filteredSchema to be a ZodObject, but got a different type"
|
|
3239
|
+
);
|
|
3240
|
+
return `
|
|
3239
3241
|
You are a chart data options assistant. You edit only the fields the user mentions.
|
|
3240
3242
|
|
|
3241
3243
|
DO NOT use any tools.
|
|
3242
3244
|
|
|
3243
3245
|
Here are the editable properties:
|
|
3244
3246
|
${`
|
|
3245
|
-
Editable chart data options properties are as follows:
|
|
3246
|
-
|
|
3247
|
+
Editable chart data options properties are as follows:
|
|
3247
3248
|
|
|
3248
3249
|
dataOptions: {
|
|
3249
|
-
${Object.entries(
|
|
3250
|
-
([
|
|
3250
|
+
${Object.entries(t.shape).map(
|
|
3251
|
+
([s, l]) => `- ${s}: ${I(l)}`
|
|
3251
3252
|
).join(`
|
|
3252
3253
|
`)}
|
|
3253
3254
|
}
|
|
3254
3255
|
|
|
3255
3256
|
current dataOptions: {
|
|
3256
|
-
${JSON.stringify(
|
|
3257
|
+
${JSON.stringify(a, null, 2)}
|
|
3257
3258
|
}
|
|
3258
3259
|
`}
|
|
3259
3260
|
|
|
3260
3261
|
Your output must be a JSON object with only the requested changes.
|
|
3261
3262
|
|
|
3262
|
-
The 'column' object, containing only the item's 'name', MUST be included for any change to an item within a list field ('
|
|
3263
|
-
to maintain identity.
|
|
3263
|
+
The 'column' object, containing only the item's 'name', MUST be included for any change to an item within a list field ('value', 'category', 'breakBy', etc.) to maintain identity.
|
|
3264
3264
|
|
|
3265
3265
|
Do not include unchanged fields.
|
|
3266
|
+
${n ? `
|
|
3267
|
+
${n}` : ""}
|
|
3266
3268
|
|
|
3267
3269
|
Example:
|
|
3268
3270
|
|
|
3269
|
-
User: "Sort revenue in descending order"
|
|
3271
|
+
User: "Sort brands by total revenue in descending order"
|
|
3270
3272
|
Output: { "dataOptions": { "value" : [
|
|
3271
3273
|
{
|
|
3272
3274
|
"column": {
|
|
@@ -3276,19 +3278,29 @@ const Ee = o.object({
|
|
|
3276
3278
|
}
|
|
3277
3279
|
] } }
|
|
3278
3280
|
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3281
|
+
`;
|
|
3282
|
+
}, Pr = async ({
|
|
3283
|
+
systemPrompt: e,
|
|
3284
|
+
userPrompt: t,
|
|
3285
|
+
chartWidgetProps: n
|
|
3286
|
+
}) => {
|
|
3287
|
+
const { chartType: a } = n, r = G(a);
|
|
3288
|
+
o.object({
|
|
3289
|
+
dataOptions: r
|
|
3290
|
+
});
|
|
3291
|
+
const i = await ve({
|
|
3292
|
+
systemPrompt: e,
|
|
3293
|
+
userPrompt: t,
|
|
3282
3294
|
responseFormat: { type: "json_object" }
|
|
3283
3295
|
});
|
|
3284
|
-
console.debug("LLM RESPONSE DATA OPTIONS",
|
|
3285
|
-
const { dataOptions:
|
|
3296
|
+
console.debug("LLM RESPONSE DATA OPTIONS", i);
|
|
3297
|
+
const { dataOptions: s = null } = i, l = s ? Tr(n.dataOptions, s) : n.dataOptions;
|
|
3286
3298
|
return {
|
|
3287
|
-
...
|
|
3288
|
-
dataOptions:
|
|
3299
|
+
...n,
|
|
3300
|
+
dataOptions: l
|
|
3289
3301
|
};
|
|
3290
3302
|
};
|
|
3291
|
-
function
|
|
3303
|
+
function Tr(e, t) {
|
|
3292
3304
|
const n = { ...e };
|
|
3293
3305
|
for (const a of Object.keys(t)) {
|
|
3294
3306
|
const r = a, i = t[r], s = e[r] || [];
|
|
@@ -3296,16 +3308,16 @@ function Cr(e, t) {
|
|
|
3296
3308
|
var u;
|
|
3297
3309
|
const c = (u = l == null ? void 0 : l.column) == null ? void 0 : u.name, d = i.find(
|
|
3298
3310
|
(p) => {
|
|
3299
|
-
var
|
|
3300
|
-
return ((
|
|
3311
|
+
var g;
|
|
3312
|
+
return ((g = p == null ? void 0 : p.column) == null ? void 0 : g.name) === c;
|
|
3301
3313
|
}
|
|
3302
3314
|
);
|
|
3303
3315
|
if (d) {
|
|
3304
3316
|
const p = { ...l };
|
|
3305
|
-
return Object.keys(d).forEach((
|
|
3306
|
-
if (
|
|
3307
|
-
const
|
|
3308
|
-
|
|
3317
|
+
return Object.keys(d).forEach((g) => {
|
|
3318
|
+
if (g !== "column") {
|
|
3319
|
+
const h = d[g];
|
|
3320
|
+
h == null ? delete p[g] : p[g] = h;
|
|
3309
3321
|
}
|
|
3310
3322
|
}), p;
|
|
3311
3323
|
}
|
|
@@ -3314,98 +3326,183 @@ function Cr(e, t) {
|
|
|
3314
3326
|
}
|
|
3315
3327
|
return n;
|
|
3316
3328
|
}
|
|
3317
|
-
const
|
|
3318
|
-
var
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
if (!a)
|
|
3329
|
+
const _r = async ({ chartId: e, userPrompt: t }, n, a) => {
|
|
3330
|
+
var s, l;
|
|
3331
|
+
const r = (s = a.retrieveChart) == null ? void 0 : s.call(a, e);
|
|
3332
|
+
if (!r)
|
|
3322
3333
|
throw new Error("Chart not found");
|
|
3323
|
-
const
|
|
3334
|
+
const i = await Pr({
|
|
3335
|
+
systemPrompt: n,
|
|
3324
3336
|
userPrompt: t,
|
|
3325
|
-
chartWidgetProps:
|
|
3337
|
+
chartWidgetProps: r
|
|
3326
3338
|
});
|
|
3327
|
-
return (
|
|
3339
|
+
return (l = a.saveChart) == null || l.call(a, e, i), {
|
|
3328
3340
|
message: "Chart data options updated successfully"
|
|
3329
3341
|
};
|
|
3330
|
-
}
|
|
3331
|
-
|
|
3342
|
+
}, le = (e) => async ({ chartId: t, userPrompt: n }, a) => {
|
|
3343
|
+
var s;
|
|
3344
|
+
console.debug("toolCall", e.toolName, t, n);
|
|
3345
|
+
const r = (s = a.retrieveChart) == null ? void 0 : s.call(a, t);
|
|
3346
|
+
if (!r)
|
|
3347
|
+
throw new Error("Chart not found");
|
|
3348
|
+
const i = e.buildSystemPrompt(r);
|
|
3349
|
+
return _r(
|
|
3350
|
+
{ chartId: t, userPrompt: n },
|
|
3351
|
+
i,
|
|
3352
|
+
a
|
|
3353
|
+
);
|
|
3354
|
+
}, xr = {
|
|
3355
|
+
toolName: "updateChartTypeOfMeasures",
|
|
3356
|
+
buildSystemPrompt: (e) => {
|
|
3357
|
+
const t = G(
|
|
3358
|
+
e.chartType
|
|
3359
|
+
), n = ye(t, [
|
|
3360
|
+
"column",
|
|
3361
|
+
"chartType"
|
|
3362
|
+
]);
|
|
3363
|
+
return se(
|
|
3364
|
+
e,
|
|
3365
|
+
n
|
|
3366
|
+
);
|
|
3367
|
+
}
|
|
3368
|
+
}, $r = {
|
|
3369
|
+
toolName: "updateChartSorting",
|
|
3370
|
+
buildSystemPrompt: (e) => {
|
|
3371
|
+
const t = G(
|
|
3372
|
+
e.chartType
|
|
3373
|
+
), n = ye(t, [
|
|
3374
|
+
"column",
|
|
3375
|
+
"sortType"
|
|
3376
|
+
]);
|
|
3377
|
+
return se(
|
|
3378
|
+
e,
|
|
3379
|
+
n,
|
|
3380
|
+
"IMPORTANT: When setting sortType on a column within dataOptions, if sortType exists on any other column, set it to null to ensure only one is active."
|
|
3381
|
+
);
|
|
3382
|
+
}
|
|
3383
|
+
}, jr = {
|
|
3384
|
+
toolName: "updateTrendAndForecast",
|
|
3385
|
+
buildSystemPrompt: (e) => {
|
|
3386
|
+
const t = G(
|
|
3387
|
+
e.chartType
|
|
3388
|
+
), n = ye(t, [
|
|
3389
|
+
"column",
|
|
3390
|
+
"trend",
|
|
3391
|
+
"forecast"
|
|
3392
|
+
]);
|
|
3393
|
+
return se(
|
|
3394
|
+
e,
|
|
3395
|
+
n
|
|
3396
|
+
);
|
|
3397
|
+
}
|
|
3398
|
+
}, Er = {
|
|
3399
|
+
toolName: "updateOtherChartDataOptions",
|
|
3400
|
+
buildSystemPrompt: (e) => {
|
|
3401
|
+
const t = G(
|
|
3402
|
+
e.chartType
|
|
3403
|
+
), n = yn(t, [
|
|
3404
|
+
"sortType",
|
|
3405
|
+
// Has dedicated sorting tool
|
|
3406
|
+
"trend",
|
|
3407
|
+
// Has dedicated trend/forecast tool
|
|
3408
|
+
"forecast",
|
|
3409
|
+
// Has dedicated trend/forecast tool
|
|
3410
|
+
"chartType"
|
|
3411
|
+
// Has dedicated chartType tool
|
|
3412
|
+
]);
|
|
3413
|
+
return se(
|
|
3414
|
+
e,
|
|
3415
|
+
n,
|
|
3416
|
+
'IMPORTANT: This tool cannot swap data columns (e.g. changing "Revenue" to "Profit"). Use createChart for that.'
|
|
3417
|
+
);
|
|
3418
|
+
}
|
|
3419
|
+
}, kr = le(
|
|
3420
|
+
xr
|
|
3421
|
+
), Mr = le(
|
|
3422
|
+
$r
|
|
3423
|
+
), Nr = le(
|
|
3424
|
+
jr
|
|
3425
|
+
), Ir = le(
|
|
3426
|
+
Er
|
|
3427
|
+
);
|
|
3428
|
+
function ht(e) {
|
|
3332
3429
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3333
3430
|
}
|
|
3334
|
-
var
|
|
3335
|
-
return
|
|
3431
|
+
var Zr = function(t) {
|
|
3432
|
+
return Lr(t) && !Rr(t);
|
|
3336
3433
|
};
|
|
3337
|
-
function
|
|
3434
|
+
function Lr(e) {
|
|
3338
3435
|
return !!e && typeof e == "object";
|
|
3339
3436
|
}
|
|
3340
|
-
function
|
|
3437
|
+
function Rr(e) {
|
|
3341
3438
|
var t = Object.prototype.toString.call(e);
|
|
3342
|
-
return t === "[object RegExp]" || t === "[object Date]" ||
|
|
3439
|
+
return t === "[object RegExp]" || t === "[object Date]" || Br(e);
|
|
3343
3440
|
}
|
|
3344
|
-
var
|
|
3345
|
-
function
|
|
3346
|
-
return e.$$typeof ===
|
|
3441
|
+
var Ur = typeof Symbol == "function" && Symbol.for, zr = Ur ? Symbol.for("react.element") : 60103;
|
|
3442
|
+
function Br(e) {
|
|
3443
|
+
return e.$$typeof === zr;
|
|
3347
3444
|
}
|
|
3348
|
-
function
|
|
3445
|
+
function Fr(e) {
|
|
3349
3446
|
return Array.isArray(e) ? [] : {};
|
|
3350
3447
|
}
|
|
3351
|
-
function
|
|
3352
|
-
return t.clone !== !1 && t.isMergeableObject(e) ?
|
|
3448
|
+
function J(e, t) {
|
|
3449
|
+
return t.clone !== !1 && t.isMergeableObject(e) ? z(Fr(e), e, t) : e;
|
|
3353
3450
|
}
|
|
3354
|
-
function
|
|
3451
|
+
function qr(e, t, n) {
|
|
3355
3452
|
return e.concat(t).map(function(a) {
|
|
3356
|
-
return
|
|
3453
|
+
return J(a, n);
|
|
3357
3454
|
});
|
|
3358
3455
|
}
|
|
3359
|
-
function
|
|
3456
|
+
function Hr(e, t) {
|
|
3360
3457
|
if (!t.customMerge)
|
|
3361
|
-
return
|
|
3458
|
+
return z;
|
|
3362
3459
|
var n = t.customMerge(e);
|
|
3363
|
-
return typeof n == "function" ? n :
|
|
3460
|
+
return typeof n == "function" ? n : z;
|
|
3364
3461
|
}
|
|
3365
|
-
function
|
|
3462
|
+
function Wr(e) {
|
|
3366
3463
|
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
|
|
3367
3464
|
return Object.propertyIsEnumerable.call(e, t);
|
|
3368
3465
|
}) : [];
|
|
3369
3466
|
}
|
|
3370
|
-
function
|
|
3371
|
-
return Object.keys(e).concat(
|
|
3467
|
+
function Ne(e) {
|
|
3468
|
+
return Object.keys(e).concat(Wr(e));
|
|
3372
3469
|
}
|
|
3373
|
-
function
|
|
3470
|
+
function gt(e, t) {
|
|
3374
3471
|
try {
|
|
3375
3472
|
return t in e;
|
|
3376
3473
|
} catch {
|
|
3377
3474
|
return !1;
|
|
3378
3475
|
}
|
|
3379
3476
|
}
|
|
3380
|
-
function
|
|
3381
|
-
return
|
|
3477
|
+
function Vr(e, t) {
|
|
3478
|
+
return gt(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
|
|
3382
3479
|
}
|
|
3383
|
-
function
|
|
3480
|
+
function Jr(e, t, n) {
|
|
3384
3481
|
var a = {};
|
|
3385
|
-
return n.isMergeableObject(e) &&
|
|
3386
|
-
a[r] =
|
|
3387
|
-
}),
|
|
3388
|
-
|
|
3482
|
+
return n.isMergeableObject(e) && Ne(e).forEach(function(r) {
|
|
3483
|
+
a[r] = J(e[r], n);
|
|
3484
|
+
}), Ne(t).forEach(function(r) {
|
|
3485
|
+
Vr(e, r) || (gt(e, r) && n.isMergeableObject(t[r]) ? a[r] = Hr(r, n)(e[r], t[r], n) : a[r] = J(t[r], n));
|
|
3389
3486
|
}), a;
|
|
3390
3487
|
}
|
|
3391
|
-
function
|
|
3392
|
-
n = n || {}, n.arrayMerge = n.arrayMerge ||
|
|
3488
|
+
function z(e, t, n) {
|
|
3489
|
+
n = n || {}, n.arrayMerge = n.arrayMerge || qr, n.isMergeableObject = n.isMergeableObject || Zr, n.cloneUnlessOtherwiseSpecified = J;
|
|
3393
3490
|
var a = Array.isArray(t), r = Array.isArray(e), i = a === r;
|
|
3394
|
-
return i ? a ? n.arrayMerge(e, t, n) :
|
|
3491
|
+
return i ? a ? n.arrayMerge(e, t, n) : Jr(e, t, n) : J(t, n);
|
|
3395
3492
|
}
|
|
3396
|
-
|
|
3493
|
+
z.all = function(t, n) {
|
|
3397
3494
|
if (!Array.isArray(t))
|
|
3398
3495
|
throw new Error("first argument should be an array");
|
|
3399
3496
|
return t.reduce(function(a, r) {
|
|
3400
|
-
return
|
|
3497
|
+
return z(a, r, n);
|
|
3401
3498
|
}, {});
|
|
3402
3499
|
};
|
|
3403
|
-
var
|
|
3404
|
-
const
|
|
3500
|
+
var Yr = z, Qr = Yr;
|
|
3501
|
+
const Gr = /* @__PURE__ */ ht(Qr), Xr = async ({
|
|
3405
3502
|
userPrompt: e,
|
|
3406
3503
|
chartWidgetProps: t
|
|
3407
3504
|
}) => {
|
|
3408
|
-
const { styleOptions: n, chartType: a } = t, r =
|
|
3505
|
+
const { styleOptions: n, chartType: a } = t, r = vr(a), s = `
|
|
3409
3506
|
You are a chart style options assistant. You edit only the fields the user mentions.
|
|
3410
3507
|
|
|
3411
3508
|
DO NOT use any tools.
|
|
@@ -3415,7 +3512,7 @@ const zr = /* @__PURE__ */ mt(Rr), Ur = async ({
|
|
|
3415
3512
|
Editable chart style properties are as follows:
|
|
3416
3513
|
|
|
3417
3514
|
styleOptions: {
|
|
3418
|
-
${Object.entries(r.shape).map(([p,
|
|
3515
|
+
${Object.entries(r.shape).map(([p, g]) => `- ${p}: ${I(g)}`).join(`
|
|
3419
3516
|
`)}
|
|
3420
3517
|
}
|
|
3421
3518
|
`}
|
|
@@ -3435,7 +3532,7 @@ const zr = /* @__PURE__ */ mt(Rr), Ur = async ({
|
|
|
3435
3532
|
systemPrompt: s,
|
|
3436
3533
|
userPrompt: e,
|
|
3437
3534
|
responseFormat: { type: "json_object" }
|
|
3438
|
-
}), { styleOptions: c = n } = l, d =
|
|
3535
|
+
}), { styleOptions: c = n } = l, d = Gr(
|
|
3439
3536
|
n || {},
|
|
3440
3537
|
c || {}
|
|
3441
3538
|
);
|
|
@@ -3443,27 +3540,27 @@ const zr = /* @__PURE__ */ mt(Rr), Ur = async ({
|
|
|
3443
3540
|
...t,
|
|
3444
3541
|
styleOptions: d
|
|
3445
3542
|
};
|
|
3446
|
-
},
|
|
3543
|
+
}, Kr = async ({ chartId: e, userPrompt: t }, n) => {
|
|
3447
3544
|
var i, s;
|
|
3448
3545
|
console.debug("toolCall", "updateChartStyleOptions", e, t);
|
|
3449
3546
|
const a = (i = n.retrieveChart) == null ? void 0 : i.call(n, e);
|
|
3450
3547
|
if (!a)
|
|
3451
3548
|
throw new Error("Chart not found");
|
|
3452
|
-
const r = await
|
|
3549
|
+
const r = await Xr({
|
|
3453
3550
|
userPrompt: t,
|
|
3454
3551
|
chartWidgetProps: a
|
|
3455
3552
|
});
|
|
3456
3553
|
return (s = n.saveChart) == null || s.call(n, e, r), {
|
|
3457
3554
|
message: "Chart style options updated successfully"
|
|
3458
3555
|
};
|
|
3459
|
-
},
|
|
3556
|
+
}, eo = "buildChart", pi = "buildDashboard", mi = "buildDataModel", to = "recommendQueries", no = "getDashboards", ao = "getDataSources", ro = "getDataSourceFields", oo = 10, io = (e, t) => ({
|
|
3460
3557
|
title: e.title,
|
|
3461
3558
|
dataSourceTitle: t,
|
|
3462
3559
|
chartType: e.chartType,
|
|
3463
3560
|
filters: "Filters to be updated",
|
|
3464
3561
|
dataOptions: "Data options to be updated",
|
|
3465
3562
|
styleOptions: "Style options to be updated"
|
|
3466
|
-
}),
|
|
3563
|
+
}), k = (e, t, n, a, r) => wn({
|
|
3467
3564
|
schema: e,
|
|
3468
3565
|
name: t,
|
|
3469
3566
|
description: n,
|
|
@@ -3471,131 +3568,71 @@ const zr = /* @__PURE__ */ mt(Rr), Ur = async ({
|
|
|
3471
3568
|
{ ...i },
|
|
3472
3569
|
{ ...r, ...s }
|
|
3473
3570
|
)
|
|
3474
|
-
}),
|
|
3475
|
-
|
|
3476
|
-
|
|
3571
|
+
}), so = (e) => [
|
|
3572
|
+
k(
|
|
3573
|
+
Mn,
|
|
3477
3574
|
"createChart",
|
|
3478
3575
|
"Create a new chart from user prompt. Use this tool for initial creation OR when adding/removing/swapping data fields (e.g. changing Revenue to Profit). This tool also handles data limits (Top 10, Bottom 5).",
|
|
3479
|
-
|
|
3576
|
+
er,
|
|
3480
3577
|
e
|
|
3481
3578
|
),
|
|
3482
|
-
|
|
3483
|
-
|
|
3579
|
+
k(
|
|
3580
|
+
Nn,
|
|
3484
3581
|
"updateChartTitle",
|
|
3485
3582
|
"Update the title of an existing chart",
|
|
3486
|
-
|
|
3583
|
+
nr,
|
|
3487
3584
|
e
|
|
3488
3585
|
),
|
|
3489
|
-
|
|
3490
|
-
|
|
3586
|
+
k(
|
|
3587
|
+
In,
|
|
3491
3588
|
"updateChartType",
|
|
3492
3589
|
"Switch the chart type of an existing chart",
|
|
3493
|
-
|
|
3590
|
+
rr,
|
|
3494
3591
|
e
|
|
3495
3592
|
),
|
|
3496
|
-
|
|
3497
|
-
|
|
3593
|
+
k(
|
|
3594
|
+
Zn,
|
|
3498
3595
|
"updateChartTypeOfMeasures",
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
See the following options for editing the chart type of existing measures:
|
|
3502
|
-
|
|
3503
|
-
${Object.entries(G).map(
|
|
3504
|
-
([t, n]) => `- ${t}: ${_(
|
|
3505
|
-
ue(n, ["column", "chartType"])
|
|
3506
|
-
)}`
|
|
3507
|
-
).join(`
|
|
3508
|
-
`)}
|
|
3509
|
-
`,
|
|
3510
|
-
Q,
|
|
3596
|
+
"Update the chart type of specific measures within a mixed/combo chart (e.g., make one measure a Bar and another a Line).",
|
|
3597
|
+
kr,
|
|
3511
3598
|
e
|
|
3512
3599
|
),
|
|
3513
|
-
|
|
3514
|
-
|
|
3600
|
+
k(
|
|
3601
|
+
Ln,
|
|
3515
3602
|
"updateChartSorting",
|
|
3516
3603
|
`Update the sorting order (Ascending/Descending) of an existing chart.
|
|
3517
3604
|
|
|
3518
|
-
IMPORTANT: This tool ONLY handles the sorting order. It does NOT handle data limits or filtering (e.g., "Top 10", "Bottom 5"). Those constraints must be applied during chart creation or regeneration
|
|
3519
|
-
|
|
3520
|
-
See the following sorting options for editing:
|
|
3521
|
-
|
|
3522
|
-
${Object.entries(G).map(
|
|
3523
|
-
([t, n]) => `- ${t}: ${_(
|
|
3524
|
-
ue(n, ["column", "sortType"])
|
|
3525
|
-
)}`
|
|
3526
|
-
).join(`
|
|
3527
|
-
`)}
|
|
3528
|
-
`,
|
|
3529
|
-
Q,
|
|
3605
|
+
IMPORTANT: This tool ONLY handles the sorting order. It does NOT handle data limits or filtering (e.g., "Top 10", "Bottom 5"). Those constraints must be applied during chart creation or regeneration.`,
|
|
3606
|
+
Mr,
|
|
3530
3607
|
e
|
|
3531
3608
|
),
|
|
3532
|
-
|
|
3533
|
-
|
|
3609
|
+
k(
|
|
3610
|
+
Rn,
|
|
3534
3611
|
"updateTrendAndForecast",
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
See the following trend and forecast analysis options for editing:
|
|
3538
|
-
|
|
3539
|
-
${Object.entries(G).map(
|
|
3540
|
-
([t, n]) => `- ${t}: ${_(
|
|
3541
|
-
ue(n, [
|
|
3542
|
-
"column",
|
|
3543
|
-
"trend",
|
|
3544
|
-
"forecast"
|
|
3545
|
-
])
|
|
3546
|
-
)}`
|
|
3547
|
-
).join(`
|
|
3548
|
-
`)}
|
|
3549
|
-
`,
|
|
3550
|
-
Q,
|
|
3612
|
+
"Update the trend and forecast analysis of existing measures in an existing chart",
|
|
3613
|
+
Nr,
|
|
3551
3614
|
e
|
|
3552
3615
|
),
|
|
3553
|
-
|
|
3554
|
-
|
|
3616
|
+
k(
|
|
3617
|
+
Un,
|
|
3555
3618
|
"updateOtherChartDataOptions",
|
|
3556
3619
|
`Update other data options of an existing chart including visual encodings of axes (x-axis, y-axis, and right y-axis), dimensions, and measures
|
|
3557
3620
|
|
|
3558
3621
|
For a measure, for example, you can update its color and show it on the right axis.
|
|
3559
3622
|
|
|
3560
|
-
IMPORTANT: This tool cannot swap data columns (e.g. changing "Revenue" to "Profit"). Use createChart for that
|
|
3561
|
-
|
|
3562
|
-
See the following data options for editing:
|
|
3563
|
-
|
|
3564
|
-
${Object.entries(G).map(
|
|
3565
|
-
([t, n]) => `- ${t}: ${_(
|
|
3566
|
-
fn(n, [
|
|
3567
|
-
"sortType",
|
|
3568
|
-
// Has dedicated sorting tool
|
|
3569
|
-
"trend",
|
|
3570
|
-
// Has dedicated trend/forecast tool
|
|
3571
|
-
"forecast",
|
|
3572
|
-
// Has dedicated trend/forecast tool
|
|
3573
|
-
"chartType"
|
|
3574
|
-
// Has dedicated chartType tool
|
|
3575
|
-
])
|
|
3576
|
-
)}`
|
|
3577
|
-
).join(`
|
|
3578
|
-
`)}
|
|
3579
|
-
`,
|
|
3580
|
-
Q,
|
|
3623
|
+
IMPORTANT: This tool cannot swap data columns (e.g. changing "Revenue" to "Profit"). Use createChart for that.`,
|
|
3624
|
+
Ir,
|
|
3581
3625
|
e
|
|
3582
3626
|
),
|
|
3583
|
-
|
|
3584
|
-
|
|
3627
|
+
k(
|
|
3628
|
+
zn,
|
|
3585
3629
|
"updateChartStyleOptions",
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
See the following styling options for editing:
|
|
3589
|
-
|
|
3590
|
-
${Object.entries(lt).map(([t, n]) => `- ${t}: ${_(n)}`).join(`
|
|
3591
|
-
`)}
|
|
3592
|
-
|
|
3593
|
-
`,
|
|
3594
|
-
Br,
|
|
3630
|
+
"Update cosmetic styling options: legend position, axis titles (text), axis label formatting.",
|
|
3631
|
+
Kr,
|
|
3595
3632
|
e
|
|
3596
3633
|
)
|
|
3597
3634
|
];
|
|
3598
|
-
function
|
|
3635
|
+
function lo(e) {
|
|
3599
3636
|
return `You are an intelligent and proactive chart assistant.
|
|
3600
3637
|
Your role is to create and update a chart based on natural language requests by using the available tools.
|
|
3601
3638
|
|
|
@@ -3624,9 +3661,9 @@ If the prompt can be handled by a single tool, use that tool without splitting t
|
|
|
3624
3661
|
|
|
3625
3662
|
`;
|
|
3626
3663
|
}
|
|
3627
|
-
async function
|
|
3664
|
+
async function hi(e, t) {
|
|
3628
3665
|
const { dataSourceTitle: n, userPrompt: a } = e;
|
|
3629
|
-
if (console.debug(
|
|
3666
|
+
if (console.debug(eo, n, a), !n)
|
|
3630
3667
|
throw new Error(
|
|
3631
3668
|
"Error: Please ask the user to specify a data source title"
|
|
3632
3669
|
);
|
|
@@ -3639,37 +3676,37 @@ async function Ko(e, t) {
|
|
|
3639
3676
|
const c = {
|
|
3640
3677
|
...t,
|
|
3641
3678
|
dataSourceTitle: n,
|
|
3642
|
-
retrieveChart: (
|
|
3643
|
-
saveChart: (
|
|
3679
|
+
retrieveChart: (h) => i || (h && t.retrieveChart ? t.retrieveChart(h) : null),
|
|
3680
|
+
saveChart: (h, O) => {
|
|
3644
3681
|
var P;
|
|
3645
|
-
(P = t.saveChart) == null || P.call(t, r,
|
|
3682
|
+
(P = t.saveChart) == null || P.call(t, r, O), i = O;
|
|
3646
3683
|
}
|
|
3647
|
-
}, d =
|
|
3648
|
-
(t.chartSummaries ?? []).slice(-
|
|
3649
|
-
), u =
|
|
3684
|
+
}, d = lo(
|
|
3685
|
+
(t.chartSummaries ?? []).slice(-oo)
|
|
3686
|
+
), u = so(c), { combinedMessage: p, isError: g } = await Ha({
|
|
3650
3687
|
systemPrompt: d,
|
|
3651
3688
|
userPrompt: a,
|
|
3652
3689
|
tools: u,
|
|
3653
3690
|
openAIClient: t.openAIClient
|
|
3654
3691
|
});
|
|
3655
|
-
if (s = p, l =
|
|
3692
|
+
if (s = p, l = g, l)
|
|
3656
3693
|
throw new Error(s);
|
|
3657
3694
|
return {
|
|
3658
3695
|
message: s,
|
|
3659
3696
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3660
3697
|
chartId: r,
|
|
3661
|
-
chart: i ?
|
|
3698
|
+
chart: i ? io(i, n) : void 0
|
|
3662
3699
|
};
|
|
3663
3700
|
}
|
|
3664
|
-
const
|
|
3665
|
-
async function
|
|
3666
|
-
const n = t ?? b(), a = `${
|
|
3701
|
+
const co = "api/v2/datamodels";
|
|
3702
|
+
async function ft(e, t) {
|
|
3703
|
+
const n = t ?? b(), a = `${co}/schema?title=${encodeURIComponent(
|
|
3667
3704
|
e
|
|
3668
3705
|
)}`;
|
|
3669
3706
|
return await n.get(a) ?? null;
|
|
3670
3707
|
}
|
|
3671
|
-
const
|
|
3672
|
-
function
|
|
3708
|
+
const Oe = "api/datasources";
|
|
3709
|
+
function uo(e, t) {
|
|
3673
3710
|
const n = t.reduce(
|
|
3674
3711
|
(a, r) => (r.schema.tables.forEach((i) => {
|
|
3675
3712
|
a[i.name] = {}, i.columns.forEach((s) => {
|
|
@@ -3686,18 +3723,18 @@ function Xr(e, t) {
|
|
|
3686
3723
|
};
|
|
3687
3724
|
});
|
|
3688
3725
|
}
|
|
3689
|
-
async function
|
|
3690
|
-
const t = e ?? b(), n = `${
|
|
3726
|
+
async function po(e) {
|
|
3727
|
+
const t = e ?? b(), n = `${Oe}/?sharedWith=r,w`;
|
|
3691
3728
|
return await t.get(n) || [];
|
|
3692
3729
|
}
|
|
3693
|
-
async function
|
|
3730
|
+
async function bt(e, t) {
|
|
3694
3731
|
return await (t ?? b()).get(
|
|
3695
|
-
`${
|
|
3732
|
+
`${Oe}/${encodeURIComponent(e)}`
|
|
3696
3733
|
) ?? null;
|
|
3697
3734
|
}
|
|
3698
|
-
async function
|
|
3735
|
+
async function mo(e, t) {
|
|
3699
3736
|
return (t ?? b()).post(
|
|
3700
|
-
`${
|
|
3737
|
+
`${Oe}/${encodeURIComponent(
|
|
3701
3738
|
e
|
|
3702
3739
|
)}/fields/search`,
|
|
3703
3740
|
{
|
|
@@ -3706,16 +3743,16 @@ async function eo(e, t) {
|
|
|
3706
3743
|
}
|
|
3707
3744
|
).then((a) => a ?? null);
|
|
3708
3745
|
}
|
|
3709
|
-
async function
|
|
3746
|
+
async function yt(e, t) {
|
|
3710
3747
|
var a;
|
|
3711
|
-
const n = await
|
|
3748
|
+
const n = await mo(e, t);
|
|
3712
3749
|
if (!n) return [];
|
|
3713
3750
|
try {
|
|
3714
|
-
const r = await
|
|
3751
|
+
const r = await ft(
|
|
3715
3752
|
e,
|
|
3716
3753
|
t
|
|
3717
3754
|
);
|
|
3718
|
-
return r != null && r.datasets ?
|
|
3755
|
+
return r != null && r.datasets ? uo(
|
|
3719
3756
|
n,
|
|
3720
3757
|
r.datasets
|
|
3721
3758
|
) : n;
|
|
@@ -3730,17 +3767,17 @@ async function ft(e, t) {
|
|
|
3730
3767
|
throw r;
|
|
3731
3768
|
}
|
|
3732
3769
|
}
|
|
3733
|
-
function
|
|
3770
|
+
function ho(e) {
|
|
3734
3771
|
const t = [];
|
|
3735
3772
|
return e.forEach((n) => {
|
|
3736
|
-
const a =
|
|
3737
|
-
table:
|
|
3773
|
+
const a = Ae(n.column), r = {
|
|
3774
|
+
table: Ae(n.table),
|
|
3738
3775
|
column: a,
|
|
3739
3776
|
type: n.dimtype,
|
|
3740
3777
|
expression: n.id,
|
|
3741
3778
|
description: n.description || `${n.table}.${n.column}`
|
|
3742
3779
|
};
|
|
3743
|
-
t.push(r), n.dimtype === "datetime" &&
|
|
3780
|
+
t.push(r), n.dimtype === "datetime" && jt.all.forEach((i) => {
|
|
3744
3781
|
t.push({
|
|
3745
3782
|
...r,
|
|
3746
3783
|
column: `${a}.${i}`,
|
|
@@ -3752,30 +3789,30 @@ function to(e) {
|
|
|
3752
3789
|
});
|
|
3753
3790
|
}), t;
|
|
3754
3791
|
}
|
|
3755
|
-
async function
|
|
3756
|
-
const r = await (t ??
|
|
3757
|
-
return
|
|
3792
|
+
async function gi(e, t, n) {
|
|
3793
|
+
const r = await (t ?? yt)(e, n);
|
|
3794
|
+
return ho(r);
|
|
3758
3795
|
}
|
|
3759
|
-
async function
|
|
3760
|
-
console.debug(
|
|
3761
|
-
const n = await
|
|
3796
|
+
async function fi(e, t) {
|
|
3797
|
+
console.debug(ao, t.toolCallId);
|
|
3798
|
+
const n = await po(t.httpClient);
|
|
3762
3799
|
return {
|
|
3763
3800
|
dataSourceTitles: n.map((a) => a.title),
|
|
3764
3801
|
dataSources: n
|
|
3765
3802
|
};
|
|
3766
3803
|
}
|
|
3767
|
-
const
|
|
3768
|
-
async function
|
|
3804
|
+
const bi = o.object({});
|
|
3805
|
+
async function yi(e, t) {
|
|
3769
3806
|
const { dataSourceTitle: n } = e;
|
|
3770
3807
|
if (console.debug(
|
|
3771
|
-
|
|
3808
|
+
ro,
|
|
3772
3809
|
n,
|
|
3773
3810
|
t.toolCallId
|
|
3774
3811
|
), !n)
|
|
3775
3812
|
throw new Error(
|
|
3776
3813
|
"Error: Please ask the user to specify a data source title"
|
|
3777
3814
|
);
|
|
3778
|
-
const a = await
|
|
3815
|
+
const a = await yt(
|
|
3779
3816
|
n,
|
|
3780
3817
|
t.httpClient
|
|
3781
3818
|
);
|
|
@@ -3784,28 +3821,28 @@ async function ai(e, t) {
|
|
|
3784
3821
|
fields: a || []
|
|
3785
3822
|
};
|
|
3786
3823
|
}
|
|
3787
|
-
const
|
|
3824
|
+
const wi = o.object({
|
|
3788
3825
|
dataSourceTitle: o.string().describe("Data source title")
|
|
3789
|
-
}),
|
|
3790
|
-
function
|
|
3826
|
+
}), R = "api/v1/dashboards";
|
|
3827
|
+
function vi(e, t) {
|
|
3791
3828
|
const n = t ?? b();
|
|
3792
|
-
return `${
|
|
3829
|
+
return `${we(n.url)}app/main/dashboards/${e}`;
|
|
3793
3830
|
}
|
|
3794
|
-
async function
|
|
3831
|
+
async function go(e = {}, t) {
|
|
3795
3832
|
const n = t ?? b(), { fields: a, expand: r, searchByTitle: i } = e, s = new URLSearchParams({
|
|
3796
3833
|
...i && { name: i },
|
|
3797
3834
|
...(a == null ? void 0 : a.length) && { fields: a == null ? void 0 : a.join(",") },
|
|
3798
3835
|
...(r == null ? void 0 : r.length) && { expand: r == null ? void 0 : r.join(",") }
|
|
3799
3836
|
}).toString(), l = await n.get(
|
|
3800
|
-
`${
|
|
3837
|
+
`${R}?${s}`
|
|
3801
3838
|
);
|
|
3802
3839
|
return l || [];
|
|
3803
3840
|
}
|
|
3804
|
-
async function
|
|
3841
|
+
async function fo(e, t) {
|
|
3805
3842
|
const n = t ?? b();
|
|
3806
3843
|
try {
|
|
3807
3844
|
return await n.get(
|
|
3808
|
-
`${
|
|
3845
|
+
`${R}/${e}/widgets`
|
|
3809
3846
|
) ?? [];
|
|
3810
3847
|
} catch {
|
|
3811
3848
|
throw new Error(
|
|
@@ -3813,7 +3850,7 @@ async function ao(e, t) {
|
|
|
3813
3850
|
);
|
|
3814
3851
|
}
|
|
3815
3852
|
}
|
|
3816
|
-
async function
|
|
3853
|
+
async function bo(e, t) {
|
|
3817
3854
|
const n = t ?? b();
|
|
3818
3855
|
return await _t(n, e, {
|
|
3819
3856
|
includeWidgets: !0,
|
|
@@ -3822,19 +3859,19 @@ async function ro(e, t) {
|
|
|
3822
3859
|
}
|
|
3823
3860
|
async function be(e, t, n) {
|
|
3824
3861
|
return await (n ?? b()).patch(
|
|
3825
|
-
`${
|
|
3862
|
+
`${R}/${e}`,
|
|
3826
3863
|
t
|
|
3827
3864
|
) ?? null;
|
|
3828
3865
|
}
|
|
3829
|
-
async function
|
|
3866
|
+
async function yo(e, t, n) {
|
|
3830
3867
|
return await (n ?? b()).post(
|
|
3831
|
-
`${
|
|
3868
|
+
`${R}/${e}/widgets`,
|
|
3832
3869
|
t
|
|
3833
3870
|
) ?? null;
|
|
3834
3871
|
}
|
|
3835
|
-
async function
|
|
3872
|
+
async function Ie(e, t, n) {
|
|
3836
3873
|
return await (n ?? b()).post(
|
|
3837
|
-
`${
|
|
3874
|
+
`${R}`,
|
|
3838
3875
|
{
|
|
3839
3876
|
title: e,
|
|
3840
3877
|
datasource: t,
|
|
@@ -3842,15 +3879,15 @@ async function Ne(e, t, n) {
|
|
|
3842
3879
|
}
|
|
3843
3880
|
) ?? null;
|
|
3844
3881
|
}
|
|
3845
|
-
function
|
|
3846
|
-
return (t ?? b()).delete(`${
|
|
3882
|
+
function Si(e, t) {
|
|
3883
|
+
return (t ?? b()).delete(`${R}/${e}`);
|
|
3847
3884
|
}
|
|
3848
|
-
function
|
|
3885
|
+
function wo(e, t, n) {
|
|
3849
3886
|
return (n ?? b()).delete(
|
|
3850
|
-
`${
|
|
3887
|
+
`${R}/${e}/widgets/${t}`
|
|
3851
3888
|
);
|
|
3852
3889
|
}
|
|
3853
|
-
function
|
|
3890
|
+
function vo(e) {
|
|
3854
3891
|
return {
|
|
3855
3892
|
columns: e.columns.map((t) => ({
|
|
3856
3893
|
width: t.widthPercentage,
|
|
@@ -3873,8 +3910,8 @@ function so(e) {
|
|
|
3873
3910
|
}))
|
|
3874
3911
|
};
|
|
3875
3912
|
}
|
|
3876
|
-
async function
|
|
3877
|
-
return (await
|
|
3913
|
+
async function So(e) {
|
|
3914
|
+
return (await go(
|
|
3878
3915
|
{
|
|
3879
3916
|
fields: ["title", "oid", "datasource", "settings"]
|
|
3880
3917
|
},
|
|
@@ -3890,17 +3927,17 @@ async function si(e) {
|
|
|
3890
3927
|
dataSourceTitle: a.datasource.title
|
|
3891
3928
|
}));
|
|
3892
3929
|
}
|
|
3893
|
-
async function
|
|
3930
|
+
async function Oo(e, t) {
|
|
3894
3931
|
var a;
|
|
3895
|
-
const n = await
|
|
3932
|
+
const n = await bo(
|
|
3896
3933
|
e,
|
|
3897
3934
|
t
|
|
3898
3935
|
);
|
|
3899
3936
|
if (!(n && ((a = n.settings) == null ? void 0 : a.managedByTool) !== "studio-assistant"))
|
|
3900
|
-
return n ?
|
|
3937
|
+
return n ? xt.toDashboardProps(n) : void 0;
|
|
3901
3938
|
}
|
|
3902
|
-
async function
|
|
3903
|
-
const n = await
|
|
3939
|
+
async function Oi(e, t) {
|
|
3940
|
+
const n = await Oo(
|
|
3904
3941
|
e,
|
|
3905
3942
|
t
|
|
3906
3943
|
);
|
|
@@ -3910,14 +3947,14 @@ async function li(e, t) {
|
|
|
3910
3947
|
);
|
|
3911
3948
|
return n;
|
|
3912
3949
|
}
|
|
3913
|
-
async function
|
|
3950
|
+
async function Co(e, t, n) {
|
|
3914
3951
|
if (t.length === 0)
|
|
3915
3952
|
return [];
|
|
3916
3953
|
const r = t.map((l) => {
|
|
3917
|
-
const c =
|
|
3918
|
-
return
|
|
3954
|
+
const c = De.fromWidgetProps(l), d = Re(l) && l.dataSource ? pe(l.dataSource) : void 0;
|
|
3955
|
+
return De.toWidgetDto(c, d);
|
|
3919
3956
|
}).map(
|
|
3920
|
-
(l, c) =>
|
|
3957
|
+
(l, c) => yo(e, l, n).then(
|
|
3921
3958
|
(d) => ({
|
|
3922
3959
|
index: c,
|
|
3923
3960
|
result: d
|
|
@@ -3926,19 +3963,19 @@ async function co(e, t, n) {
|
|
|
3926
3963
|
);
|
|
3927
3964
|
return (await Promise.all(r)).sort((l, c) => l.index - c.index).map((l) => l.result).filter((l) => l !== void 0);
|
|
3928
3965
|
}
|
|
3929
|
-
async function
|
|
3930
|
-
const a =
|
|
3966
|
+
async function Do(e, t, n) {
|
|
3967
|
+
const a = $t(t);
|
|
3931
3968
|
await be(e, a, n);
|
|
3932
3969
|
}
|
|
3933
|
-
function
|
|
3970
|
+
function Ci(e) {
|
|
3934
3971
|
return !!e.id;
|
|
3935
3972
|
}
|
|
3936
|
-
async function
|
|
3937
|
-
var p,
|
|
3973
|
+
async function Di(e, t) {
|
|
3974
|
+
var p, g;
|
|
3938
3975
|
const n = e.defaultDataSource;
|
|
3939
3976
|
if (!n)
|
|
3940
3977
|
throw new Error("Dashboard must have a data source");
|
|
3941
|
-
const a = me(n) ? n.title : n, r = await
|
|
3978
|
+
const a = me(n) ? n.title : n, r = await bt(
|
|
3942
3979
|
a,
|
|
3943
3980
|
t
|
|
3944
3981
|
);
|
|
@@ -3957,84 +3994,84 @@ async function ui(e, t) {
|
|
|
3957
3994
|
},
|
|
3958
3995
|
t
|
|
3959
3996
|
);
|
|
3960
|
-
const
|
|
3997
|
+
const h = await fo(
|
|
3961
3998
|
i,
|
|
3962
3999
|
t
|
|
3963
4000
|
);
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
(
|
|
4001
|
+
h && await Promise.all(
|
|
4002
|
+
h.map(
|
|
4003
|
+
(O) => wo(
|
|
3967
4004
|
i,
|
|
3968
|
-
|
|
4005
|
+
O.oid,
|
|
3969
4006
|
t
|
|
3970
4007
|
)
|
|
3971
4008
|
)
|
|
3972
4009
|
);
|
|
3973
|
-
} catch (
|
|
3974
|
-
if ((
|
|
3975
|
-
const
|
|
4010
|
+
} catch (h) {
|
|
4011
|
+
if ((h == null ? void 0 : h.status) === "404" || (h == null ? void 0 : h.status) === 404) {
|
|
4012
|
+
const O = await Ie(
|
|
3976
4013
|
s,
|
|
3977
4014
|
r,
|
|
3978
4015
|
t
|
|
3979
4016
|
);
|
|
3980
|
-
if (!
|
|
4017
|
+
if (!O)
|
|
3981
4018
|
throw new Error("Error: Failed to create Fusion dashboard");
|
|
3982
|
-
i =
|
|
4019
|
+
i = O.oid, s = O.title;
|
|
3983
4020
|
} else
|
|
3984
|
-
throw
|
|
4021
|
+
throw h;
|
|
3985
4022
|
}
|
|
3986
4023
|
} else {
|
|
3987
|
-
const
|
|
4024
|
+
const h = await Ie(
|
|
3988
4025
|
s,
|
|
3989
4026
|
r,
|
|
3990
4027
|
t
|
|
3991
4028
|
);
|
|
3992
|
-
if (!
|
|
4029
|
+
if (!h)
|
|
3993
4030
|
throw new Error("Error: Failed to create Fusion dashboard");
|
|
3994
|
-
i =
|
|
4031
|
+
i = h.oid, s = h.title;
|
|
3995
4032
|
}
|
|
3996
4033
|
const l = {
|
|
3997
4034
|
...e,
|
|
3998
4035
|
id: i,
|
|
3999
4036
|
title: s
|
|
4000
|
-
}, c = await
|
|
4037
|
+
}, c = await Co(
|
|
4001
4038
|
i,
|
|
4002
4039
|
e.widgets,
|
|
4003
4040
|
t
|
|
4004
|
-
), d = e.widgets.map((
|
|
4041
|
+
), d = e.widgets.map((h, O) => {
|
|
4005
4042
|
var P;
|
|
4006
4043
|
return {
|
|
4007
|
-
...
|
|
4008
|
-
id: ((P = c[
|
|
4009
|
-
oldId:
|
|
4044
|
+
...h,
|
|
4045
|
+
id: ((P = c[O]) == null ? void 0 : P.oid) ?? h.id,
|
|
4046
|
+
oldId: h.id
|
|
4010
4047
|
};
|
|
4011
4048
|
}), u = (p = e.layoutOptions) != null && p.widgetsPanel ? {
|
|
4012
4049
|
...e.layoutOptions.widgetsPanel,
|
|
4013
4050
|
columns: e.layoutOptions.widgetsPanel.columns.map(
|
|
4014
|
-
(
|
|
4015
|
-
...
|
|
4016
|
-
rows:
|
|
4017
|
-
...
|
|
4018
|
-
cells:
|
|
4019
|
-
var
|
|
4051
|
+
(h) => ({
|
|
4052
|
+
...h,
|
|
4053
|
+
rows: h.rows.map((O) => ({
|
|
4054
|
+
...O,
|
|
4055
|
+
cells: O.cells.map((P) => {
|
|
4056
|
+
var Ce;
|
|
4020
4057
|
return {
|
|
4021
4058
|
...P,
|
|
4022
|
-
widgetId: ((
|
|
4023
|
-
(
|
|
4024
|
-
)) == null ? void 0 :
|
|
4059
|
+
widgetId: ((Ce = d.find(
|
|
4060
|
+
(St) => St.oldId === P.widgetId
|
|
4061
|
+
)) == null ? void 0 : Ce.id) || P.widgetId
|
|
4025
4062
|
};
|
|
4026
4063
|
})
|
|
4027
4064
|
}))
|
|
4028
4065
|
})
|
|
4029
4066
|
)
|
|
4030
|
-
} : (
|
|
4067
|
+
} : (g = e.layoutOptions) == null ? void 0 : g.widgetsPanel;
|
|
4031
4068
|
return u && await be(
|
|
4032
4069
|
i,
|
|
4033
4070
|
{
|
|
4034
|
-
layout:
|
|
4071
|
+
layout: vo(u)
|
|
4035
4072
|
},
|
|
4036
4073
|
t
|
|
4037
|
-
), await
|
|
4074
|
+
), await Do(
|
|
4038
4075
|
i,
|
|
4039
4076
|
e.filters ?? [],
|
|
4040
4077
|
t
|
|
@@ -4044,7 +4081,115 @@ async function ui(e, t) {
|
|
|
4044
4081
|
layoutOptions: { widgetsPanel: u }
|
|
4045
4082
|
};
|
|
4046
4083
|
}
|
|
4047
|
-
|
|
4084
|
+
async function Ai(e, t) {
|
|
4085
|
+
return console.debug(no, t.toolCallId), {
|
|
4086
|
+
dashboards: await So(t.httpClient)
|
|
4087
|
+
};
|
|
4088
|
+
}
|
|
4089
|
+
const Pi = o.object({}), Ao = 4, Ti = o.object({
|
|
4090
|
+
dataSourceTitle: o.string().describe("Data source title"),
|
|
4091
|
+
queryCount: o.number().optional().describe("Number of recommended queries to return."),
|
|
4092
|
+
userPrompt: o.string().optional().describe(
|
|
4093
|
+
"User prompt or context to guide recommendations. Used to filter and prioritize relevant queries."
|
|
4094
|
+
),
|
|
4095
|
+
existingWidgets: o.array(o.string()).optional().describe(
|
|
4096
|
+
"List of existing widget titles/descriptions to avoid duplicates when adding to existing dashboard."
|
|
4097
|
+
)
|
|
4098
|
+
}), Po = {
|
|
4099
|
+
bar: "bar",
|
|
4100
|
+
column: "column",
|
|
4101
|
+
line: "line",
|
|
4102
|
+
pie: "pie",
|
|
4103
|
+
scatter: "scatter",
|
|
4104
|
+
area: "area",
|
|
4105
|
+
funnel: "funnel",
|
|
4106
|
+
polar: "polar",
|
|
4107
|
+
treemap: "treemap",
|
|
4108
|
+
sunburst: "sunburst",
|
|
4109
|
+
boxplot: "boxplot"
|
|
4110
|
+
};
|
|
4111
|
+
function To(e) {
|
|
4112
|
+
const t = e.toLowerCase();
|
|
4113
|
+
for (const [n, a] of Object.entries(Po))
|
|
4114
|
+
if (t.includes(n))
|
|
4115
|
+
return a;
|
|
4116
|
+
}
|
|
4117
|
+
function _o(e, t) {
|
|
4118
|
+
if (!e && !(t != null && t.length))
|
|
4119
|
+
return;
|
|
4120
|
+
let n = "";
|
|
4121
|
+
if (e && (n = e), t != null && t.length) {
|
|
4122
|
+
const r = `DO NOT recommend queries that are similar to these:
|
|
4123
|
+
${[...new Set(t)].map((i) => `- ${i}`).join(`
|
|
4124
|
+
`)}`;
|
|
4125
|
+
n = n ? `<INSTRUCTIONS>${r}</INSTRUCTIONS>
|
|
4126
|
+
|
|
4127
|
+
<USER-PROMPT> ${n}</USER-PROMPT>` : r;
|
|
4128
|
+
}
|
|
4129
|
+
return n;
|
|
4130
|
+
}
|
|
4131
|
+
async function _i(e, t, n) {
|
|
4132
|
+
const {
|
|
4133
|
+
dataSourceTitle: a,
|
|
4134
|
+
queryCount: r = Ao,
|
|
4135
|
+
userPrompt: i,
|
|
4136
|
+
existingWidgets: s
|
|
4137
|
+
} = e, l = "Error: Failed to get recommended queries";
|
|
4138
|
+
if (console.debug(
|
|
4139
|
+
to,
|
|
4140
|
+
a,
|
|
4141
|
+
t.toolCallId
|
|
4142
|
+
), !a)
|
|
4143
|
+
throw new Error("Error: Please specify data source title");
|
|
4144
|
+
if (!await ft(
|
|
4145
|
+
a,
|
|
4146
|
+
t.httpClient
|
|
4147
|
+
))
|
|
4148
|
+
throw new Error(
|
|
4149
|
+
"Error: Data source not found. Make sure to create a model first"
|
|
4150
|
+
);
|
|
4151
|
+
const d = _o(i, s), u = await Ga(
|
|
4152
|
+
a,
|
|
4153
|
+
{
|
|
4154
|
+
numOfRecommendations: r,
|
|
4155
|
+
userPrompt: d
|
|
4156
|
+
},
|
|
4157
|
+
t.httpClient
|
|
4158
|
+
);
|
|
4159
|
+
if (!u)
|
|
4160
|
+
throw new Error(l);
|
|
4161
|
+
if (n && u.length > 0) {
|
|
4162
|
+
const h = u.map((O) => ({
|
|
4163
|
+
nlqPrompt: O.nlqPrompt,
|
|
4164
|
+
detailedDescription: O.detailedDescription
|
|
4165
|
+
}));
|
|
4166
|
+
n(h);
|
|
4167
|
+
}
|
|
4168
|
+
const p = i ? To(i) : void 0;
|
|
4169
|
+
return {
|
|
4170
|
+
recommendations: await Promise.all(
|
|
4171
|
+
u.map(async (h) => ({
|
|
4172
|
+
...await lt(
|
|
4173
|
+
{
|
|
4174
|
+
dataSourceTitle: a,
|
|
4175
|
+
userPrompt: h.nlqPrompt,
|
|
4176
|
+
chartType: p,
|
|
4177
|
+
chartTitle: h.nlqPrompt
|
|
4178
|
+
},
|
|
4179
|
+
{
|
|
4180
|
+
toolCallId: t.toolCallId,
|
|
4181
|
+
isNlqV3Enabled: t.isNlqV3Enabled,
|
|
4182
|
+
httpClient: t.httpClient,
|
|
4183
|
+
openAIClient: t.openAIClient
|
|
4184
|
+
}
|
|
4185
|
+
),
|
|
4186
|
+
nlqPrompt: h.nlqPrompt,
|
|
4187
|
+
detailedDescription: h.detailedDescription
|
|
4188
|
+
}))
|
|
4189
|
+
)
|
|
4190
|
+
};
|
|
4191
|
+
}
|
|
4192
|
+
var xo = function e(t, n) {
|
|
4048
4193
|
if (t === n) return !0;
|
|
4049
4194
|
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
4050
4195
|
if (t.constructor !== n.constructor) return !1;
|
|
@@ -4069,13 +4214,13 @@ var po = function e(t, n) {
|
|
|
4069
4214
|
}
|
|
4070
4215
|
return t !== t && n !== n;
|
|
4071
4216
|
};
|
|
4072
|
-
const
|
|
4073
|
-
function
|
|
4217
|
+
const $o = /* @__PURE__ */ ht(xo);
|
|
4218
|
+
function jo(e) {
|
|
4074
4219
|
return e.columns.flatMap(
|
|
4075
4220
|
(t) => t.rows.flatMap((n) => n.cells.map((a) => a.widgetId))
|
|
4076
4221
|
);
|
|
4077
4222
|
}
|
|
4078
|
-
function
|
|
4223
|
+
function Eo(e, t) {
|
|
4079
4224
|
const n = e.columns.map((a) => ({
|
|
4080
4225
|
...a,
|
|
4081
4226
|
rows: a.rows.map((r) => ({
|
|
@@ -4088,7 +4233,7 @@ function go(e, t) {
|
|
|
4088
4233
|
})).filter((a) => a.rows.length > 0);
|
|
4089
4234
|
return n.length > 0 ? { columns: n } : { columns: [] };
|
|
4090
4235
|
}
|
|
4091
|
-
function
|
|
4236
|
+
function ko(e) {
|
|
4092
4237
|
return e.columns.length === 1 ? {
|
|
4093
4238
|
...e,
|
|
4094
4239
|
columns: [
|
|
@@ -4099,31 +4244,31 @@ function fo(e) {
|
|
|
4099
4244
|
]
|
|
4100
4245
|
} : e;
|
|
4101
4246
|
}
|
|
4102
|
-
function
|
|
4247
|
+
function Mo(e, t) {
|
|
4103
4248
|
if (!t)
|
|
4104
4249
|
return [];
|
|
4105
|
-
const n =
|
|
4250
|
+
const n = jo(t);
|
|
4106
4251
|
return e.filter((a) => !n.includes(a.id)).map((a) => a.id);
|
|
4107
4252
|
}
|
|
4108
|
-
function
|
|
4253
|
+
function No(e) {
|
|
4109
4254
|
var a, r;
|
|
4110
4255
|
let t = { ...e };
|
|
4111
|
-
const n =
|
|
4256
|
+
const n = Mo(
|
|
4112
4257
|
t.widgets,
|
|
4113
4258
|
(a = t.layoutOptions) == null ? void 0 : a.widgetsPanel
|
|
4114
4259
|
);
|
|
4115
|
-
if (n.length > 0 && (t =
|
|
4260
|
+
if (n.length > 0 && (t = wt(
|
|
4116
4261
|
t,
|
|
4117
4262
|
n
|
|
4118
4263
|
)), (r = t.layoutOptions) != null && r.widgetsPanel) {
|
|
4119
4264
|
const i = new Set(
|
|
4120
4265
|
t.widgets.map((l) => l.id)
|
|
4121
4266
|
);
|
|
4122
|
-
let s =
|
|
4267
|
+
let s = Eo(
|
|
4123
4268
|
t.layoutOptions.widgetsPanel,
|
|
4124
4269
|
i
|
|
4125
4270
|
);
|
|
4126
|
-
s =
|
|
4271
|
+
s = ko(s), t = {
|
|
4127
4272
|
...t,
|
|
4128
4273
|
layoutOptions: {
|
|
4129
4274
|
...t.layoutOptions,
|
|
@@ -4133,7 +4278,7 @@ function yo(e) {
|
|
|
4133
4278
|
}
|
|
4134
4279
|
return { changed: !0, updatedDashboardProps: t };
|
|
4135
4280
|
}
|
|
4136
|
-
function
|
|
4281
|
+
function Io(e, t) {
|
|
4137
4282
|
return {
|
|
4138
4283
|
changed: !0,
|
|
4139
4284
|
updatedDashboardProps: {
|
|
@@ -4142,7 +4287,7 @@ function vo(e, t) {
|
|
|
4142
4287
|
}
|
|
4143
4288
|
};
|
|
4144
4289
|
}
|
|
4145
|
-
function
|
|
4290
|
+
function Zo(e, t) {
|
|
4146
4291
|
var n;
|
|
4147
4292
|
return {
|
|
4148
4293
|
changed: !0,
|
|
@@ -4158,9 +4303,9 @@ function wo(e, t) {
|
|
|
4158
4303
|
}
|
|
4159
4304
|
};
|
|
4160
4305
|
}
|
|
4161
|
-
function
|
|
4306
|
+
function Lo(e, t) {
|
|
4162
4307
|
var n;
|
|
4163
|
-
return
|
|
4308
|
+
return $o(t, (n = e.layoutOptions) == null ? void 0 : n.widgetsPanel) ? { changed: !1, updatedDashboardProps: e } : {
|
|
4164
4309
|
changed: !0,
|
|
4165
4310
|
updatedDashboardProps: {
|
|
4166
4311
|
...e,
|
|
@@ -4171,16 +4316,16 @@ function So(e, t) {
|
|
|
4171
4316
|
}
|
|
4172
4317
|
};
|
|
4173
4318
|
}
|
|
4174
|
-
function
|
|
4319
|
+
function Ro(e, t) {
|
|
4175
4320
|
return {
|
|
4176
4321
|
changed: !0,
|
|
4177
|
-
updatedDashboardProps:
|
|
4322
|
+
updatedDashboardProps: wt(
|
|
4178
4323
|
e,
|
|
4179
4324
|
t
|
|
4180
4325
|
)
|
|
4181
4326
|
};
|
|
4182
4327
|
}
|
|
4183
|
-
function
|
|
4328
|
+
function Uo(e, t) {
|
|
4184
4329
|
var n, a, r;
|
|
4185
4330
|
return {
|
|
4186
4331
|
changed: !0,
|
|
@@ -4200,7 +4345,7 @@ function Ao(e, t) {
|
|
|
4200
4345
|
}
|
|
4201
4346
|
};
|
|
4202
4347
|
}
|
|
4203
|
-
function
|
|
4348
|
+
function xi(e) {
|
|
4204
4349
|
const t = /* @__PURE__ */ new Map(), { widgets: n, defaultDataSource: a } = e;
|
|
4205
4350
|
return a && me(a) && t.set(
|
|
4206
4351
|
a.title,
|
|
@@ -4215,7 +4360,7 @@ function di(e) {
|
|
|
4215
4360
|
}
|
|
4216
4361
|
}), t;
|
|
4217
4362
|
}
|
|
4218
|
-
function
|
|
4363
|
+
function Ze(e) {
|
|
4219
4364
|
return e.length === 1 ? {
|
|
4220
4365
|
// use a 1-column layout
|
|
4221
4366
|
columns: [
|
|
@@ -4262,7 +4407,7 @@ function Ie(e) {
|
|
|
4262
4407
|
]
|
|
4263
4408
|
};
|
|
4264
4409
|
}
|
|
4265
|
-
function
|
|
4410
|
+
function zo(e, t) {
|
|
4266
4411
|
const a = {
|
|
4267
4412
|
cells: [{
|
|
4268
4413
|
widthPercentage: 100,
|
|
@@ -4291,7 +4436,7 @@ function Do(e, t) {
|
|
|
4291
4436
|
)
|
|
4292
4437
|
};
|
|
4293
4438
|
}
|
|
4294
|
-
function
|
|
4439
|
+
function Bo() {
|
|
4295
4440
|
return {
|
|
4296
4441
|
toolbar: { visible: !0 },
|
|
4297
4442
|
widgetsPanel: {
|
|
@@ -4321,17 +4466,17 @@ function Co() {
|
|
|
4321
4466
|
}
|
|
4322
4467
|
};
|
|
4323
4468
|
}
|
|
4324
|
-
function
|
|
4469
|
+
function Fo() {
|
|
4325
4470
|
return {
|
|
4326
4471
|
title: "Dashboard Title",
|
|
4327
4472
|
widgets: [],
|
|
4328
4473
|
layoutOptions: {},
|
|
4329
|
-
config:
|
|
4474
|
+
config: Bo(),
|
|
4330
4475
|
filters: []
|
|
4331
4476
|
};
|
|
4332
4477
|
}
|
|
4333
|
-
async function
|
|
4334
|
-
const a = await
|
|
4478
|
+
async function qo(e, t, n) {
|
|
4479
|
+
const a = await bt(
|
|
4335
4480
|
e,
|
|
4336
4481
|
n
|
|
4337
4482
|
);
|
|
@@ -4339,69 +4484,69 @@ async function Po(e, t, n) {
|
|
|
4339
4484
|
throw new Error(
|
|
4340
4485
|
"Error: Data source not found. Please ask the user to specify a valid data source."
|
|
4341
4486
|
);
|
|
4342
|
-
const r =
|
|
4487
|
+
const r = Ue(a);
|
|
4343
4488
|
return {
|
|
4344
|
-
...
|
|
4489
|
+
...Fo(),
|
|
4345
4490
|
title: t,
|
|
4346
4491
|
defaultDataSource: r
|
|
4347
4492
|
};
|
|
4348
4493
|
}
|
|
4349
|
-
function
|
|
4494
|
+
function $i(e) {
|
|
4350
4495
|
return {
|
|
4351
4496
|
...e,
|
|
4352
|
-
id:
|
|
4497
|
+
id: W()
|
|
4353
4498
|
};
|
|
4354
4499
|
}
|
|
4355
|
-
function
|
|
4500
|
+
function Ho(e, t) {
|
|
4356
4501
|
return {
|
|
4357
4502
|
...e,
|
|
4358
4503
|
widgets: [...e.widgets, ...t]
|
|
4359
4504
|
};
|
|
4360
4505
|
}
|
|
4361
|
-
function
|
|
4506
|
+
function Wo(e, t = []) {
|
|
4362
4507
|
var i;
|
|
4363
4508
|
const n = (i = e.layoutOptions) == null ? void 0 : i.widgetsPanel;
|
|
4364
4509
|
let a = n || {
|
|
4365
4510
|
columns: []
|
|
4366
4511
|
};
|
|
4367
|
-
return !n || !n.columns || n.columns.length === 0 ? a =
|
|
4512
|
+
return !n || !n.columns || n.columns.length === 0 ? a = Ze(
|
|
4368
4513
|
e.widgets.map((s) => s.id)
|
|
4369
|
-
) : (a || (a =
|
|
4514
|
+
) : (a || (a = Ze(
|
|
4370
4515
|
e.widgets.map((s) => s.id)
|
|
4371
4516
|
)), t.forEach((s) => {
|
|
4372
|
-
a =
|
|
4517
|
+
a = zo(a, s);
|
|
4373
4518
|
})), {
|
|
4374
4519
|
...e,
|
|
4375
4520
|
layoutOptions: { widgetsPanel: a }
|
|
4376
4521
|
};
|
|
4377
4522
|
}
|
|
4378
|
-
function
|
|
4523
|
+
function ji(e, t) {
|
|
4379
4524
|
return {
|
|
4380
4525
|
...e,
|
|
4381
4526
|
title: t
|
|
4382
4527
|
};
|
|
4383
4528
|
}
|
|
4384
|
-
async function
|
|
4385
|
-
const r = await
|
|
4529
|
+
async function Ei(e, t, n = [], a) {
|
|
4530
|
+
const r = await qo(
|
|
4386
4531
|
e,
|
|
4387
4532
|
t,
|
|
4388
4533
|
a
|
|
4389
4534
|
);
|
|
4390
|
-
return
|
|
4535
|
+
return Vo(r, n);
|
|
4391
4536
|
}
|
|
4392
|
-
function
|
|
4537
|
+
function Vo(e, t) {
|
|
4393
4538
|
if (t.length === 0)
|
|
4394
4539
|
return e;
|
|
4395
|
-
const n =
|
|
4540
|
+
const n = Ho(
|
|
4396
4541
|
e,
|
|
4397
4542
|
t
|
|
4398
4543
|
);
|
|
4399
|
-
return
|
|
4544
|
+
return Wo(
|
|
4400
4545
|
n,
|
|
4401
4546
|
t.map((r) => r.id)
|
|
4402
4547
|
);
|
|
4403
4548
|
}
|
|
4404
|
-
function
|
|
4549
|
+
function wt(e, t) {
|
|
4405
4550
|
return {
|
|
4406
4551
|
...e,
|
|
4407
4552
|
widgets: e.widgets.filter(
|
|
@@ -4409,21 +4554,21 @@ function bt(e, t) {
|
|
|
4409
4554
|
)
|
|
4410
4555
|
};
|
|
4411
4556
|
}
|
|
4412
|
-
function
|
|
4557
|
+
function Jo(e, t) {
|
|
4413
4558
|
switch (t.type) {
|
|
4414
4559
|
case "filters/updated":
|
|
4415
|
-
return
|
|
4560
|
+
return Io(e, t.payload);
|
|
4416
4561
|
case "filtersPanel/collapse/changed":
|
|
4417
|
-
return
|
|
4562
|
+
return Zo(e, t.payload);
|
|
4418
4563
|
case "widgetsPanel/layout/updated":
|
|
4419
|
-
return
|
|
4564
|
+
return Lo(
|
|
4420
4565
|
e,
|
|
4421
4566
|
t.payload
|
|
4422
4567
|
);
|
|
4423
4568
|
case "widgets/deleted":
|
|
4424
|
-
return
|
|
4569
|
+
return Ro(e, t.payload);
|
|
4425
4570
|
case "widgetsPanel/editMode/isEditing/changed":
|
|
4426
|
-
return
|
|
4571
|
+
return Uo(
|
|
4427
4572
|
e,
|
|
4428
4573
|
t.payload
|
|
4429
4574
|
);
|
|
@@ -4431,14 +4576,14 @@ function jo(e, t) {
|
|
|
4431
4576
|
return { changed: !1, updatedDashboardProps: e };
|
|
4432
4577
|
}
|
|
4433
4578
|
}
|
|
4434
|
-
function
|
|
4435
|
-
const { changed: n, updatedDashboardProps: a } =
|
|
4579
|
+
function ki(e, t) {
|
|
4580
|
+
const { changed: n, updatedDashboardProps: a } = Jo(
|
|
4436
4581
|
e,
|
|
4437
4582
|
t
|
|
4438
4583
|
);
|
|
4439
|
-
return n ?
|
|
4584
|
+
return n ? No(a) : { changed: n, updatedDashboardProps: a };
|
|
4440
4585
|
}
|
|
4441
|
-
async function
|
|
4586
|
+
async function Mi({ title: e }) {
|
|
4442
4587
|
var r;
|
|
4443
4588
|
const t = b(), n = {
|
|
4444
4589
|
operationName: "createNewElasticube",
|
|
@@ -4524,7 +4669,7 @@ fragment experiments on Experiments {
|
|
|
4524
4669
|
throw new Error(a.errors[0].error.message);
|
|
4525
4670
|
return (r = a == null ? void 0 : a.data) == null ? void 0 : r.newCube;
|
|
4526
4671
|
}
|
|
4527
|
-
async function
|
|
4672
|
+
async function Ni({
|
|
4528
4673
|
filePath: e,
|
|
4529
4674
|
fileName: t
|
|
4530
4675
|
}) {
|
|
@@ -4551,30 +4696,30 @@ async function bi({
|
|
|
4551
4696
|
n
|
|
4552
4697
|
) ?? null;
|
|
4553
4698
|
}
|
|
4554
|
-
async function
|
|
4699
|
+
async function Ii({
|
|
4555
4700
|
elasticubeOid: e
|
|
4556
4701
|
}) {
|
|
4557
4702
|
return await b().get(
|
|
4558
4703
|
`/api/v2/perspectives/getPerspectiveElasticubesAndLatestRevisionsByOid?parentOid=${e}`
|
|
4559
4704
|
) ?? null;
|
|
4560
4705
|
}
|
|
4561
|
-
async function
|
|
4706
|
+
async function Zi({
|
|
4562
4707
|
elasticubeOid: e,
|
|
4563
4708
|
filePath: t,
|
|
4564
4709
|
fileName: n,
|
|
4565
4710
|
table: a,
|
|
4566
4711
|
perspectiveOid: r
|
|
4567
4712
|
}) {
|
|
4568
|
-
const i = t.split("/").pop(), s = (i == null ? void 0 : i.replace(".csv", "")) || "", l = n.replace(".csv", ""), { schemaName: c, columns: d } = a, u = d.map((
|
|
4569
|
-
name:
|
|
4570
|
-
type:
|
|
4571
|
-
oid:
|
|
4572
|
-
size:
|
|
4573
|
-
precision:
|
|
4574
|
-
scale:
|
|
4713
|
+
const i = t.split("/").pop(), s = (i == null ? void 0 : i.replace(".csv", "")) || "", l = n.replace(".csv", ""), { schemaName: c, columns: d } = a, u = d.map((O) => ({
|
|
4714
|
+
name: O.columnName,
|
|
4715
|
+
type: O.dbType,
|
|
4716
|
+
oid: ee(),
|
|
4717
|
+
size: O.size,
|
|
4718
|
+
precision: O.precision,
|
|
4719
|
+
scale: O.scale,
|
|
4575
4720
|
hidden: !1,
|
|
4576
4721
|
indexed: !0,
|
|
4577
|
-
id:
|
|
4722
|
+
id: O.columnName
|
|
4578
4723
|
})), p = {
|
|
4579
4724
|
operationName: "addDataset",
|
|
4580
4725
|
variables: {
|
|
@@ -4617,7 +4762,7 @@ async function vi({
|
|
|
4617
4762
|
tupleTransformations: []
|
|
4618
4763
|
}
|
|
4619
4764
|
],
|
|
4620
|
-
suggestedOid:
|
|
4765
|
+
suggestedOid: ee(),
|
|
4621
4766
|
schemaName: c,
|
|
4622
4767
|
perspectiveOid: r,
|
|
4623
4768
|
updatedPerspectiveData: {
|
|
@@ -4654,7 +4799,7 @@ async function vi({
|
|
|
4654
4799
|
p
|
|
4655
4800
|
), columns: u, tableOid: s };
|
|
4656
4801
|
}
|
|
4657
|
-
async function
|
|
4802
|
+
async function Li({
|
|
4658
4803
|
elasticubeOid: e
|
|
4659
4804
|
}) {
|
|
4660
4805
|
const t = {
|
|
@@ -4677,12 +4822,12 @@ async function wi({
|
|
|
4677
4822
|
t
|
|
4678
4823
|
) ?? null;
|
|
4679
4824
|
}
|
|
4680
|
-
async function
|
|
4825
|
+
async function Ri() {
|
|
4681
4826
|
return await b().get(
|
|
4682
4827
|
"/api/v2/builds"
|
|
4683
4828
|
) ?? null;
|
|
4684
4829
|
}
|
|
4685
|
-
async function
|
|
4830
|
+
async function Ui({
|
|
4686
4831
|
elasticubeOid: e,
|
|
4687
4832
|
source: t,
|
|
4688
4833
|
target: n
|
|
@@ -4693,7 +4838,7 @@ async function Oi({
|
|
|
4693
4838
|
elasticubeOid: e,
|
|
4694
4839
|
source: t,
|
|
4695
4840
|
target: n,
|
|
4696
|
-
suggestedOid:
|
|
4841
|
+
suggestedOid: ee()
|
|
4697
4842
|
},
|
|
4698
4843
|
query: `mutation addRelation($elasticubeOid: UUID!, $source: RelationReferenceInput!, $target: RelationReferenceInput!, $suggestedOid: UUID!) {
|
|
4699
4844
|
relation: addRelation(
|
|
@@ -4717,7 +4862,7 @@ async function Oi({
|
|
|
4717
4862
|
a
|
|
4718
4863
|
) ?? null;
|
|
4719
4864
|
}
|
|
4720
|
-
async function
|
|
4865
|
+
async function zi() {
|
|
4721
4866
|
var a;
|
|
4722
4867
|
const e = b(), t = {
|
|
4723
4868
|
operationName: "elasticubesMetadata",
|
|
@@ -4842,7 +4987,7 @@ fragment experiments on Experiments {
|
|
|
4842
4987
|
throw new Error("Failed to get elasticubes list");
|
|
4843
4988
|
return n.data.elasticubesMetadata;
|
|
4844
4989
|
}
|
|
4845
|
-
async function
|
|
4990
|
+
async function Bi({
|
|
4846
4991
|
cubeOid: e
|
|
4847
4992
|
}) {
|
|
4848
4993
|
const t = b(), n = {
|
|
@@ -5018,7 +5163,7 @@ fragment experiments on Experiments {
|
|
|
5018
5163
|
n
|
|
5019
5164
|
) ?? null;
|
|
5020
5165
|
}
|
|
5021
|
-
async function
|
|
5166
|
+
async function Fi({
|
|
5022
5167
|
oid: e,
|
|
5023
5168
|
replacementDataSource: t
|
|
5024
5169
|
}) {
|
|
@@ -5040,7 +5185,7 @@ async function Ci({
|
|
|
5040
5185
|
throw new Error("Failed to delete elasticube");
|
|
5041
5186
|
return r.data.removeElasticubeByOid;
|
|
5042
5187
|
}
|
|
5043
|
-
async function
|
|
5188
|
+
async function Yo(e, t) {
|
|
5044
5189
|
const n = b(), a = new File([t], e, { type: "text/csv" }), r = {
|
|
5045
5190
|
filename: e,
|
|
5046
5191
|
size: a.size
|
|
@@ -5052,8 +5197,8 @@ async function ko(e, t) {
|
|
|
5052
5197
|
throw new Error("Failed to get file validation token");
|
|
5053
5198
|
return { file: a, fileToken: i.token };
|
|
5054
5199
|
}
|
|
5055
|
-
async function
|
|
5056
|
-
const n = b(), { fileToken: a, file: r } = await
|
|
5200
|
+
async function qi(e, t) {
|
|
5201
|
+
const n = b(), { fileToken: a, file: r } = await Yo(e, t), i = new FormData();
|
|
5057
5202
|
i.append("file", r);
|
|
5058
5203
|
const s = {
|
|
5059
5204
|
Accept: "application/json",
|
|
@@ -5073,19 +5218,19 @@ async function _i(e, t) {
|
|
|
5073
5218
|
) : new Error("Failed to upload file");
|
|
5074
5219
|
return await l.json();
|
|
5075
5220
|
}
|
|
5076
|
-
async function
|
|
5221
|
+
async function Hi() {
|
|
5077
5222
|
return await b().get("api/globals");
|
|
5078
5223
|
}
|
|
5079
|
-
const
|
|
5080
|
-
async function
|
|
5224
|
+
const vt = "api/v2/settings/ai/llm";
|
|
5225
|
+
async function Wi() {
|
|
5081
5226
|
const t = await b().get(
|
|
5082
|
-
|
|
5227
|
+
vt
|
|
5083
5228
|
);
|
|
5084
5229
|
if (!t)
|
|
5085
5230
|
throw new Error("Failed to load LLM settings");
|
|
5086
5231
|
return t;
|
|
5087
5232
|
}
|
|
5088
|
-
async function
|
|
5233
|
+
async function Vi(e) {
|
|
5089
5234
|
const t = b(), n = {
|
|
5090
5235
|
provider: e.provider,
|
|
5091
5236
|
model: e.model,
|
|
@@ -5097,134 +5242,142 @@ async function xi(e) {
|
|
|
5097
5242
|
aiAssistant: e.aiAssistant
|
|
5098
5243
|
};
|
|
5099
5244
|
try {
|
|
5100
|
-
return await t.post(
|
|
5245
|
+
return await t.post(vt, n), e;
|
|
5101
5246
|
} catch (a) {
|
|
5102
5247
|
throw console.error("Error updating LLM settings:", a), a;
|
|
5103
5248
|
}
|
|
5104
5249
|
}
|
|
5105
5250
|
export {
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
tt as
|
|
5145
|
-
|
|
5251
|
+
Po as CHART_TYPE_KEYWORDS,
|
|
5252
|
+
Oe as DATA_SOURCES_API_URL_PATH,
|
|
5253
|
+
Ao as DEFAULT_QUERY_COUNT,
|
|
5254
|
+
oo as TOOL_CONTEXT_MAX_ASSETS,
|
|
5255
|
+
eo as TOOL_NAME_CHART_BUILDER,
|
|
5256
|
+
pi as TOOL_NAME_DASHBOARD_BUILDER,
|
|
5257
|
+
mi as TOOL_NAME_DATA_MODEL_BUILDER,
|
|
5258
|
+
no as TOOL_NAME_GET_DASHBOARDS,
|
|
5259
|
+
ao as TOOL_NAME_GET_DATA_SOURCES,
|
|
5260
|
+
ro as TOOL_NAME_GET_DATA_SOURCE_FIELDS,
|
|
5261
|
+
to as TOOL_NAME_RECOMMEND_QUERIES,
|
|
5262
|
+
ae as TRACEPARENT_HEADER,
|
|
5263
|
+
ne as USER_ACTION_ID_HEADER,
|
|
5264
|
+
Zi as addDataSet,
|
|
5265
|
+
Ui as addRelation,
|
|
5266
|
+
yo as addWidgetToFusionDashboard,
|
|
5267
|
+
Ho as addWidgetsToDashboard,
|
|
5268
|
+
Vo as addWidgetsToExistingDashboard,
|
|
5269
|
+
Co as addWidgetsToFusionDashboard,
|
|
5270
|
+
ko as adjustSingleColumnWidth,
|
|
5271
|
+
$n as axesMapping,
|
|
5272
|
+
hi as buildChartEngine,
|
|
5273
|
+
ni as buildChartSchema,
|
|
5274
|
+
_o as buildContextualPrompt,
|
|
5275
|
+
Li as buildElasticube,
|
|
5276
|
+
Ri as buildStatus,
|
|
5277
|
+
ki as changeDashboard,
|
|
5278
|
+
di as chartDataOptionsSchemas,
|
|
5279
|
+
En as chartIdSchema,
|
|
5280
|
+
kn as chartRecommendationsSchema,
|
|
5281
|
+
re as chartType,
|
|
5282
|
+
No as cleanupDashboardAfterChange,
|
|
5283
|
+
Eo as cleanupOrphanedCells,
|
|
5284
|
+
Mn as createChartSchema,
|
|
5285
|
+
Ba as createCustomFetch,
|
|
5286
|
+
Mi as createElasticube,
|
|
5287
|
+
qo as createEmptyDashboard,
|
|
5288
|
+
Ie as createEmptyFusionDashboard,
|
|
5289
|
+
tt as createHttpClientFromAuthenticator,
|
|
5290
|
+
Ua as createHttpClientFromConfig,
|
|
5291
|
+
Ei as createNewDashboard,
|
|
5292
|
+
nt as createOpenAIClient,
|
|
5293
|
+
qa as createOpenAIClientHelper,
|
|
5146
5294
|
ve as createStructuredCompletion,
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5295
|
+
Ha as createToolsCompletion,
|
|
5296
|
+
C as dataOptionsEditingSchemas,
|
|
5297
|
+
Fi as deleteElasticube,
|
|
5298
|
+
Si as deleteFusionDashboard,
|
|
5299
|
+
wt as deleteWidgetsFromDashboard,
|
|
5300
|
+
oi as endUserAction,
|
|
5301
|
+
yn as excludeSchemaProperties,
|
|
5302
|
+
To as extractChartTypeFromPrompt,
|
|
5303
|
+
jo as extractWidgetIdsFromLayout,
|
|
5304
|
+
ye as filterSchemaProperties,
|
|
5305
|
+
Mo as findOutOfPlaceWidgets,
|
|
5306
|
+
lt as generateChart,
|
|
5307
|
+
Na as generateTraceparent,
|
|
5308
|
+
Ma as generateUserActionId,
|
|
5309
|
+
So as getAvailableFusionDashboards,
|
|
5310
|
+
io as getBaseChartSummary,
|
|
5311
|
+
Bo as getBaseDashboardConfig,
|
|
5312
|
+
Ni as getCSVSchemaDetails,
|
|
5313
|
+
xi as getDashboardDataSourcesMap,
|
|
5314
|
+
Ai as getDashboardsEngine,
|
|
5315
|
+
Pi as getDashboardsSchema,
|
|
5316
|
+
bt as getDataSourceByTitle,
|
|
5317
|
+
mo as getDataSourceFields,
|
|
5318
|
+
yi as getDataSourceFieldsEngine,
|
|
5319
|
+
wi as getDataSourceFieldsSchema,
|
|
5320
|
+
yt as getDataSourceFieldsWithDescriptions,
|
|
5321
|
+
ft as getDataSourceSchema,
|
|
5322
|
+
po as getDataSources,
|
|
5323
|
+
fi as getDataSourcesEngine,
|
|
5324
|
+
bi as getDataSourcesSchema,
|
|
5325
|
+
Bi as getElasticube,
|
|
5326
|
+
zi as getElasticubes,
|
|
5327
|
+
bo as getFusionDashboardModel,
|
|
5328
|
+
Oo as getFusionDashboardProps,
|
|
5329
|
+
vi as getFusionDashboardUrl,
|
|
5330
|
+
fo as getFusionDashboardWidgets,
|
|
5331
|
+
go as getFusionDashboards,
|
|
5181
5332
|
b as getHttpClient,
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5333
|
+
Wi as getLlmSettings,
|
|
5334
|
+
ci as getNlqResult,
|
|
5335
|
+
Ya as getNlqResultLight,
|
|
5336
|
+
Qa as getNlqV3Result,
|
|
5337
|
+
gi as getNormalizedDataSourceFields,
|
|
5338
|
+
ot as getOpenAIClient,
|
|
5339
|
+
Ii as getPerspectiveOid,
|
|
5340
|
+
ui as getQueryRecommendations,
|
|
5341
|
+
Ga as getQueryRecommendationsLight,
|
|
5342
|
+
Za as getUserActionHeaders,
|
|
5343
|
+
li as initializeClients,
|
|
5344
|
+
at as initializeHttpClient,
|
|
5345
|
+
rt as initializeOpenAIClient,
|
|
5346
|
+
Ci as isDashboardSaved,
|
|
5347
|
+
Ze as layoutDashboardWidgets,
|
|
5348
|
+
Oi as loadExistingDashboardFromFusion,
|
|
5349
|
+
Hi as loadGlobals,
|
|
5350
|
+
W as nanoidHex,
|
|
5351
|
+
ee as nanoidUUIDv4,
|
|
5352
|
+
ho as normalizeFields,
|
|
5353
|
+
we as normalizeUrl,
|
|
5354
|
+
jn as nullableChartType,
|
|
5355
|
+
ai as parseError,
|
|
5205
5356
|
be as patchFusionDashboard,
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5357
|
+
Di as persistDashboardToFusion,
|
|
5358
|
+
_i as recommendQueriesEngine,
|
|
5359
|
+
Ti as recommendQueriesSchema,
|
|
5360
|
+
ii as resetHttpClient,
|
|
5361
|
+
si as resetOpenAIClient,
|
|
5362
|
+
$i as resetWidgetForDashboard,
|
|
5363
|
+
ri as startUserAction,
|
|
5364
|
+
Z as updateChartSchema,
|
|
5365
|
+
Ln as updateChartSortingSchema,
|
|
5366
|
+
zn as updateChartStyleOptionsSchema,
|
|
5367
|
+
Nn as updateChartTitleSchema,
|
|
5368
|
+
Zn as updateChartTypeOfMeasuresSchema,
|
|
5369
|
+
In as updateChartTypeSchema,
|
|
5370
|
+
ji as updateDashboardTitle,
|
|
5371
|
+
Wo as updateDashboardWidgetsLayout,
|
|
5372
|
+
Do as updateFusionDashboardFilters,
|
|
5373
|
+
Vi as updateLlmSettings,
|
|
5374
|
+
Un as updateOtherChartDataOptionsSchema,
|
|
5375
|
+
Rn as updateTrendAndForecastSchema,
|
|
5376
|
+
qi as uploadCSVMultipart,
|
|
5377
|
+
oe as userActionContext,
|
|
5378
|
+
Y as withTrackingHeaders,
|
|
5379
|
+
zo as withWidgetAdded,
|
|
5380
|
+
wn as zodFunction,
|
|
5381
|
+
I as zodToReadableType
|
|
5229
5382
|
};
|
|
5230
5383
|
//# sourceMappingURL=index.js.map
|