@lightdash/common 0.1464.3 → 0.1466.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/LICENSE +6 -2
- package/dist/compiler/exploreCompiler.d.ts +1 -1
- package/dist/compiler/exploreCompiler.js +3 -7
- package/dist/compiler/exploreCompiler.mock.js +2 -0
- package/dist/compiler/lightdashProjectConfig.d.ts +19 -0
- package/dist/compiler/lightdashProjectConfig.js +41 -0
- package/dist/compiler/translator.js +9 -11
- package/dist/compiler/translator.mock.js +9 -0
- package/dist/ee/Ai/schemas.d.ts +2094 -0
- package/dist/ee/Ai/schemas.js +201 -0
- package/dist/ee/Ai/types.d.ts +136 -0
- package/dist/ee/Ai/types.js +12 -0
- package/dist/ee/commercialFeatureFlags.d.ts +5 -0
- package/dist/ee/commercialFeatureFlags.js +9 -0
- package/dist/ee/embed/index.d.ts +180 -0
- package/dist/ee/embed/index.js +73 -0
- package/dist/ee/index.d.ts +14 -0
- package/dist/ee/index.js +19 -0
- package/dist/ee/scim/errors.d.ts +32 -0
- package/dist/ee/scim/errors.js +24 -0
- package/dist/ee/scim/types.d.ts +119 -0
- package/dist/ee/scim/types.js +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/index.test.js +23 -0
- package/dist/schemas/json/lightdash-dbt-2.0.json +50 -6
- package/dist/schemas/json/lightdash-project-config-1.0.json +33 -1
- package/dist/types/analytics.d.ts +2 -0
- package/dist/types/analytics.js +2 -0
- package/dist/types/catalog.d.ts +3 -2
- package/dist/types/dashboard.d.ts +2 -2
- package/dist/types/dbt.d.ts +5 -2
- package/dist/types/dbt.js +7 -9
- package/dist/types/explore.d.ts +2 -1
- package/dist/types/field.d.ts +2 -1
- package/dist/types/lightdashProjectConfig.d.ts +8 -1
- package/dist/types/slack.d.ts +1 -0
- package/dist/types/slackSettings.js +1 -0
- package/dist/types/tags.d.ts +5 -0
- package/dist/utils/email.d.ts +1 -0
- package/dist/utils/email.js +3 -1
- package/dist/utils/item.d.ts +1 -0
- package/package.json +1 -1
@@ -0,0 +1,201 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.aiFindFieldsToolSchema = exports.aiSummarySchema = exports.aiAskForAdditionalInformationSchema = exports.lighterMetricQuerySchema = exports.SortFieldSchema = exports.GenerateQueryFiltersToolSchema = exports.FilterSchema = exports.FilterGroupSchema = exports.FieldIdSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const conditionalRule_1 = require("../../types/conditionalRule");
|
6
|
+
const filter_1 = require("../../types/filter");
|
7
|
+
// TODO: most of the things should live in common and some of the existing types should be inferred from here
|
8
|
+
// we can't reuse them because there's a bug with TSOA+ZOD - we can't use zod types in TSOA controllers
|
9
|
+
exports.FieldIdSchema = zod_1.z
|
10
|
+
.string()
|
11
|
+
.min(1)
|
12
|
+
.describe(`Field ID is a unique identifier of a Metric or a Dimension within a project
|
13
|
+
ID consists of the table name and field name separated by an underscore.
|
14
|
+
@example: orders_status, customers_first_name, orders_total_order_amount, etc.`);
|
15
|
+
// All the operators that can be applied to a filter, now we have a validator
|
16
|
+
const FilterOperatorSchema = zod_1.z
|
17
|
+
.union([
|
18
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.NULL),
|
19
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.NOT_NULL),
|
20
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.EQUALS),
|
21
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.NOT_EQUALS),
|
22
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.STARTS_WITH),
|
23
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.ENDS_WITH),
|
24
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.INCLUDE),
|
25
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.NOT_INCLUDE),
|
26
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.LESS_THAN),
|
27
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.LESS_THAN_OR_EQUAL),
|
28
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.GREATER_THAN),
|
29
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.GREATER_THAN_OR_EQUAL),
|
30
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.IN_BETWEEN),
|
31
|
+
])
|
32
|
+
.describe('Filter operators that can be applied to a filter');
|
33
|
+
const DateFilterOperatorSchemaReqUnitOfTime = zod_1.z
|
34
|
+
.union([
|
35
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.IN_THE_PAST),
|
36
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.NOT_IN_THE_PAST),
|
37
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.IN_THE_NEXT),
|
38
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.IN_THE_CURRENT),
|
39
|
+
zod_1.z.literal(conditionalRule_1.ConditionalOperator.NOT_IN_THE_CURRENT),
|
40
|
+
])
|
41
|
+
.describe('Operators that require a unit of time to be applied on the filter');
|
42
|
+
const FilterRuleSchemaBase = zod_1.z
|
43
|
+
.object({
|
44
|
+
id: zod_1.z.string().describe('A unique identifier for the filter'),
|
45
|
+
target: zod_1.z
|
46
|
+
.object({
|
47
|
+
fieldId: exports.FieldIdSchema,
|
48
|
+
})
|
49
|
+
.describe('Target field to apply the filter'),
|
50
|
+
operator: FilterOperatorSchema.describe('Filter operator to apply to the target field'),
|
51
|
+
values: zod_1.z
|
52
|
+
.array(zod_1.z.unknown())
|
53
|
+
.describe('Values to apply to the target field using the operator'),
|
54
|
+
})
|
55
|
+
.describe('Base filter rule schema');
|
56
|
+
const UnitOfTimeFilterRuleSchema = FilterRuleSchemaBase.merge(zod_1.z.object({
|
57
|
+
operator: DateFilterOperatorSchemaReqUnitOfTime.describe('The operator to apply the filter'),
|
58
|
+
settings: zod_1.z.object({
|
59
|
+
completed: zod_1.z
|
60
|
+
.boolean()
|
61
|
+
.describe("e.g. if it's a completed month or not"),
|
62
|
+
unitOfTime: zod_1.z
|
63
|
+
.nativeEnum(filter_1.UnitOfTime)
|
64
|
+
.describe('the unit of time to apply on the filter, e.g. month, year, etc'),
|
65
|
+
}),
|
66
|
+
})).describe('Specific filter rule schema for filter operators that require unit of time');
|
67
|
+
const FilterRuleSchema = zod_1.z.union([
|
68
|
+
FilterRuleSchemaBase,
|
69
|
+
UnitOfTimeFilterRuleSchema,
|
70
|
+
]);
|
71
|
+
const AndFilterGroupSchema = zod_1.z.object({
|
72
|
+
id: zod_1.z.string().describe('A unique identifier for the filter group'),
|
73
|
+
and: zod_1.z
|
74
|
+
.array(FilterRuleSchema)
|
75
|
+
.describe('List of filters to apply to the query. Filters in AND groups can target both metrics and dimensions'),
|
76
|
+
});
|
77
|
+
const OrFilterGroupSchema = zod_1.z.object({
|
78
|
+
id: zod_1.z.string().describe('A unique identifier for the filter group'),
|
79
|
+
or: zod_1.z
|
80
|
+
.array(FilterRuleSchema)
|
81
|
+
.describe('List of filters to apply to the query. Filters in OR groups need to target either only metrics or only dimensions'),
|
82
|
+
});
|
83
|
+
exports.FilterGroupSchema = zod_1.z.union([
|
84
|
+
AndFilterGroupSchema,
|
85
|
+
OrFilterGroupSchema,
|
86
|
+
]);
|
87
|
+
exports.FilterSchema = zod_1.z.object({
|
88
|
+
dimensions: exports.FilterGroupSchema.optional(),
|
89
|
+
metrics: exports.FilterGroupSchema.optional(),
|
90
|
+
});
|
91
|
+
exports.GenerateQueryFiltersToolSchema = zod_1.z.object({
|
92
|
+
exploreName: zod_1.z.string().describe('Name of the selected explore'),
|
93
|
+
filterGroup: exports.FilterGroupSchema.describe('Filters to apply to the query. Filtered fields must exist in the selected explore.'),
|
94
|
+
});
|
95
|
+
exports.SortFieldSchema = zod_1.z.object({
|
96
|
+
fieldId: exports.FieldIdSchema.describe('"fieldId" must come from the selected Metrics or Dimensions; otherwise, it will throw an error.'),
|
97
|
+
descending: zod_1.z
|
98
|
+
.boolean()
|
99
|
+
.optional()
|
100
|
+
.default(true)
|
101
|
+
.describe('(optional, default true). If true sorts in descending order, if false sorts in ascending order'),
|
102
|
+
});
|
103
|
+
// export const CompactOrAliasSchema = z
|
104
|
+
// .nativeEnum(Compact)
|
105
|
+
// .or(z.enum(CompactAlias));
|
106
|
+
// export const CustomFormatSchema = z.object({
|
107
|
+
// type: z.nativeEnum(CustomFormatType).describe('Type of custom format'),
|
108
|
+
// round: z
|
109
|
+
// .number()
|
110
|
+
// .optional()
|
111
|
+
// .describe('Number of decimal places to round to'),
|
112
|
+
// separator: z
|
113
|
+
// .nativeEnum(NumberSeparator)
|
114
|
+
// .optional()
|
115
|
+
// .describe('Separator for thousands'),
|
116
|
+
// // TODO: this should be enum but currencies is loosely typed
|
117
|
+
// currency: z.string().optional().describe('Three-letter currency code'),
|
118
|
+
// compact: CompactOrAliasSchema.optional().describe('Compact number format'),
|
119
|
+
// prefix: z.string().optional().describe('Prefix to add to the number'),
|
120
|
+
// suffix: z.string().optional().describe('Suffix to add to the number'),
|
121
|
+
// });
|
122
|
+
// export const TableCalculationSchema = z.object({
|
123
|
+
// // TODO: I don't know what this is
|
124
|
+
// index: z.number().optional().describe('Index of the table calculation'),
|
125
|
+
// name: z.string().min(1).describe('Name of the table calculation'),
|
126
|
+
// displayName: z
|
127
|
+
// .string()
|
128
|
+
// .min(1)
|
129
|
+
// .describe('Display name of the table calculation'),
|
130
|
+
// sql: z.string().min(1).describe('SQL for the table calculation'),
|
131
|
+
// format: CustomFormatSchema.optional().describe(
|
132
|
+
// 'Format of the table calculation',
|
133
|
+
// ),
|
134
|
+
// });
|
135
|
+
// TODO: fix me to be a complete schema and infer types from here.
|
136
|
+
exports.lighterMetricQuerySchema = zod_1.z.object({
|
137
|
+
exploreName: zod_1.z
|
138
|
+
.string()
|
139
|
+
.describe('Name of the explore to query. @example: "users"'),
|
140
|
+
metrics: zod_1.z
|
141
|
+
.array(exports.FieldIdSchema)
|
142
|
+
.describe('Metrics (measures) to calculate over the table for this query. @example: ["payments_total_amount", "orders_total_shipping_cost"]'),
|
143
|
+
dimensions: zod_1.z
|
144
|
+
.array(exports.FieldIdSchema)
|
145
|
+
.describe('Dimensions to break down the metric into groups. @example: ["orders_status", "customers_first_name"]'),
|
146
|
+
filters: exports.FilterSchema.describe('Filters to apply to the query'),
|
147
|
+
sorts: zod_1.z
|
148
|
+
.array(exports.SortFieldSchema)
|
149
|
+
.describe('Sort configuration for the MetricQuery. Should be an empty array if no sorting is needed'),
|
150
|
+
limit: zod_1.z
|
151
|
+
.number()
|
152
|
+
.int()
|
153
|
+
.min(1)
|
154
|
+
.describe('Maximum number of rows to return from query'),
|
155
|
+
// tableCalculations: z
|
156
|
+
// .array(TableCalculationSchema)
|
157
|
+
// .describe(
|
158
|
+
// 'Calculations are freeform SQL expressions that can be used to create new columns in the result set',
|
159
|
+
// ),
|
160
|
+
// TODO: at some point we should have a schema for additionalMetrics too but it's not needed for now
|
161
|
+
// additionalMetrics: z
|
162
|
+
// .array(z.unknown())
|
163
|
+
// .max(0)
|
164
|
+
// .optional()
|
165
|
+
// .describe(
|
166
|
+
// 'Additional metrics to compute in the explore - not supported yet',
|
167
|
+
// ),
|
168
|
+
// TODO: at some point we should have a schema for customDimensions too but it's not needed for now
|
169
|
+
// customDimensions: z
|
170
|
+
// .array(z.unknown())
|
171
|
+
// .max(0)
|
172
|
+
// .optional()
|
173
|
+
// .describe('Custom dimensions to group by in the explore'),
|
174
|
+
// metadata: z
|
175
|
+
// .object({
|
176
|
+
// // TODO: zod pick type from CompiledDimension
|
177
|
+
// hasADateDimension: z.object({
|
178
|
+
// label: z.string().describe('Label of the date dimension'),
|
179
|
+
// name: z.string().describe('Name of the date dimension'),
|
180
|
+
// }),
|
181
|
+
// })
|
182
|
+
// .optional()
|
183
|
+
// .describe('Metadata about the query'),
|
184
|
+
});
|
185
|
+
exports.aiAskForAdditionalInformationSchema = zod_1.z.object({
|
186
|
+
message: zod_1.z
|
187
|
+
.string()
|
188
|
+
.describe('The message to ask for additional information to the user'),
|
189
|
+
});
|
190
|
+
exports.aiSummarySchema = zod_1.z.object({
|
191
|
+
message: zod_1.z.string().describe('Summary message for the user'),
|
192
|
+
});
|
193
|
+
exports.aiFindFieldsToolSchema = zod_1.z.object({
|
194
|
+
exploreName: zod_1.z.string().describe('Name of the selected explore'),
|
195
|
+
embeddingSearchQueries: zod_1.z
|
196
|
+
.array(zod_1.z.object({
|
197
|
+
name: zod_1.z.string().describe('field_id of the field.'),
|
198
|
+
description: zod_1.z.string(),
|
199
|
+
}))
|
200
|
+
.describe(`Break down user input sentence into field names and descriptions to find the most relevant fields in the explore.`),
|
201
|
+
});
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import type { AnyType } from '../../types/any';
|
2
|
+
export type AiThread = {
|
3
|
+
aiThreadUuid: string;
|
4
|
+
organizationUuid: string;
|
5
|
+
projectUuid: string;
|
6
|
+
createdAt: Date;
|
7
|
+
createdFrom: string;
|
8
|
+
};
|
9
|
+
export type CreateSlackThread = {
|
10
|
+
organizationUuid: string;
|
11
|
+
projectUuid: string;
|
12
|
+
createdFrom: 'slack' | 'web_app';
|
13
|
+
slackUserId: string;
|
14
|
+
slackChannelId: string;
|
15
|
+
slackThreadTs: string;
|
16
|
+
};
|
17
|
+
export type CreateWebAppThread = {
|
18
|
+
organizationUuid: string;
|
19
|
+
projectUuid: string;
|
20
|
+
userUuid: string;
|
21
|
+
createdFrom: 'web_app';
|
22
|
+
};
|
23
|
+
export type AiPrompt = {
|
24
|
+
organizationUuid: string;
|
25
|
+
projectUuid: string;
|
26
|
+
promptUuid: string;
|
27
|
+
threadUuid: string;
|
28
|
+
createdByUserUuid: string;
|
29
|
+
prompt: string;
|
30
|
+
createdAt: Date;
|
31
|
+
response: string;
|
32
|
+
filtersOutput: object | null;
|
33
|
+
vizConfigOutput: object | null;
|
34
|
+
humanScore: number | null;
|
35
|
+
metricQuery: object | null;
|
36
|
+
};
|
37
|
+
export type SlackPrompt = AiPrompt & {
|
38
|
+
response_slack_ts: string;
|
39
|
+
slackUserId: string;
|
40
|
+
slackChannelId: string;
|
41
|
+
promptSlackTs: string;
|
42
|
+
slackThreadTs: string;
|
43
|
+
};
|
44
|
+
export type AiWebAppPrompt = AiPrompt & {
|
45
|
+
userUuid: string;
|
46
|
+
};
|
47
|
+
export declare const isSlackPrompt: (prompt: AiPrompt) => prompt is SlackPrompt;
|
48
|
+
export type CreateSlackPrompt = {
|
49
|
+
threadUuid: string;
|
50
|
+
createdByUserUuid: string;
|
51
|
+
prompt: string;
|
52
|
+
slackUserId: string;
|
53
|
+
slackChannelId: string;
|
54
|
+
promptSlackTs: string;
|
55
|
+
};
|
56
|
+
export type CreateWebAppPrompt = {
|
57
|
+
threadUuid: string;
|
58
|
+
createdByUserUuid: string;
|
59
|
+
prompt: string;
|
60
|
+
};
|
61
|
+
export type UpdateSlackResponse = {
|
62
|
+
promptUuid: string;
|
63
|
+
response?: string;
|
64
|
+
filtersOutput?: object | null;
|
65
|
+
vizConfigOutput?: object | null;
|
66
|
+
humanScore?: number | null;
|
67
|
+
metricQuery?: object | null;
|
68
|
+
};
|
69
|
+
export type UpdateWebAppResponse = {
|
70
|
+
promptUuid: string;
|
71
|
+
response: string;
|
72
|
+
filtersOutput?: object | null;
|
73
|
+
vizConfigOutput?: object | null;
|
74
|
+
humanScore?: number | null;
|
75
|
+
metricQuery?: object | null;
|
76
|
+
};
|
77
|
+
export type UpdateSlackResponseTs = {
|
78
|
+
promptUuid: string;
|
79
|
+
responseSlackTs: string;
|
80
|
+
};
|
81
|
+
export type SlackPromptJobPayload = {
|
82
|
+
slackPromptUuid: string;
|
83
|
+
};
|
84
|
+
export declare enum AiChatAgents {
|
85
|
+
HUMAN = "human",
|
86
|
+
AI = "ai"
|
87
|
+
}
|
88
|
+
export type AiChatMessage = {
|
89
|
+
agent: AiChatAgents;
|
90
|
+
message: string;
|
91
|
+
};
|
92
|
+
export type AiConversation = {
|
93
|
+
threadUuid: string;
|
94
|
+
createdAt: string | Date;
|
95
|
+
createdFrom: string;
|
96
|
+
firstMessage: string;
|
97
|
+
user: {
|
98
|
+
uuid: string;
|
99
|
+
name: string;
|
100
|
+
};
|
101
|
+
};
|
102
|
+
export type ApiAiConversations = {
|
103
|
+
status: 'ok';
|
104
|
+
results: AiConversation[];
|
105
|
+
};
|
106
|
+
type AiConversationMessageIncomplete = {
|
107
|
+
promptUuid: string;
|
108
|
+
message: string;
|
109
|
+
createdAt: string | Date;
|
110
|
+
user: {
|
111
|
+
uuid: string;
|
112
|
+
name: string;
|
113
|
+
};
|
114
|
+
};
|
115
|
+
type AiConversationComplete = AiConversationMessageIncomplete & {
|
116
|
+
response: string;
|
117
|
+
respondedAt: string | Date;
|
118
|
+
vizConfigOutput?: object;
|
119
|
+
filtersOutput?: object;
|
120
|
+
metricQuery?: object;
|
121
|
+
humanScore?: number;
|
122
|
+
};
|
123
|
+
export type AiConversationMessage = AiConversationMessageIncomplete | AiConversationComplete;
|
124
|
+
export type ApiAiConversationMessages = {
|
125
|
+
status: 'ok';
|
126
|
+
results: AiConversationMessage[];
|
127
|
+
};
|
128
|
+
export type ApiAiConversationResponse = {
|
129
|
+
status: 'ok';
|
130
|
+
results: {
|
131
|
+
prompt: AiWebAppPrompt;
|
132
|
+
rows: Record<string, AnyType>[] | undefined;
|
133
|
+
};
|
134
|
+
};
|
135
|
+
export declare const isAiConversationMessageComplete: (message: AiConversationMessage) => message is AiConversationComplete;
|
136
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isAiConversationMessageComplete = exports.AiChatAgents = exports.isSlackPrompt = void 0;
|
4
|
+
const isSlackPrompt = (prompt) => 'slackUserId' in prompt;
|
5
|
+
exports.isSlackPrompt = isSlackPrompt;
|
6
|
+
var AiChatAgents;
|
7
|
+
(function (AiChatAgents) {
|
8
|
+
AiChatAgents["HUMAN"] = "human";
|
9
|
+
AiChatAgents["AI"] = "ai";
|
10
|
+
})(AiChatAgents = exports.AiChatAgents || (exports.AiChatAgents = {}));
|
11
|
+
const isAiConversationMessageComplete = (message) => 'response' in message && 'respondedAt' in message;
|
12
|
+
exports.isAiConversationMessageComplete = isAiConversationMessageComplete;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CommercialFeatureFlags = void 0;
|
4
|
+
var CommercialFeatureFlags;
|
5
|
+
(function (CommercialFeatureFlags) {
|
6
|
+
CommercialFeatureFlags["Embedding"] = "embedding";
|
7
|
+
CommercialFeatureFlags["Scim"] = "scim-token-management";
|
8
|
+
CommercialFeatureFlags["AiCopilot"] = "ai-copilot";
|
9
|
+
})(CommercialFeatureFlags = exports.CommercialFeatureFlags || (exports.CommercialFeatureFlags = {}));
|
@@ -0,0 +1,180 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { type LightdashUser } from '../../types/user';
|
3
|
+
export type Embed = {
|
4
|
+
projectUuid: string;
|
5
|
+
encodedSecret: string;
|
6
|
+
dashboardUuids: string[];
|
7
|
+
createdAt: string;
|
8
|
+
user: Pick<LightdashUser, 'userUuid' | 'firstName' | 'lastName'>;
|
9
|
+
};
|
10
|
+
export type DecodedEmbed = Omit<Embed, 'encodedSecret'> & {
|
11
|
+
encodedSecret: undefined;
|
12
|
+
secret: string;
|
13
|
+
};
|
14
|
+
export type CreateEmbed = {
|
15
|
+
dashboardUuids: string[];
|
16
|
+
};
|
17
|
+
export declare enum FilterInteractivityValues {
|
18
|
+
some = "some",
|
19
|
+
all = "all",
|
20
|
+
none = "none"
|
21
|
+
}
|
22
|
+
export declare const FilterInteractivityValuesSchema: z.ZodEnum<[FilterInteractivityValues.some, FilterInteractivityValues.all, FilterInteractivityValues.none]>;
|
23
|
+
export declare const DashboardFilterInteractivityOptionsSchema: z.ZodObject<{
|
24
|
+
enabled: z.ZodUnion<[z.ZodBoolean, z.ZodEnum<[FilterInteractivityValues.some, FilterInteractivityValues.all, FilterInteractivityValues.none]>]>;
|
25
|
+
allowedFilters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
27
|
+
enabled: boolean | FilterInteractivityValues;
|
28
|
+
allowedFilters?: string[] | undefined;
|
29
|
+
}, {
|
30
|
+
enabled: boolean | FilterInteractivityValues;
|
31
|
+
allowedFilters?: string[] | undefined;
|
32
|
+
}>;
|
33
|
+
export type DashboardFilterInteractivityOptions = z.infer<typeof DashboardFilterInteractivityOptionsSchema>;
|
34
|
+
export declare const InteractivityOptionsSchema: z.ZodObject<{
|
35
|
+
dashboardFiltersInteractivity: z.ZodOptional<z.ZodObject<{
|
36
|
+
enabled: z.ZodUnion<[z.ZodBoolean, z.ZodEnum<[FilterInteractivityValues.some, FilterInteractivityValues.all, FilterInteractivityValues.none]>]>;
|
37
|
+
allowedFilters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
39
|
+
enabled: boolean | FilterInteractivityValues;
|
40
|
+
allowedFilters?: string[] | undefined;
|
41
|
+
}, {
|
42
|
+
enabled: boolean | FilterInteractivityValues;
|
43
|
+
allowedFilters?: string[] | undefined;
|
44
|
+
}>>;
|
45
|
+
canExportCsv: z.ZodOptional<z.ZodBoolean>;
|
46
|
+
canExportImages: z.ZodOptional<z.ZodBoolean>;
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
48
|
+
dashboardFiltersInteractivity?: {
|
49
|
+
enabled: boolean | FilterInteractivityValues;
|
50
|
+
allowedFilters?: string[] | undefined;
|
51
|
+
} | undefined;
|
52
|
+
canExportCsv?: boolean | undefined;
|
53
|
+
canExportImages?: boolean | undefined;
|
54
|
+
}, {
|
55
|
+
dashboardFiltersInteractivity?: {
|
56
|
+
enabled: boolean | FilterInteractivityValues;
|
57
|
+
allowedFilters?: string[] | undefined;
|
58
|
+
} | undefined;
|
59
|
+
canExportCsv?: boolean | undefined;
|
60
|
+
canExportImages?: boolean | undefined;
|
61
|
+
}>;
|
62
|
+
export type InteractivityOptions = z.infer<typeof InteractivityOptionsSchema>;
|
63
|
+
export declare const EmbedJwtSchema: z.ZodObject<{
|
64
|
+
userAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
65
|
+
user: z.ZodOptional<z.ZodObject<{
|
66
|
+
externalId: z.ZodOptional<z.ZodString>;
|
67
|
+
email: z.ZodOptional<z.ZodString>;
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
69
|
+
email?: string | undefined;
|
70
|
+
externalId?: string | undefined;
|
71
|
+
}, {
|
72
|
+
email?: string | undefined;
|
73
|
+
externalId?: string | undefined;
|
74
|
+
}>>;
|
75
|
+
content: z.ZodObject<z.objectUtil.extendShape<{
|
76
|
+
type: z.ZodLiteral<"dashboard">;
|
77
|
+
dashboardUuid: z.ZodString;
|
78
|
+
isPreview: z.ZodOptional<z.ZodBoolean>;
|
79
|
+
}, {
|
80
|
+
dashboardFiltersInteractivity: z.ZodOptional<z.ZodObject<{
|
81
|
+
enabled: z.ZodUnion<[z.ZodBoolean, z.ZodEnum<[FilterInteractivityValues.some, FilterInteractivityValues.all, FilterInteractivityValues.none]>]>;
|
82
|
+
allowedFilters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
84
|
+
enabled: boolean | FilterInteractivityValues;
|
85
|
+
allowedFilters?: string[] | undefined;
|
86
|
+
}, {
|
87
|
+
enabled: boolean | FilterInteractivityValues;
|
88
|
+
allowedFilters?: string[] | undefined;
|
89
|
+
}>>;
|
90
|
+
canExportCsv: z.ZodOptional<z.ZodBoolean>;
|
91
|
+
canExportImages: z.ZodOptional<z.ZodBoolean>;
|
92
|
+
}>, "strip", z.ZodTypeAny, {
|
93
|
+
type: "dashboard";
|
94
|
+
dashboardUuid: string;
|
95
|
+
dashboardFiltersInteractivity?: {
|
96
|
+
enabled: boolean | FilterInteractivityValues;
|
97
|
+
allowedFilters?: string[] | undefined;
|
98
|
+
} | undefined;
|
99
|
+
canExportCsv?: boolean | undefined;
|
100
|
+
canExportImages?: boolean | undefined;
|
101
|
+
isPreview?: boolean | undefined;
|
102
|
+
}, {
|
103
|
+
type: "dashboard";
|
104
|
+
dashboardUuid: string;
|
105
|
+
dashboardFiltersInteractivity?: {
|
106
|
+
enabled: boolean | FilterInteractivityValues;
|
107
|
+
allowedFilters?: string[] | undefined;
|
108
|
+
} | undefined;
|
109
|
+
canExportCsv?: boolean | undefined;
|
110
|
+
canExportImages?: boolean | undefined;
|
111
|
+
isPreview?: boolean | undefined;
|
112
|
+
}>;
|
113
|
+
iat: z.ZodOptional<z.ZodNumber>;
|
114
|
+
exp: z.ZodNumber;
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
116
|
+
content: {
|
117
|
+
type: "dashboard";
|
118
|
+
dashboardUuid: string;
|
119
|
+
dashboardFiltersInteractivity?: {
|
120
|
+
enabled: boolean | FilterInteractivityValues;
|
121
|
+
allowedFilters?: string[] | undefined;
|
122
|
+
} | undefined;
|
123
|
+
canExportCsv?: boolean | undefined;
|
124
|
+
canExportImages?: boolean | undefined;
|
125
|
+
isPreview?: boolean | undefined;
|
126
|
+
};
|
127
|
+
exp: number;
|
128
|
+
user?: {
|
129
|
+
email?: string | undefined;
|
130
|
+
externalId?: string | undefined;
|
131
|
+
} | undefined;
|
132
|
+
userAttributes?: Record<string, unknown> | undefined;
|
133
|
+
iat?: number | undefined;
|
134
|
+
}, {
|
135
|
+
content: {
|
136
|
+
type: "dashboard";
|
137
|
+
dashboardUuid: string;
|
138
|
+
dashboardFiltersInteractivity?: {
|
139
|
+
enabled: boolean | FilterInteractivityValues;
|
140
|
+
allowedFilters?: string[] | undefined;
|
141
|
+
} | undefined;
|
142
|
+
canExportCsv?: boolean | undefined;
|
143
|
+
canExportImages?: boolean | undefined;
|
144
|
+
isPreview?: boolean | undefined;
|
145
|
+
};
|
146
|
+
exp: number;
|
147
|
+
user?: {
|
148
|
+
email?: string | undefined;
|
149
|
+
externalId?: string | undefined;
|
150
|
+
} | undefined;
|
151
|
+
userAttributes?: Record<string, unknown> | undefined;
|
152
|
+
iat?: number | undefined;
|
153
|
+
}>;
|
154
|
+
export type EmbedJwt = z.infer<typeof EmbedJwtSchema>;
|
155
|
+
export type CreateEmbedJwt = {
|
156
|
+
content: {
|
157
|
+
type: 'dashboard';
|
158
|
+
dashboardUuid: string;
|
159
|
+
isPreview?: boolean;
|
160
|
+
dashboardFiltersInteractivity?: {
|
161
|
+
enabled: FilterInteractivityValues | boolean;
|
162
|
+
allowedFilters?: string[];
|
163
|
+
};
|
164
|
+
canExportCsv?: boolean;
|
165
|
+
canExportImages?: boolean;
|
166
|
+
};
|
167
|
+
userAttributes?: {
|
168
|
+
[key: string]: string;
|
169
|
+
};
|
170
|
+
user?: {
|
171
|
+
email?: string;
|
172
|
+
externalId?: string;
|
173
|
+
};
|
174
|
+
expiresIn?: string;
|
175
|
+
};
|
176
|
+
export type EmbedUrl = {
|
177
|
+
url: string;
|
178
|
+
};
|
179
|
+
export declare function getFilterInteractivityValue(enabled: DashboardFilterInteractivityOptions['enabled']): FilterInteractivityValues;
|
180
|
+
export declare function isFilterInteractivityEnabled(filterInteractivityOptions?: DashboardFilterInteractivityOptions): boolean | undefined;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isFilterInteractivityEnabled = exports.getFilterInteractivityValue = exports.EmbedJwtSchema = exports.InteractivityOptionsSchema = exports.DashboardFilterInteractivityOptionsSchema = exports.FilterInteractivityValuesSchema = exports.FilterInteractivityValues = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
const assertUnreachable_1 = tslib_1.__importDefault(require("../../utils/assertUnreachable"));
|
7
|
+
var FilterInteractivityValues;
|
8
|
+
(function (FilterInteractivityValues) {
|
9
|
+
FilterInteractivityValues["some"] = "some";
|
10
|
+
FilterInteractivityValues["all"] = "all";
|
11
|
+
FilterInteractivityValues["none"] = "none";
|
12
|
+
})(FilterInteractivityValues = exports.FilterInteractivityValues || (exports.FilterInteractivityValues = {}));
|
13
|
+
exports.FilterInteractivityValuesSchema = zod_1.z.enum([
|
14
|
+
FilterInteractivityValues.some,
|
15
|
+
FilterInteractivityValues.all,
|
16
|
+
FilterInteractivityValues.none,
|
17
|
+
]);
|
18
|
+
exports.DashboardFilterInteractivityOptionsSchema = zod_1.z.object({
|
19
|
+
enabled: zod_1.z.union([zod_1.z.boolean(), exports.FilterInteractivityValuesSchema]),
|
20
|
+
allowedFilters: zod_1.z.array(zod_1.z.string()).optional(),
|
21
|
+
});
|
22
|
+
exports.InteractivityOptionsSchema = zod_1.z.object({
|
23
|
+
dashboardFiltersInteractivity: exports.DashboardFilterInteractivityOptionsSchema.optional(),
|
24
|
+
canExportCsv: zod_1.z.boolean().optional(),
|
25
|
+
canExportImages: zod_1.z.boolean().optional(),
|
26
|
+
});
|
27
|
+
exports.EmbedJwtSchema = zod_1.z
|
28
|
+
.object({
|
29
|
+
userAttributes: zod_1.z.record(zod_1.z.unknown()).optional(),
|
30
|
+
user: zod_1.z
|
31
|
+
.object({
|
32
|
+
externalId: zod_1.z.string().optional(),
|
33
|
+
email: zod_1.z.string().optional(),
|
34
|
+
})
|
35
|
+
.optional(),
|
36
|
+
content: zod_1.z
|
37
|
+
.object({
|
38
|
+
type: zod_1.z.literal('dashboard'),
|
39
|
+
dashboardUuid: zod_1.z.string(),
|
40
|
+
isPreview: zod_1.z.boolean().optional(),
|
41
|
+
})
|
42
|
+
.merge(exports.InteractivityOptionsSchema),
|
43
|
+
iat: zod_1.z.number().optional(),
|
44
|
+
exp: zod_1.z.number(),
|
45
|
+
})
|
46
|
+
.describe('Configuration file for generating a CSV file from a query with metrics and dimensions');
|
47
|
+
// allows for backwards compatibility with old filter interactivity boolean values
|
48
|
+
function getFilterInteractivityValue(enabled) {
|
49
|
+
if (typeof enabled === 'boolean') {
|
50
|
+
return enabled
|
51
|
+
? FilterInteractivityValues.all
|
52
|
+
: FilterInteractivityValues.none;
|
53
|
+
}
|
54
|
+
return enabled;
|
55
|
+
}
|
56
|
+
exports.getFilterInteractivityValue = getFilterInteractivityValue;
|
57
|
+
function isFilterInteractivityEnabled(filterInteractivityOptions) {
|
58
|
+
if (!filterInteractivityOptions)
|
59
|
+
return false;
|
60
|
+
const filterInteractivityValue = getFilterInteractivityValue(filterInteractivityOptions.enabled);
|
61
|
+
switch (filterInteractivityValue) {
|
62
|
+
case FilterInteractivityValues.some:
|
63
|
+
return (filterInteractivityOptions.allowedFilters &&
|
64
|
+
filterInteractivityOptions.allowedFilters.length > 0);
|
65
|
+
case FilterInteractivityValues.all:
|
66
|
+
return true;
|
67
|
+
case FilterInteractivityValues.none:
|
68
|
+
return false;
|
69
|
+
default:
|
70
|
+
return (0, assertUnreachable_1.default)(filterInteractivityValue, `Unknown FilterInteractivityValue ${filterInteractivityValue}`);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
exports.isFilterInteractivityEnabled = isFilterInteractivityEnabled;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export * from './Ai/schemas';
|
2
|
+
export * from './Ai/types';
|
3
|
+
export * from './commercialFeatureFlags';
|
4
|
+
export * from './embed';
|
5
|
+
export * from './scim/errors';
|
6
|
+
export * from './scim/types';
|
7
|
+
export declare enum ScimSchemaType {
|
8
|
+
ERROR = "urn:ietf:params:scim:api:messages:2.0:Error",
|
9
|
+
USER = "urn:ietf:params:scim:schemas:core:2.0:User",
|
10
|
+
GROUP = "urn:ietf:params:scim:schemas:core:2.0:Group",
|
11
|
+
LIST_RESPONSE = "urn:ietf:params:scim:api:messages:2.0:ListResponse",
|
12
|
+
SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:Schema",
|
13
|
+
PATCH = "urn:ietf:params:scim:api:messages:2.0:PatchOp"
|
14
|
+
}
|
package/dist/ee/index.js
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ScimSchemaType = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
tslib_1.__exportStar(require("./Ai/schemas"), exports);
|
6
|
+
tslib_1.__exportStar(require("./Ai/types"), exports);
|
7
|
+
tslib_1.__exportStar(require("./commercialFeatureFlags"), exports);
|
8
|
+
tslib_1.__exportStar(require("./embed"), exports);
|
9
|
+
tslib_1.__exportStar(require("./scim/errors"), exports);
|
10
|
+
tslib_1.__exportStar(require("./scim/types"), exports);
|
11
|
+
var ScimSchemaType;
|
12
|
+
(function (ScimSchemaType) {
|
13
|
+
ScimSchemaType["ERROR"] = "urn:ietf:params:scim:api:messages:2.0:Error";
|
14
|
+
ScimSchemaType["USER"] = "urn:ietf:params:scim:schemas:core:2.0:User";
|
15
|
+
ScimSchemaType["GROUP"] = "urn:ietf:params:scim:schemas:core:2.0:Group";
|
16
|
+
ScimSchemaType["LIST_RESPONSE"] = "urn:ietf:params:scim:api:messages:2.0:ListResponse";
|
17
|
+
ScimSchemaType["SCHEMA"] = "urn:ietf:params:scim:schemas:core:2.0:Schema";
|
18
|
+
ScimSchemaType["PATCH"] = "urn:ietf:params:scim:api:messages:2.0:PatchOp";
|
19
|
+
})(ScimSchemaType = exports.ScimSchemaType || (exports.ScimSchemaType = {}));
|