@magemetrics/core 0.3.1 → 0.3.3
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/index.d.ts +105 -663
- package/dist/index.js +315 -77
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -54,7 +54,7 @@ var addApiKeyHeader = (apiKey) => {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
// ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@
|
|
57
|
+
// ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.1.12/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs
|
|
58
58
|
function __rest(s, e) {
|
|
59
59
|
var t = {};
|
|
60
60
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -66,15 +66,242 @@ function __rest(s, e) {
|
|
|
66
66
|
}
|
|
67
67
|
return t;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
var ZodTypeKeys = {
|
|
70
|
+
ZodAny: "any",
|
|
71
|
+
ZodArray: "array",
|
|
72
|
+
ZodBigInt: "bigint",
|
|
73
|
+
ZodBoolean: "boolean",
|
|
74
|
+
ZodDefault: "default",
|
|
75
|
+
ZodTransform: "transform",
|
|
76
|
+
ZodEnum: "enum",
|
|
77
|
+
ZodIntersection: "intersection",
|
|
78
|
+
ZodLiteral: "literal",
|
|
79
|
+
ZodNever: "never",
|
|
80
|
+
ZodNull: "null",
|
|
81
|
+
ZodNullable: "nullable",
|
|
82
|
+
ZodNumber: "number",
|
|
83
|
+
ZodNonOptional: "nonoptional",
|
|
84
|
+
ZodObject: "object",
|
|
85
|
+
ZodOptional: "optional",
|
|
86
|
+
ZodPipe: "pipe",
|
|
87
|
+
ZodReadonly: "readonly",
|
|
88
|
+
ZodRecord: "record",
|
|
89
|
+
ZodString: "string",
|
|
90
|
+
ZodTuple: "tuple",
|
|
91
|
+
ZodType: "type",
|
|
92
|
+
ZodUnion: "union",
|
|
93
|
+
ZodDiscriminatedUnion: "union",
|
|
94
|
+
ZodUnknown: "unknown",
|
|
95
|
+
ZodVoid: "void",
|
|
96
|
+
ZodDate: "date"
|
|
97
|
+
};
|
|
98
|
+
function isZodType(schema, typeNames) {
|
|
99
|
+
const typeNamesArray = Array.isArray(typeNames) ? typeNames : [typeNames];
|
|
100
|
+
return typeNamesArray.some((typeName) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const typeNameMatch = ((_a = schema === null || schema === void 0 ? void 0 : schema.def) === null || _a === void 0 ? void 0 : _a.type) === ZodTypeKeys[typeName];
|
|
103
|
+
if (typeName === "ZodDiscriminatedUnion") {
|
|
104
|
+
return typeNameMatch && "discriminator" in schema.def;
|
|
105
|
+
}
|
|
106
|
+
return typeNameMatch;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function isAnyZodType(schema) {
|
|
110
|
+
return "def" in schema;
|
|
111
|
+
}
|
|
112
|
+
var $ZodRegistry = class {
|
|
113
|
+
constructor() {
|
|
114
|
+
this._map = /* @__PURE__ */ new Map();
|
|
115
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
116
|
+
}
|
|
117
|
+
add(schema, ..._meta) {
|
|
118
|
+
const meta = _meta[0];
|
|
119
|
+
this._map.set(schema, meta);
|
|
120
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
121
|
+
if (this._idmap.has(meta.id)) {
|
|
122
|
+
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
123
|
+
}
|
|
124
|
+
this._idmap.set(meta.id, schema);
|
|
125
|
+
}
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
clear() {
|
|
129
|
+
this._map = /* @__PURE__ */ new Map();
|
|
130
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
remove(schema) {
|
|
134
|
+
const meta = this._map.get(schema);
|
|
135
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
136
|
+
this._idmap.delete(meta.id);
|
|
137
|
+
}
|
|
138
|
+
this._map.delete(schema);
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
get(schema) {
|
|
142
|
+
const p = schema._zod.parent;
|
|
143
|
+
if (p) {
|
|
144
|
+
const pm = { ...this.get(p) ?? {} };
|
|
145
|
+
delete pm.id;
|
|
146
|
+
return { ...pm, ...this._map.get(schema) };
|
|
147
|
+
}
|
|
148
|
+
return this._map.get(schema);
|
|
149
|
+
}
|
|
150
|
+
has(schema) {
|
|
151
|
+
return this._map.has(schema);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
function registry() {
|
|
155
|
+
return new $ZodRegistry();
|
|
156
|
+
}
|
|
157
|
+
function isUndefined(value) {
|
|
158
|
+
return value === void 0;
|
|
159
|
+
}
|
|
160
|
+
function omit(object, keys) {
|
|
161
|
+
const result = {};
|
|
162
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
163
|
+
if (!keys.some((keyToOmit) => keyToOmit === key)) {
|
|
164
|
+
result[key] = value;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return result;
|
|
72
168
|
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
|
|
169
|
+
function omitBy(object, predicate) {
|
|
170
|
+
const result = {};
|
|
171
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
172
|
+
if (!predicate(value, key)) {
|
|
173
|
+
result[key] = value;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
var zodToOpenAPIRegistry = registry();
|
|
179
|
+
var Metadata = class {
|
|
180
|
+
static collectMetadata(schema, metadata) {
|
|
181
|
+
const currentMetadata = this.getMetadataFromRegistry(schema);
|
|
182
|
+
const _internal = Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata._internal), metadata === null || metadata === void 0 ? void 0 : metadata._internal);
|
|
183
|
+
const param = Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.param), metadata === null || metadata === void 0 ? void 0 : metadata.param);
|
|
184
|
+
const totalMetadata = Object.assign(Object.assign(Object.assign(Object.assign({}, Object.keys(_internal).length > 0 ? { _internal } : {}), currentMetadata), metadata), Object.keys(param).length > 0 ? { param } : {});
|
|
185
|
+
if (isZodType(schema, [
|
|
186
|
+
"ZodOptional",
|
|
187
|
+
"ZodNullable",
|
|
188
|
+
"ZodDefault",
|
|
189
|
+
"ZodReadonly",
|
|
190
|
+
"ZodNonOptional"
|
|
191
|
+
]) && isAnyZodType(schema._zod.def.innerType)) {
|
|
192
|
+
return this.collectMetadata(schema._zod.def.innerType, totalMetadata);
|
|
193
|
+
}
|
|
194
|
+
if (isZodType(schema, "ZodPipe")) {
|
|
195
|
+
const inSchema = schema._zod.def.in;
|
|
196
|
+
const outSchema = schema._zod.def.out;
|
|
197
|
+
if (isZodType(inSchema, "ZodTransform") && isAnyZodType(outSchema)) {
|
|
198
|
+
return this.collectMetadata(outSchema, totalMetadata);
|
|
199
|
+
}
|
|
200
|
+
if (isAnyZodType(inSchema)) {
|
|
201
|
+
return this.collectMetadata(inSchema, totalMetadata);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return totalMetadata;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated Use one of `getOpenApiMetadata` or `getInternalMetadata` instead
|
|
208
|
+
*/
|
|
209
|
+
static getMetadata(zodSchema) {
|
|
210
|
+
return this.collectMetadata(zodSchema);
|
|
211
|
+
}
|
|
212
|
+
static getOpenApiMetadata(zodSchema) {
|
|
213
|
+
const metadata = this.collectMetadata(zodSchema);
|
|
214
|
+
const _a = metadata !== null && metadata !== void 0 ? metadata : {}, rest = __rest(_a, ["_internal"]);
|
|
215
|
+
return rest;
|
|
216
|
+
}
|
|
217
|
+
static getInternalMetadata(zodSchema) {
|
|
218
|
+
var _a;
|
|
219
|
+
return (_a = this.collectMetadata(zodSchema)) === null || _a === void 0 ? void 0 : _a._internal;
|
|
220
|
+
}
|
|
221
|
+
static getParamMetadata(zodSchema) {
|
|
222
|
+
const metadata = this.collectMetadata(zodSchema);
|
|
223
|
+
return Object.assign(Object.assign({}, metadata), {
|
|
224
|
+
// A description provided from .openapi() should be taken with higher precedence
|
|
225
|
+
param: Object.assign(Object.assign({}, (metadata === null || metadata === void 0 ? void 0 : metadata.description) ? { description: metadata.description } : {}), metadata === null || metadata === void 0 ? void 0 : metadata.param)
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* A method that omits all custom keys added to the regular OpenAPI
|
|
230
|
+
* metadata properties
|
|
231
|
+
*/
|
|
232
|
+
static buildSchemaMetadata(metadata) {
|
|
233
|
+
return omitBy(omit(metadata, ["param", "_internal"]), isUndefined);
|
|
234
|
+
}
|
|
235
|
+
static buildParameterMetadata(metadata) {
|
|
236
|
+
return omitBy(metadata, isUndefined);
|
|
237
|
+
}
|
|
238
|
+
static applySchemaMetadata(initialData, metadata) {
|
|
239
|
+
return omitBy(Object.assign(Object.assign({}, initialData), this.buildSchemaMetadata(metadata)), isUndefined);
|
|
240
|
+
}
|
|
241
|
+
static getRefId(zodSchema) {
|
|
242
|
+
var _a;
|
|
243
|
+
return (_a = this.getInternalMetadata(zodSchema)) === null || _a === void 0 ? void 0 : _a.refId;
|
|
244
|
+
}
|
|
245
|
+
static unwrapChained(schema) {
|
|
246
|
+
return this.unwrapUntil(schema);
|
|
247
|
+
}
|
|
248
|
+
static getDefaultValue(zodSchema) {
|
|
249
|
+
const unwrapped = this.unwrapUntil(zodSchema, "ZodDefault");
|
|
250
|
+
return unwrapped === null || unwrapped === void 0 ? void 0 : unwrapped._zod.def.defaultValue;
|
|
251
|
+
}
|
|
252
|
+
static unwrapUntil(schema, typeName) {
|
|
253
|
+
if (typeName && isZodType(schema, typeName)) {
|
|
254
|
+
return schema;
|
|
255
|
+
}
|
|
256
|
+
if (isZodType(schema, [
|
|
257
|
+
"ZodOptional",
|
|
258
|
+
"ZodNullable",
|
|
259
|
+
"ZodDefault",
|
|
260
|
+
"ZodReadonly",
|
|
261
|
+
"ZodNonOptional"
|
|
262
|
+
]) && isAnyZodType(schema._zod.def.innerType)) {
|
|
263
|
+
return this.unwrapUntil(schema._zod.def.innerType, typeName);
|
|
264
|
+
}
|
|
265
|
+
if (isZodType(schema, "ZodPipe")) {
|
|
266
|
+
const inSchema = schema._zod.def.in;
|
|
267
|
+
const outSchema = schema._zod.def.out;
|
|
268
|
+
if (isZodType(inSchema, "ZodTransform") && isAnyZodType(outSchema)) {
|
|
269
|
+
return this.unwrapUntil(outSchema, typeName);
|
|
270
|
+
}
|
|
271
|
+
if (isAnyZodType(inSchema)) {
|
|
272
|
+
return this.unwrapUntil(inSchema, typeName);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return typeName ? void 0 : schema;
|
|
276
|
+
}
|
|
277
|
+
static getMetadataFromInternalRegistry(zodSchema) {
|
|
278
|
+
return zodToOpenAPIRegistry.get(zodSchema);
|
|
279
|
+
}
|
|
280
|
+
static getMetadataFromRegistry(zodSchema) {
|
|
281
|
+
const internal = this.getMetadataFromInternalRegistry(zodSchema);
|
|
282
|
+
const general = zodSchema.meta();
|
|
283
|
+
if (!internal) {
|
|
284
|
+
return general;
|
|
285
|
+
}
|
|
286
|
+
const { _internal } = internal, rest = __rest(internal, ["_internal"]);
|
|
287
|
+
const _a = general !== null && general !== void 0 ? general : {}, { id, title } = _a, restGeneral = __rest(_a, ["id", "title"]);
|
|
288
|
+
return Object.assign(Object.assign(Object.assign({ _internal: Object.assign(Object.assign({}, id ? { refId: id } : {}), _internal) }, rest), title ? { description: title } : {}), restGeneral);
|
|
289
|
+
}
|
|
290
|
+
static setMetadataInRegistry(zodSchema, metadata) {
|
|
291
|
+
zodToOpenAPIRegistry.add(zodSchema, metadata);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
function preserveMetadataFromModifier(zodSchema, modifier) {
|
|
295
|
+
const zodModifier = zodSchema[modifier];
|
|
296
|
+
if (typeof zodModifier !== "function") {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
zodSchema[modifier] = function(...args) {
|
|
76
300
|
const result = zodModifier.apply(this, args);
|
|
77
|
-
|
|
301
|
+
const meta = Metadata.getMetadataFromRegistry(this);
|
|
302
|
+
if (meta) {
|
|
303
|
+
Metadata.setMetadataInRegistry(result, meta);
|
|
304
|
+
}
|
|
78
305
|
return result;
|
|
79
306
|
};
|
|
80
307
|
}
|
|
@@ -82,59 +309,66 @@ function extendZodWithOpenApi(zod) {
|
|
|
82
309
|
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
|
83
310
|
return;
|
|
84
311
|
}
|
|
85
|
-
zod.ZodType.prototype.openapi = function(
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
312
|
+
zod.ZodType.prototype.openapi = function(...args) {
|
|
313
|
+
const { refId, metadata, options } = getOpenApiConfiguration(...args);
|
|
314
|
+
const _a = metadata !== null && metadata !== void 0 ? metadata : {}, { param } = _a, restOfOpenApi = __rest(_a, ["param"]);
|
|
315
|
+
const allMetadata = Metadata.getMetadataFromRegistry(this);
|
|
316
|
+
const _b = allMetadata !== null && allMetadata !== void 0 ? allMetadata : {}, { _internal: internalMetadata } = _b, currentMetadata = __rest(_b, ["_internal"]);
|
|
317
|
+
const _internal = Object.assign(Object.assign(Object.assign({}, internalMetadata), options), refId ? { refId } : void 0);
|
|
318
|
+
const resultMetadata = Object.assign(Object.assign(Object.assign({}, currentMetadata), restOfOpenApi), (currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.param) || param ? {
|
|
319
|
+
param: Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.param), param)
|
|
92
320
|
} : void 0);
|
|
93
|
-
const result = new this.constructor(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
extendedResult
|
|
321
|
+
const result = new this.constructor(this._def);
|
|
322
|
+
Metadata.setMetadataInRegistry(result, Object.assign(Object.assign({}, Object.keys(_internal).length > 0 ? { _internal } : void 0), resultMetadata));
|
|
323
|
+
if (isZodType(result, "ZodObject")) {
|
|
324
|
+
const currentMetadata2 = Metadata.getMetadataFromRegistry(result);
|
|
325
|
+
const originalExtend = result.extend;
|
|
326
|
+
result.extend = function(...args2) {
|
|
327
|
+
const extendedResult = originalExtend.apply(result, args2);
|
|
328
|
+
const _a2 = currentMetadata2 !== null && currentMetadata2 !== void 0 ? currentMetadata2 : {}, { _internal: _internal2 } = _a2, rest = __rest(_a2, ["_internal"]);
|
|
329
|
+
Metadata.setMetadataInRegistry(extendedResult, {
|
|
100
330
|
_internal: {
|
|
101
|
-
extendedFrom: (
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return extendedResult;
|
|
331
|
+
extendedFrom: (_internal2 === null || _internal2 === void 0 ? void 0 : _internal2.refId) ? { refId: _internal2.refId, schema: result } : _internal2 === null || _internal2 === void 0 ? void 0 : _internal2.extendedFrom
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
return extendedResult.openapi(rest);
|
|
106
335
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
zod.ZodObject.prototype.pick = function(...args) {
|
|
129
|
-
const result = zodPick.apply(this, args);
|
|
130
|
-
result._def.openapi = void 0;
|
|
336
|
+
preserveMetadataFromModifier(result, "catchall");
|
|
337
|
+
}
|
|
338
|
+
preserveMetadataFromModifier(result, "optional");
|
|
339
|
+
preserveMetadataFromModifier(result, "nullable");
|
|
340
|
+
preserveMetadataFromModifier(result, "default");
|
|
341
|
+
preserveMetadataFromModifier(result, "transform");
|
|
342
|
+
preserveMetadataFromModifier(result, "refine");
|
|
343
|
+
preserveMetadataFromModifier(result, "length");
|
|
344
|
+
preserveMetadataFromModifier(result, "min");
|
|
345
|
+
preserveMetadataFromModifier(result, "max");
|
|
346
|
+
const originalMeta = result.meta;
|
|
347
|
+
result.meta = function(...args2) {
|
|
348
|
+
const result2 = originalMeta.apply(this, args2);
|
|
349
|
+
if (args2[0]) {
|
|
350
|
+
const meta = Metadata.getMetadataFromInternalRegistry(this);
|
|
351
|
+
if (meta) {
|
|
352
|
+
Metadata.setMetadataInRegistry(result2, Object.assign(Object.assign({}, meta), args2[0]));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return result2;
|
|
356
|
+
};
|
|
131
357
|
return result;
|
|
132
358
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
359
|
+
}
|
|
360
|
+
function getOpenApiConfiguration(refOrOpenapi, metadataOrOptions, options) {
|
|
361
|
+
if (typeof refOrOpenapi === "string") {
|
|
362
|
+
return {
|
|
363
|
+
refId: refOrOpenapi,
|
|
364
|
+
metadata: metadataOrOptions,
|
|
365
|
+
options
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
refId: void 0,
|
|
370
|
+
metadata: refOrOpenapi,
|
|
371
|
+
options: metadataOrOptions
|
|
138
372
|
};
|
|
139
373
|
}
|
|
140
374
|
new Set(".\\+*[^]$()");
|
|
@@ -155,11 +389,11 @@ var TanStackColumnSchema = z.object({
|
|
|
155
389
|
accessorKey: z.string(),
|
|
156
390
|
header: z.string(),
|
|
157
391
|
cell: z.any().optional(),
|
|
158
|
-
meta: z.record(z.any()).optional()
|
|
392
|
+
meta: z.record(z.string(), z.any()).optional()
|
|
159
393
|
});
|
|
160
394
|
var SqlPreviewResponseSchema = z.object({
|
|
161
395
|
columns: z.array(TanStackColumnSchema),
|
|
162
|
-
data: z.array(z.record(z.any())),
|
|
396
|
+
data: z.array(z.record(z.string(), z.any())),
|
|
163
397
|
metadata: z.object({
|
|
164
398
|
wasSampled: z.boolean(),
|
|
165
399
|
originalCount: z.number(),
|
|
@@ -337,7 +571,7 @@ var BusinessExplanationSchema = z.object({
|
|
|
337
571
|
var FlowStepSchema = z.object({
|
|
338
572
|
name: z.string(),
|
|
339
573
|
status: z.enum(["running", "completed", "failed", "awaiting_input"]),
|
|
340
|
-
output: z.
|
|
574
|
+
output: z.looseObject({}).or(z.unknown().array()).nullable()
|
|
341
575
|
});
|
|
342
576
|
var DatabaseFlowSchema = z.object({
|
|
343
577
|
created_at: z.string(),
|
|
@@ -363,13 +597,13 @@ var FrontendRecentFlowsSchema = DatabaseFlowSchema.omit({
|
|
|
363
597
|
flow_steps: true,
|
|
364
598
|
flow_chat_messages: true
|
|
365
599
|
});
|
|
366
|
-
var ReportColumnSchema = z.
|
|
600
|
+
var ReportColumnSchema = z.looseObject({
|
|
367
601
|
position: z.number().nonnegative().optional(),
|
|
368
602
|
data_type: z.string(),
|
|
369
603
|
null_count: z.number().nullable(),
|
|
370
604
|
unique_count: z.number().nullable(),
|
|
371
605
|
unique_percentage: z.number().nullable()
|
|
372
|
-
})
|
|
606
|
+
});
|
|
373
607
|
var ReportSchema = z.object({
|
|
374
608
|
created_at: z.string(),
|
|
375
609
|
flow_id: z.string(),
|
|
@@ -380,10 +614,10 @@ var ReportSchema = z.object({
|
|
|
380
614
|
table: z.string(),
|
|
381
615
|
title: z.string(),
|
|
382
616
|
request: z.string().nullable(),
|
|
383
|
-
data_sample: z.array(z.record(z.unknown())),
|
|
384
|
-
data_summary: z.
|
|
617
|
+
data_sample: z.array(z.record(z.string(), z.unknown())),
|
|
618
|
+
data_summary: z.looseObject({
|
|
385
619
|
columns: z.record(z.string(), ReportColumnSchema)
|
|
386
|
-
})
|
|
620
|
+
}),
|
|
387
621
|
bookmarked: z.boolean(),
|
|
388
622
|
status: z.string().nullable(),
|
|
389
623
|
is_removed: z.boolean()
|
|
@@ -395,7 +629,7 @@ var FrontendReportSchema = ReportSchema.omit({
|
|
|
395
629
|
is_sample: true,
|
|
396
630
|
schema: true
|
|
397
631
|
});
|
|
398
|
-
var ReportDataSchema = z.
|
|
632
|
+
var ReportDataSchema = z.looseObject({}).array().openapi("ReportData");
|
|
399
633
|
var ReportColumnsSchema = z.object({
|
|
400
634
|
name: z.string(),
|
|
401
635
|
data_type: z.string()
|
|
@@ -404,11 +638,12 @@ z.object({
|
|
|
404
638
|
render_type: z.string().nullish(),
|
|
405
639
|
unit: z.string().nullish()
|
|
406
640
|
});
|
|
407
|
-
var FrontendReportColumnsSchema =
|
|
641
|
+
var FrontendReportColumnsSchema = z.object({
|
|
642
|
+
...ReportColumnsSchema.element.shape,
|
|
408
643
|
dataType: z.string(),
|
|
409
644
|
renderType: z.string().optional(),
|
|
410
645
|
unit: z.string().optional()
|
|
411
|
-
})
|
|
646
|
+
}).array().openapi("ReportColumns");
|
|
412
647
|
z.object({
|
|
413
648
|
goal: z.string(),
|
|
414
649
|
user_friendly_goal: z.string().optional()
|
|
@@ -708,16 +943,18 @@ var BaseVisualizationSchema = z.object({
|
|
|
708
943
|
created_at: z.string(),
|
|
709
944
|
sql: z.string(),
|
|
710
945
|
bookmarked: z.boolean(),
|
|
711
|
-
data_sample: z.array(z.record(z.unknown())),
|
|
946
|
+
data_sample: z.array(z.record(z.string(), z.unknown())),
|
|
712
947
|
is_sample: z.boolean(),
|
|
713
|
-
data_summary: z.record(z.unknown())
|
|
948
|
+
data_summary: z.record(z.string(), z.unknown())
|
|
714
949
|
});
|
|
715
|
-
var V1VisualizationSchema =
|
|
950
|
+
var V1VisualizationSchema = z.object({
|
|
951
|
+
...BaseVisualizationSchema.shape,
|
|
716
952
|
configuration: V1VisualizationConfigurationSchema
|
|
717
|
-
})
|
|
718
|
-
var VisualizationSchema =
|
|
953
|
+
});
|
|
954
|
+
var VisualizationSchema = z.object({
|
|
955
|
+
...BaseVisualizationSchema.shape,
|
|
719
956
|
configuration: VisualizationConfigurationSchema
|
|
720
|
-
})
|
|
957
|
+
});
|
|
721
958
|
var VisualizationDataSchema = z.array(z.record(
|
|
722
959
|
z.string(),
|
|
723
960
|
// any key
|
|
@@ -1588,12 +1825,13 @@ createRoute({
|
|
|
1588
1825
|
description: "The visualizations for the report",
|
|
1589
1826
|
content: {
|
|
1590
1827
|
"application/json": {
|
|
1591
|
-
schema:
|
|
1828
|
+
schema: z.object({
|
|
1829
|
+
...FrontendReportSchema.shape,
|
|
1592
1830
|
visualizations: z.union([
|
|
1593
1831
|
V1FrontendVisualizationSchema,
|
|
1594
1832
|
FrontendVisualizationSchema
|
|
1595
1833
|
]).array()
|
|
1596
|
-
})
|
|
1834
|
+
})
|
|
1597
1835
|
}
|
|
1598
1836
|
}
|
|
1599
1837
|
},
|
|
@@ -2644,7 +2882,7 @@ var ChatMessages = createRoute({
|
|
|
2644
2882
|
content: {
|
|
2645
2883
|
"application/json": {
|
|
2646
2884
|
// we don't want to have to write a parser for Vercel AI messages
|
|
2647
|
-
schema: z.object({ messages: z.
|
|
2885
|
+
schema: z.object({ messages: z.looseObject({}).array() })
|
|
2648
2886
|
}
|
|
2649
2887
|
}
|
|
2650
2888
|
},
|
|
@@ -2870,7 +3108,7 @@ var toSearchParams = ({ cursor, filters, sorting, limit }) => {
|
|
|
2870
3108
|
|
|
2871
3109
|
// package.json
|
|
2872
3110
|
var package_default = {
|
|
2873
|
-
version: "0.3.
|
|
3111
|
+
version: "0.3.3"};
|
|
2874
3112
|
var MageMetricsChatTransport = class extends DefaultChatTransport {
|
|
2875
3113
|
constructor(apiUrl, flowId, options) {
|
|
2876
3114
|
super({
|