@vizzly/services 0.7.1 → 0.7.2-dev-dba36cbd0af6b3bcb07804673072c6fb5fb27a1f

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.
Files changed (68) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/services/src/Services/DashboardServices.d.ts +2 -1
  3. package/dist/shared-logic/src/AI/types.d.ts +25 -6
  4. package/dist/shared-logic/src/AdditionalFilter/AdditionalFilter.d.ts +4 -3
  5. package/dist/shared-logic/src/Aggregate/constants.d.ts +26 -0
  6. package/dist/shared-logic/src/AreaChart/constants.d.ts +3 -0
  7. package/dist/shared-logic/src/BarChart/constants.d.ts +3 -0
  8. package/dist/shared-logic/src/BasicTable/constants.d.ts +3 -0
  9. package/dist/shared-logic/src/ComboChart/constants.d.ts +3 -0
  10. package/dist/shared-logic/src/Component/sharedSchemas.d.ts +6 -5
  11. package/dist/shared-logic/src/ComponentInterface/constants.d.ts +63 -0
  12. package/dist/shared-logic/src/ComponentInterface/namespaces.d.ts +3 -0
  13. package/dist/shared-logic/src/ComponentInterface/types/ComponentInterfaceConfig.d.ts +18 -0
  14. package/dist/shared-logic/src/ComponentInterface/types/namespaces.types.d.ts +104 -0
  15. package/dist/shared-logic/src/ComponentInterface/types.d.ts +4 -4
  16. package/dist/shared-logic/src/Dashboard/fromRaw.d.ts +2 -1
  17. package/dist/shared-logic/src/DashboardAPI/dashboardAPI/creating.d.ts +2 -1
  18. package/dist/shared-logic/src/DashboardAPI/dashboardAPI/updating.d.ts +2 -1
  19. package/dist/shared-logic/src/DashboardAPI/dashboardAPI.d.ts +1 -1
  20. package/dist/shared-logic/src/DataPanelConfig/types.d.ts +4 -5
  21. package/dist/shared-logic/src/DataSet/DataSet.d.ts +5 -0
  22. package/dist/shared-logic/src/DataSet/types.d.ts +1 -0
  23. package/dist/shared-logic/src/DataTable/constants.d.ts +3 -0
  24. package/dist/shared-logic/src/Display/Display.d.ts +2 -2
  25. package/dist/shared-logic/src/Display/upcast.d.ts +2 -1
  26. package/dist/shared-logic/src/Dumpable.d.ts +2 -1
  27. package/dist/shared-logic/src/Field/Field.d.ts +6 -3
  28. package/dist/shared-logic/src/Field/types.d.ts +1 -0
  29. package/dist/shared-logic/src/HorizontalBarChart/constants.d.ts +3 -0
  30. package/dist/shared-logic/src/LineChart/constants.d.ts +3 -0
  31. package/dist/shared-logic/src/MercatorMap/constants.d.ts +3 -0
  32. package/dist/shared-logic/src/PieChart/constants.d.ts +3 -0
  33. package/dist/shared-logic/src/Progress/constants.d.ts +3 -0
  34. package/dist/shared-logic/src/QueryAttributes/QueryAttributes.d.ts +2 -1
  35. package/dist/shared-logic/src/QueryAttributes/constants.d.ts +54 -0
  36. package/dist/shared-logic/src/ScatterChart/constants.d.ts +3 -0
  37. package/dist/shared-logic/src/SingleStat/constants.d.ts +3 -0
  38. package/dist/shared-logic/src/Theme/types.d.ts +27 -0
  39. package/dist/shared-logic/src/TimeDimension/constants.d.ts +34 -0
  40. package/dist/shared-logic/src/Translations/extract/shared.d.ts +10 -0
  41. package/dist/shared-logic/src/Translations/textOverrideComponent.d.ts +30 -0
  42. package/dist/shared-logic/src/Translations/translation.schema.d.ts +2 -0
  43. package/dist/shared-logic/src/Translations/translation.types.d.ts +4748 -0
  44. package/dist/shared-logic/src/Translations/translations.d.ts +9 -0
  45. package/dist/shared-logic/src/Translations/types.d.ts +13 -0
  46. package/dist/shared-logic/src/Translations/validation.d.ts +1 -0
  47. package/dist/shared-logic/src/api/index.d.ts +3 -9
  48. package/dist/shared-logic/src/api/vizzly/aiActions.d.ts +18 -0
  49. package/dist/shared-logic/src/api/vizzly/aiHelpers/buildAIResponse.d.ts +5 -0
  50. package/dist/shared-logic/src/api/vizzly/aiHelpers/buildDataSets.d.ts +4 -0
  51. package/dist/shared-logic/src/api/vizzly/aiHelpers/checkAiResponseStatus.d.ts +3 -0
  52. package/dist/shared-logic/src/api/vizzly/aiHelpers/types.d.ts +23 -0
  53. package/dist/shared-logic/src/api/vizzly/aiHelpers/validateAndUpcastAIAttributes.d.ts +4 -0
  54. package/dist/shared-logic/src/api/vizzly/aiHelpers/view.d.ts +10 -0
  55. package/dist/shared-logic/src/api/vizzly/askAi.d.ts +2 -8
  56. package/dist/shared-logic/src/api/vizzly/askAiForQuestionSuggestions.d.ts +4 -0
  57. package/dist/shared-logic/src/errors/AIAborted.d.ts +4 -0
  58. package/dist/shared-logic/src/errors/AIContainsErrors.d.ts +4 -0
  59. package/dist/shared-logic/src/errors/AIFailedToFetch.d.ts +4 -0
  60. package/dist/shared-logic/src/errors/AIUsageLimitReached.d.ts +1 -1
  61. package/dist/shared-logic/src/errors/index.d.ts +5 -0
  62. package/dist/shared-logic/src/utils/stringHelper.d.ts +2 -1
  63. package/package.json +1 -1
  64. package/dist/shared-logic/src/Documentation/index.d.ts +0 -2
  65. package/dist/shared-logic/src/Documentation/joiToDocumentation.d.ts +0 -4
  66. package/dist/shared-logic/src/Documentation/joiToSchemaDefinition.d.ts +0 -2
  67. package/dist/shared-logic/src/api/vizzly/askAi/types.d.ts +0 -2
  68. package/dist/shared-logic/src/api/vizzly/askAi/validateAndUpcast.d.ts +0 -5
@@ -0,0 +1,9 @@
1
+ import { VizzlyTranslations } from './translation.types';
2
+ import { TranslationOptions, TranslationInterpolation } from './types';
3
+ export type VizzlyTranslationKey = keyof VizzlyTranslations;
4
+ export declare function getTranslation(translations: Partial<VizzlyTranslations>, key: string): string | TranslationInterpolation | undefined;
5
+ export declare const defaultText: (key: string, defaultValue: string, variables?: TranslationOptions, developerMode?: boolean) => string;
6
+ export declare const generateTranslation: (key: string, defaultValue: string, variables?: TranslationOptions, translations?: Partial<VizzlyTranslations>, developerMode?: boolean) => string;
7
+ export declare function buildTextOverrides(translations?: Partial<VizzlyTranslations>, developerMode?: boolean): {
8
+ textOverride: (key: string, value: string, options?: TranslationOptions) => string;
9
+ };
@@ -0,0 +1,13 @@
1
+ export type TextOverride = (key: string, defaultValue: string, options?: TranslationOptions) => string;
2
+ export type TranslationOptions = {
3
+ [key: string]: string | number | Pluralised;
4
+ };
5
+ export type Pluralised = {
6
+ count: number;
7
+ singular: string;
8
+ plural: string;
9
+ };
10
+ export type TranslationInterpolation = {
11
+ sentence: string;
12
+ [key: string]: string;
13
+ };
@@ -0,0 +1 @@
1
+ export declare const isValidFormattedText: (text: string) => boolean;
@@ -22,15 +22,9 @@ export declare const api: (config: ApiConfig) => {
22
22
  permissions: import("../DashboardPermission/types").RawDashboardPermission[];
23
23
  }>;
24
24
  updateDashboard: (params: import("./vizzly/updateDashboard").UpdateDashboardParams) => Promise<import("./vizzly/updateDashboard").EncryptedDashboardUpdateResponse | import("./vizzly/updateDashboard").UnEncryptedDashboardUpdateResponse>;
25
- askAi: (conversationId: string | undefined, currentAttributes: Partial<import("../Component/types").Component.Attributes>, question: string, dashboardAccessToken: string, dataSets: import("../DataSet/types").DataSet[], queryEngineConfig: import("../QueryEngineConfig/types").QueryEngineConfig) => Promise<{
26
- conversationId: string | undefined;
27
- attributes: import("../Component/types").Component.Attributes;
28
- messageHistory: {
29
- content: string;
30
- sender_type: "user" | "ai";
31
- status: "active";
32
- }[];
33
- }>;
25
+ askAi: (conversationId: string | undefined, currentAttributes: import("../Component/types").Component.Attributes, question: string, dashboardAccessToken: string, dataSets: import("../DataSet/types").DataSet[], queryEngineConfig: import("../QueryEngineConfig/types").QueryEngineConfig, abortSignal: AbortSignal) => Promise<import("./vizzly/aiHelpers/types").AiConversation>;
26
+ aiActions: (conversationId: string, messageId: string, dashboardAccessToken: string, options: import("./vizzly/aiActions").AIOptions) => Promise<import("./vizzly/aiActions").AIActionReponse>;
27
+ askAiForQuestionSuggestions: (dashboardAccessToken: string, dataSets: import("../DataSet/types").DataSet[]) => Promise<import("./vizzly/aiHelpers/types").AskAiQuestionSuggestions>;
34
28
  createVizzlyConfigVersion: (projectId: string, encryptedVizzlyConfig: string) => Promise<boolean>;
35
29
  getVizzlyConfig: (projectId: string) => Promise<{
36
30
  encryptedConfig: string | null;
@@ -0,0 +1,18 @@
1
+ import { Message } from '../../AI/types';
2
+ import { HttpClient } from '../types';
3
+ export type AIActionReponse = {
4
+ success: boolean;
5
+ };
6
+ export type AIOptions = {
7
+ reaction: Message['reaction'];
8
+ };
9
+ type APIResponse = {
10
+ status: number;
11
+ body: any;
12
+ headers: any;
13
+ };
14
+ export declare const aiActions: (httpClient: HttpClient) => (conversationId: string, messageId: string, dashboardAccessToken: string, options: AIOptions) => Promise<AIActionReponse>;
15
+ export declare const buildAIActionResponse: (response: APIResponse) => {
16
+ success: boolean;
17
+ };
18
+ export {};
@@ -0,0 +1,5 @@
1
+ import { DataSet } from '../../../DataSet/types';
2
+ import { QueryEngineConfig } from '../../../QueryEngineConfig/types';
3
+ import { AiConversation, AskAIResponse } from './types';
4
+ import { Component } from '../../../Component/types';
5
+ export declare const buildAIResponse: (askAiResponse: AskAIResponse, currentAttributes: Component.Attributes, queryEngineConfig: QueryEngineConfig, dataSets: DataSet[]) => AiConversation;
@@ -0,0 +1,4 @@
1
+ import { DataSet } from '../../../DataSet/types';
2
+ import { DataSet as AiDataSet } from '@vizzly/ai-types';
3
+ declare const _default: (dataSets: DataSet[]) => AiDataSet[];
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { AskAIResponse } from './types';
2
+ declare function checkAiResponseStatus(statusCode: number, body: any): asserts body is AskAIResponse;
3
+ export default checkAiResponseStatus;
@@ -0,0 +1,23 @@
1
+ import { ConversationState } from '../../../AI/types';
2
+ import { Component } from '../../../Component/types';
3
+ import { View } from '@vizzly/ai-types';
4
+ export type AskAIResponse = {
5
+ message_id: string;
6
+ conversation_id: string;
7
+ ai_view: View;
8
+ conversation_content: {
9
+ messages: ConversationState['messageHistory'];
10
+ };
11
+ };
12
+ export type AskAIUsageResponse = {
13
+ quota: number;
14
+ used: number;
15
+ };
16
+ export type AiConversation = {
17
+ conversationId: ConversationState['conversationId'];
18
+ attributes: Component.Attributes;
19
+ messageHistory: ConversationState['messageHistory'];
20
+ };
21
+ export type AskAiQuestionSuggestions = {
22
+ suggestions: string[];
23
+ };
@@ -0,0 +1,4 @@
1
+ import { QueryEngineConfig } from '../../../QueryEngineConfig/types';
2
+ import { Component } from '../../../Component/types';
3
+ declare const validateAndUpcast: (aiAttributes: Partial<Component.Attributes>, queryEngineConfig: QueryEngineConfig) => Component.Attributes;
4
+ export default validateAndUpcast;
@@ -0,0 +1,10 @@
1
+ import { Component } from '../../../Component/types';
2
+ import { View } from '@vizzly/ai-types';
3
+ import { DataSet } from '../../../DataSet/types';
4
+ import { QueryEngineConfig } from '../../../QueryEngineConfig/types';
5
+ /**
6
+ * Convert the complex view used on the frontend, to the simplified
7
+ * version that the AI is used too...
8
+ */
9
+ export declare const attributesToAiView: (dataSet: DataSet, originalAttributes: Component.Attributes) => View;
10
+ export declare const mergeAiViewIntoCurrentAttributes: (dataSets: DataSet[], currentAttributes: Component.Attributes, aiView: View, queryEngineConfig: QueryEngineConfig) => Component.Attributes;
@@ -1,12 +1,6 @@
1
1
  import { HttpClient } from '../types';
2
2
  import { DataSet } from '../../DataSet/types';
3
3
  import { QueryEngineConfig } from '../../QueryEngineConfig/types';
4
+ import { AiConversation } from './aiHelpers/types';
4
5
  import { Component } from '../../Component/types';
5
- import { ConversationState } from '../../AI/types';
6
- type AskAiReponse = {
7
- conversationId: ConversationState['conversationId'];
8
- attributes: Component.Attributes;
9
- messageHistory: ConversationState['messageHistory'];
10
- };
11
- export declare const askAi: (httpClient: HttpClient) => (conversationId: string | undefined, currentAttributes: Partial<Component.Attributes>, question: string, dashboardAccessToken: string, dataSets: DataSet[], queryEngineConfig: QueryEngineConfig) => Promise<AskAiReponse>;
12
- export {};
6
+ export declare const askAi: (httpClient: HttpClient) => (conversationId: string | undefined, currentAttributes: Component.Attributes, question: string, dashboardAccessToken: string, dataSets: DataSet[], queryEngineConfig: QueryEngineConfig, abortSignal: AbortSignal) => Promise<AiConversation>;
@@ -0,0 +1,4 @@
1
+ import { HttpClient } from '../types';
2
+ import { DataSet } from '../../DataSet/types';
3
+ import { AskAiQuestionSuggestions } from './aiHelpers/types';
4
+ export declare const askAiForQuestionSuggestions: (httpClient: HttpClient) => (dashboardAccessToken: string, dataSets: DataSet[]) => Promise<AskAiQuestionSuggestions>;
@@ -0,0 +1,4 @@
1
+ declare class AIAborted extends Error {
2
+ constructor();
3
+ }
4
+ export default AIAborted;
@@ -0,0 +1,4 @@
1
+ declare class AIContainsErrors extends Error {
2
+ constructor();
3
+ }
4
+ export default AIContainsErrors;
@@ -0,0 +1,4 @@
1
+ declare class AIFailedToFetch extends Error {
2
+ constructor();
3
+ }
4
+ export default AIFailedToFetch;
@@ -1,4 +1,4 @@
1
1
  declare class AIUsageLimitReached extends Error {
2
- constructor();
2
+ constructor(message?: string);
3
3
  }
4
4
  export default AIUsageLimitReached;
@@ -0,0 +1,5 @@
1
+ import AIUsageLimitReached from './AIUsageLimitReached';
2
+ import AIFailedToFetch from '../errors/AIFailedToFetch';
3
+ import AIContainsErrors from '../errors/AIContainsErrors';
4
+ import AIAborted from '../errors/AIAborted';
5
+ export { AIUsageLimitReached, AIFailedToFetch, AIContainsErrors, AIAborted };
@@ -1,7 +1,8 @@
1
+ import { TextOverride } from '../Translations/types';
1
2
  export declare function pluralEnding(num: number, single: string, multiple: string): string;
2
3
  export declare function maxLengthString(str: string, length: number): string;
3
4
  export declare function plural(num: number, single: string, multiple: string): string;
4
- export declare function humanReadableList(values: (number | string)[], withQuotes?: boolean): string;
5
+ export declare function humanReadableList(values: (number | string)[], withQuotes?: boolean, textOverride?: TextOverride): string;
5
6
  export declare const hashString: (str: string) => number;
6
7
  export declare const capitalise: (word: string) => string;
7
8
  export declare const replaceAll: (str: string, lookFor: string, replaceWith: string) => string;
package/package.json CHANGED
@@ -22,5 +22,5 @@
22
22
  "test": "jest",
23
23
  "prepare": "yarn build"
24
24
  },
25
- "version": "0.7.1"
25
+ "version": "0.7.2-dev-dba36cbd0af6b3bcb07804673072c6fb5fb27a1f"
26
26
  }
@@ -1,2 +0,0 @@
1
- export * from './joiToDocumentation';
2
- export * from './joiToSchemaDefinition';
@@ -1,4 +0,0 @@
1
- import Joi from '@vizzly/joi';
2
- import joiToJson from 'joi-to-json';
3
- export type SchemaDocumentation = ReturnType<typeof joiToJson>;
4
- export declare const joiToDocumentation: (obj: Joi.Schema) => SchemaDocumentation;
@@ -1,2 +0,0 @@
1
- import Joi from '@vizzly/joi';
2
- export declare const joiToSchemaDefinition: (obj: Joi.Schema) => any;
@@ -1,2 +0,0 @@
1
- import { Component } from '../../../Component/types';
2
- export type AIAttributes = Partial<Component.Attributes>;
@@ -1,5 +0,0 @@
1
- import { AIAttributes } from './types';
2
- import { QueryEngineConfig } from '../../../QueryEngineConfig/types';
3
- import { Component } from '../../../Component/types';
4
- declare const validateAndUpcast: (aiAttributes: Partial<AIAttributes>, queryEngineConfig: QueryEngineConfig) => Component.Attributes;
5
- export default validateAndUpcast;