@wisdomai/react 0.0.8
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/AGENTS.md +111 -0
- package/LICENSE +21 -0
- package/README.md +225 -0
- package/dist/WisdomAuthContext.d.ts +12 -0
- package/dist/WisdomProvider.d.ts +13 -0
- package/dist/client.d.ts +10 -0
- package/dist/dashboard/Dashboard.d.ts +12 -0
- package/dist/dashboard/DashboardContext.d.ts +53 -0
- package/dist/dashboard/DashboardFilters.d.ts +6 -0
- package/dist/dashboard/DashboardHeader.d.ts +4 -0
- package/dist/dashboard/DashboardProvider.d.ts +15 -0
- package/dist/dashboard/DashboardWidget.d.ts +6 -0
- package/dist/dashboard/DashboardWidgets.d.ts +3 -0
- package/dist/dashboard/SdkMarkdown.d.ts +12 -0
- package/dist/dashboard/SdkSummaryWidget.d.ts +5 -0
- package/dist/dashboard/SummaryContent.d.ts +6 -0
- package/dist/dashboard/WidgetActionsMenu.d.ts +6 -0
- package/dist/dashboard/WidgetCard.d.ts +13 -0
- package/dist/dashboard/WisdomChart.d.ts +6 -0
- package/dist/dashboard/WisdomMetric.d.ts +5 -0
- package/dist/dashboard/WisdomTable.d.ts +10 -0
- package/dist/dashboard/WisdomText.d.ts +5 -0
- package/dist/dashboard/WisdomVisualization.d.ts +7 -0
- package/dist/dashboard/exportWidgetAsImage.d.ts +6 -0
- package/dist/dashboard/filterForms/BoolFilterForm.d.ts +8 -0
- package/dist/dashboard/filterForms/CurrentDateInput.d.ts +11 -0
- package/dist/dashboard/filterForms/DateFilterForm.d.ts +21 -0
- package/dist/dashboard/filterForms/EnumFilterForm.d.ts +13 -0
- package/dist/dashboard/filterForms/FilterPill.d.ts +12 -0
- package/dist/dashboard/filterForms/LeftIntervalSelect.d.ts +7 -0
- package/dist/dashboard/filterForms/NextDateInput.d.ts +13 -0
- package/dist/dashboard/filterForms/NumberFilterForm.d.ts +9 -0
- package/dist/dashboard/filterForms/PreviousDateInput.d.ts +15 -0
- package/dist/dashboard/filterForms/QuarterInputField.d.ts +6 -0
- package/dist/dashboard/filterForms/RangeDateInput.d.ts +25 -0
- package/dist/dashboard/filterForms/RelativeDateInput.d.ts +20 -0
- package/dist/dashboard/filterForms/RightIntervalSelect.d.ts +7 -0
- package/dist/dashboard/filterForms/SingleDateInput.d.ts +20 -0
- package/dist/dashboard/filterForms/StringFilterForm.d.ts +18 -0
- package/dist/dashboard/filterForms/WeekInputField.d.ts +6 -0
- package/dist/dashboard/filterForms/YearInputField.d.ts +6 -0
- package/dist/dashboard/filterForms/buildFilter.d.ts +56 -0
- package/dist/dashboard/filterForms/columnInput.d.ts +2 -0
- package/dist/dashboard/filterForms/dateLabels.d.ts +7 -0
- package/dist/dashboard/filterForms/getGranularityOptions.d.ts +5 -0
- package/dist/dashboard/filterForms/granularityLabels.d.ts +2 -0
- package/dist/dashboard/filterForms/useStringFilterSuggestions.d.ts +14 -0
- package/dist/dashboard/useDashboardFilters.d.ts +23 -0
- package/dist/dashboard/useDashboardWidget.d.ts +25 -0
- package/dist/dashboard/useDashboardsList.d.ts +21 -0
- package/dist/dashboard/useSummaryWidget.d.ts +25 -0
- package/dist/dashboard/widgetFilterStateAccessors.d.ts +15 -0
- package/dist/dashboard/widgetStore.d.ts +115 -0
- package/dist/errors.d.ts +16 -0
- package/dist/generated/graphql/gql.d.ts +146 -0
- package/dist/generated/graphql/graphql.d.ts +16533 -0
- package/dist/generated/graphql/index.d.ts +1 -0
- package/dist/graphql/fragments/column.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard-filter-definition.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard-filter-operation.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard-filter-spec.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard-filter-widget-state.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard-pinned-filter.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard-widget-with-data.fragment.d.ts +7 -0
- package/dist/graphql/fragments/dashboard-widget.fragment.d.ts +1 -0
- package/dist/graphql/fragments/dashboard.fragment.d.ts +1 -0
- package/dist/graphql/fragments/expression.fragment.d.ts +1 -0
- package/dist/graphql/fragments/parsed-filter.fragment.d.ts +2 -0
- package/dist/graphql/fragments/visualization.fragment.d.ts +1 -0
- package/dist/graphql/fragments/viz-chart-config.fragment.d.ts +1 -0
- package/dist/graphql/fragments/widget-data.fragment.d.ts +1 -0
- package/dist/graphql/mutations/update-cached-summary.mutation.d.ts +5 -0
- package/dist/graphql/queries/dashboard-list.query.d.ts +4 -0
- package/dist/graphql/queries/dashboard.query.d.ts +4 -0
- package/dist/graphql/queries/domain-filter-columns.query.d.ts +3 -0
- package/dist/graphql/queries/possible-column-literals.query.d.ts +4 -0
- package/dist/graphql/queries/widget-data.query.d.ts +6 -0
- package/dist/graphql/subscriptions/dashboard-summary.subscription.d.ts +9 -0
- package/dist/graphql/subscriptions/update-filter-value.subscription.d.ts +9 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +20234 -0
- package/dist/internal/initHighcharts.d.ts +2 -0
- package/dist/resources/dashboards.d.ts +51 -0
- package/dist/subscriptionTransport.d.ts +42 -0
- package/dist/theme.d.ts +15 -0
- package/dist/transport.d.ts +27 -0
- package/package.json +58 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DateExpression, DateFilter, RHS, type TimePeriodGranularity } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import type { Maybe } from '../../generated/graphql/graphql';
|
|
3
|
+
interface DateFilterFormProps {
|
|
4
|
+
filter: DateFilter;
|
|
5
|
+
close: () => void;
|
|
6
|
+
onSubmit: () => void;
|
|
7
|
+
fyStartMonth?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const getDateResolution: (rhs: RHS<Maybe<DateExpression>>) => TimePeriodGranularity;
|
|
10
|
+
export declare const splitDateStringToNumber: (dateString: string | undefined) => [number, number];
|
|
11
|
+
export declare enum DateFilterType {
|
|
12
|
+
CURRENT = "CURRENT",
|
|
13
|
+
PREVIOUS = "PREVIOUS",
|
|
14
|
+
NEXT = "NEXT",
|
|
15
|
+
SINGLE = "SINGLE",
|
|
16
|
+
RANGE = "RANGE",
|
|
17
|
+
NULL = "NULL",
|
|
18
|
+
NOT_NULL = "NOT_NULL"
|
|
19
|
+
}
|
|
20
|
+
export declare function DateFilterForm({ filter, close, onSubmit, fyStartMonth: fyStartMonthFromDomain }: DateFilterFormProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EnumFilter } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import type { ColumnRefInput } from '../../generated/graphql/graphql';
|
|
3
|
+
import type { UseStringFilterSuggestionsResult } from './useStringFilterSuggestions';
|
|
4
|
+
interface EnumFilterFormProps {
|
|
5
|
+
filter: EnumFilter;
|
|
6
|
+
close: () => void;
|
|
7
|
+
onSubmit: () => void;
|
|
8
|
+
columnRefs?: ColumnRefInput[];
|
|
9
|
+
suggestions?: UseStringFilterSuggestionsResult;
|
|
10
|
+
onSearchTextChange?: (searchText: string | undefined) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function EnumFilterForm({ filter, close, onSubmit, columnRefs, suggestions, onSearchTextChange, }: EnumFilterFormProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ParsedVisualizationFilter } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { type SdkDashboardFilterSpecFragmentFragment } from '../../generated/graphql/graphql';
|
|
3
|
+
import type { DomainFilterColumn } from '../../resources/dashboards';
|
|
4
|
+
export interface FilterPillProps {
|
|
5
|
+
spec: SdkDashboardFilterSpecFragmentFragment;
|
|
6
|
+
currentFilter: ParsedVisualizationFilter | null;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
onSubmit: (filter: ParsedVisualizationFilter | null) => void;
|
|
9
|
+
/** Eagerly-fetched domain filter columns; used to give a fresh enum its static allowed set. */
|
|
10
|
+
filterColumns?: DomainFilterColumn[];
|
|
11
|
+
}
|
|
12
|
+
export declare function FilterPill({ spec, currentFilter, isLoading, onSubmit, filterColumns }: FilterPillProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataframeFunctionType, IntervalClosed } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
type Props = {
|
|
3
|
+
rangeClosed: IntervalClosed;
|
|
4
|
+
onRangeClosedChange: (value: DataframeFunctionType | undefined) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const LeftIntervalSelect: ({ rangeClosed, onRangeClosedChange }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DateFilter, type PreviousNextTimeGranularity } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { DateFilterType } from './DateFilterForm';
|
|
3
|
+
type Props = {
|
|
4
|
+
nextDate: string | undefined;
|
|
5
|
+
nextDateType: PreviousNextTimeGranularity;
|
|
6
|
+
filterType: DateFilterType | undefined;
|
|
7
|
+
setFilterType: (filterType: DateFilterType) => void;
|
|
8
|
+
setNextDate: (nextDate: string) => void;
|
|
9
|
+
setNextDateType: (nextDateType: PreviousNextTimeGranularity) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const getDefaultNextDateType: (filter: DateFilter) => PreviousNextTimeGranularity;
|
|
12
|
+
export declare const NextDateInput: ({ nextDate, filterType, setFilterType, setNextDate, setNextDateType, nextDateType, }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NumberFilter, RHS } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
type Props = {
|
|
3
|
+
filter: NumberFilter;
|
|
4
|
+
close: () => void;
|
|
5
|
+
onSubmit: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const parseNumber: (value: RHS<number> | string | undefined) => number | undefined;
|
|
8
|
+
export declare const NumberFilterForm: ({ filter, close, onSubmit }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DateFilter, PreviousNextTimeExpressionType, type PreviousNextTimeGranularity } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { DateFilterType } from './DateFilterForm';
|
|
3
|
+
type Props = {
|
|
4
|
+
previousDate: string | undefined;
|
|
5
|
+
previousDateType: PreviousNextTimeGranularity;
|
|
6
|
+
filterType: DateFilterType | undefined;
|
|
7
|
+
setFilterType: (filterType: DateFilterType) => void;
|
|
8
|
+
setPreviousDate: (previousDate: string) => void;
|
|
9
|
+
setPreviousDateType: (previousDateType: PreviousNextTimeGranularity) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const getDefaultPreviousDateType: (filter: DateFilter) => PreviousNextTimeGranularity;
|
|
12
|
+
export declare const getValueForPreviousNext: (filter: DateFilter, type: PreviousNextTimeExpressionType) => string | undefined;
|
|
13
|
+
export declare const getValueForIncludeCurrentTimePeriod: (filter: DateFilter) => boolean;
|
|
14
|
+
export declare const PreviousDateInput: ({ previousDate, previousDateType, filterType, setFilterType, setPreviousDate, setPreviousDateType, }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DataframeFunctionType, IntervalClosed, type TimePeriodGranularity } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
3
|
+
type Props = {
|
|
4
|
+
rangeDateResolution: TimePeriodGranularity;
|
|
5
|
+
start: DateTime | null;
|
|
6
|
+
end: DateTime | null;
|
|
7
|
+
startYear: string | undefined;
|
|
8
|
+
endYear: string | undefined;
|
|
9
|
+
startWeek: string | undefined;
|
|
10
|
+
endWeek: string | undefined;
|
|
11
|
+
startQuarter: string | undefined;
|
|
12
|
+
endQuarter: string | undefined;
|
|
13
|
+
setRangeDateResolution: (rangeDateResolution: TimePeriodGranularity) => void;
|
|
14
|
+
onRangeChange: (start: DateTime | null, end: DateTime | null) => void;
|
|
15
|
+
onStartYearChange: (year: string) => void;
|
|
16
|
+
onEndYearChange: (year: string) => void;
|
|
17
|
+
onStartWeekChange: (week: string) => void;
|
|
18
|
+
onEndWeekChange: (week: string) => void;
|
|
19
|
+
onStartQuarterChange: (quarter: string) => void;
|
|
20
|
+
onEndQuarterChange: (quarter: string) => void;
|
|
21
|
+
rangeClosed?: IntervalClosed;
|
|
22
|
+
onRangeClosedChange?: (value: DataframeFunctionType | undefined) => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const RangeDateInput: ({ start, end, startYear, endYear, startWeek, endWeek, startQuarter, endQuarter, rangeDateResolution, setRangeDateResolution, onRangeChange, onStartYearChange, onEndYearChange, onStartWeekChange, onEndWeekChange, onStartQuarterChange, onEndQuarterChange, rangeClosed, onRangeClosedChange, }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DataframeFunctionType, type PreviousNextTimeGranularity } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { DateFilterType } from './DateFilterForm';
|
|
3
|
+
type Props = {
|
|
4
|
+
currentDateType: DataframeFunctionType;
|
|
5
|
+
filterType: DateFilterType | undefined;
|
|
6
|
+
previousDate: string | undefined;
|
|
7
|
+
previousDateType: PreviousNextTimeGranularity;
|
|
8
|
+
nextDate: string | undefined;
|
|
9
|
+
nextDateType: PreviousNextTimeGranularity;
|
|
10
|
+
setFilterType: (filterType: DateFilterType) => void;
|
|
11
|
+
setCurrentDateType: (currentDateType: DataframeFunctionType) => void;
|
|
12
|
+
setPreviousDate: (previousDate: string) => void;
|
|
13
|
+
setPreviousDateType: (previousDateType: PreviousNextTimeGranularity) => void;
|
|
14
|
+
setNextDate: (nextDate: string) => void;
|
|
15
|
+
setNextDateType: (nextDateType: PreviousNextTimeGranularity) => void;
|
|
16
|
+
includeCurrentTimePeriod: boolean;
|
|
17
|
+
setIncludeCurrentTimePeriod: (includeCurrentTimePeriod: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const RelativeDateInput: ({ currentDateType, filterType, previousDate, previousDateType, nextDate, nextDateType, setFilterType, setCurrentDateType, setPreviousDate, setPreviousDateType, setNextDate, setNextDateType, includeCurrentTimePeriod, setIncludeCurrentTimePeriod, }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataframeFunctionType, IntervalClosed } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
type Props = {
|
|
3
|
+
rangeClosed: IntervalClosed;
|
|
4
|
+
onRangeClosedChange: (value: DataframeFunctionType | undefined) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const RightIntervalSelect: ({ rangeClosed, onRangeClosedChange }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TimePeriodGranularity } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
3
|
+
type Props = {
|
|
4
|
+
dateResolution: TimePeriodGranularity;
|
|
5
|
+
value: DateTime | null;
|
|
6
|
+
year: string | undefined;
|
|
7
|
+
week: string | undefined;
|
|
8
|
+
quarter: string | undefined;
|
|
9
|
+
fiscalQuarter: string | undefined;
|
|
10
|
+
fiscalYear: string | undefined;
|
|
11
|
+
onValueChange: (date: DateTime | null) => void;
|
|
12
|
+
onYearChange: (year: string) => void;
|
|
13
|
+
onWeekChange: (week: string) => void;
|
|
14
|
+
onQuarterChange: (quarter: string) => void;
|
|
15
|
+
onFiscalQuarterChange: (quarter: string) => void;
|
|
16
|
+
onFiscalYearChange: (year: string) => void;
|
|
17
|
+
setDateResolution: (dateResolution: TimePeriodGranularity) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const SingleDateInput: ({ dateResolution, value, onValueChange, year, onYearChange, week, onWeekChange, quarter, onQuarterChange, fiscalQuarter, onFiscalQuarterChange, fiscalYear, onFiscalYearChange, setDateResolution, }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StringFilter } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import type { ColumnRefInput } from '../../generated/graphql/graphql';
|
|
3
|
+
import { type StringFilterOperator } from './buildFilter';
|
|
4
|
+
import type { UseStringFilterSuggestionsResult } from './useStringFilterSuggestions';
|
|
5
|
+
interface StringFilterFormProps {
|
|
6
|
+
filter: StringFilter;
|
|
7
|
+
close: () => void;
|
|
8
|
+
onSubmit: () => void;
|
|
9
|
+
columnRefs: ColumnRefInput[];
|
|
10
|
+
suggestions?: UseStringFilterSuggestionsResult;
|
|
11
|
+
onSearchTextChange?: (searchText: string | undefined) => void;
|
|
12
|
+
exactMatches?: boolean;
|
|
13
|
+
exactOperatorsOnly?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function getOperatorBasedOnFilterValue(filter: StringFilter): StringFilterOperator;
|
|
16
|
+
export declare function getStringFilterSuggestionFetchArgs(columnRefs: ColumnRefInput[], searchText: string | undefined, suggestions: UseStringFilterSuggestionsResult | undefined): [ColumnRefInput[], string | undefined];
|
|
17
|
+
export declare function StringFilterForm({ filter, close, onSubmit, columnRefs, suggestions, onSearchTextChange, exactMatches, exactOperatorsOnly, }: StringFilterFormProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BoolFilter, DateFilter, EnumFilter, NumberFilter, StringFilter, type ParsedVisualizationFilter } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import { type SdkDashboardFilterSpecFragmentFragment } from '../../generated/graphql/graphql';
|
|
3
|
+
import type { DomainFilterColumn } from '../../resources/dashboards';
|
|
4
|
+
/**
|
|
5
|
+
* Match a dashboard filter spec's columnRef to its domain column. Mirrors the
|
|
6
|
+
* frontend's getAllowedValuesForFilterSpec (fallbackToTableIdMatch=true): the
|
|
7
|
+
* table is keyed by id == columnRef.tableRef.uuid, preferring a version match
|
|
8
|
+
* but falling back to id-only when versions differ. The skipWidgetData
|
|
9
|
+
* dashboard payload carries no visualization id, so domainId is the entry key.
|
|
10
|
+
*/
|
|
11
|
+
export declare function findFilterColumnForRef(columns: readonly DomainFilterColumn[], columnRef: SdkDashboardFilterSpecFragmentFragment['columnRef']): DomainFilterColumn | undefined;
|
|
12
|
+
export type StringFilterOperator = 'matches' | 'matches_multiple' | 'doesnt_match' | 'contains' | 'starts_with' | 'ends_with';
|
|
13
|
+
export declare const STRING_OPERATOR_LABELS: {
|
|
14
|
+
[key in StringFilterOperator]: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function buildStringFilter(spec: SdkDashboardFilterSpecFragmentFragment, value: string, op: StringFilterOperator, values?: string[]): StringFilter;
|
|
17
|
+
/**
|
|
18
|
+
* Build a `column = NULL` (equalsNull=true) or `column != NULL` (equalsNull=false) filter.
|
|
19
|
+
* Mirrors the frontend's "Null" / "≠ Null" radio rows in StringFilterForm.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildStringNullFilter(spec: SdkDashboardFilterSpecFragmentFragment, equalsNull: boolean): StringFilter;
|
|
22
|
+
/** Seed a placeholder StringFilter for the fresh (no current filter) case. */
|
|
23
|
+
export declare function buildStringFilterSeed(spec: SdkDashboardFilterSpecFragmentFragment): StringFilter;
|
|
24
|
+
/** Seed a placeholder NumberFilter for the fresh (no current filter) case. */
|
|
25
|
+
export declare function buildNumberFilter(spec: SdkDashboardFilterSpecFragmentFragment): NumberFilter;
|
|
26
|
+
/**
|
|
27
|
+
* Static allowed values carried by an already-applied filter's column metadata.
|
|
28
|
+
* Returns [] for first-time enum specs (no current filter); the EnumFilterForm
|
|
29
|
+
* then relies solely on the dynamic literal fetch.
|
|
30
|
+
*/
|
|
31
|
+
export declare function allowedValuesFromSpec(spec: SdkDashboardFilterSpecFragmentFragment): string[];
|
|
32
|
+
/** Seed a placeholder EnumFilter for the fresh (no current filter) case. */
|
|
33
|
+
export declare function buildEnumFilterSeed(spec: SdkDashboardFilterSpecFragmentFragment, matchedColumn?: DomainFilterColumn): EnumFilter;
|
|
34
|
+
/** Seed a placeholder BoolFilter for the fresh (no current filter) case. */
|
|
35
|
+
export declare function buildBoolFilterSeed(spec: SdkDashboardFilterSpecFragmentFragment): BoolFilter;
|
|
36
|
+
/** Seed a placeholder DateFilter for the fresh (no current filter) case. */
|
|
37
|
+
export declare function buildDateFilterSeed(spec: SdkDashboardFilterSpecFragmentFragment): DateFilter;
|
|
38
|
+
export type StringFilterMode = 'string' | 'null' | 'not_null';
|
|
39
|
+
export interface StringFormState {
|
|
40
|
+
mode: StringFilterMode;
|
|
41
|
+
op: StringFilterOperator;
|
|
42
|
+
value: string;
|
|
43
|
+
values: string[];
|
|
44
|
+
}
|
|
45
|
+
export declare function initialStringFormState(filter: ParsedVisualizationFilter | null): StringFormState;
|
|
46
|
+
export type EnumFilterMode = 'values' | 'null' | 'not_null';
|
|
47
|
+
export interface EnumFormState {
|
|
48
|
+
mode: EnumFilterMode;
|
|
49
|
+
values: string[];
|
|
50
|
+
}
|
|
51
|
+
export declare function initialEnumFormState(filter: ParsedVisualizationFilter | null): EnumFormState;
|
|
52
|
+
export interface BoolFormState {
|
|
53
|
+
values: boolean[];
|
|
54
|
+
}
|
|
55
|
+
export declare function initialBoolFormState(filter: ParsedVisualizationFilter | null): BoolFormState;
|
|
56
|
+
export declare function formatFilterDisplayValue(filter: ParsedVisualizationFilter): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const dayLabel: (nextDate: string | undefined) => "Days" | "Day";
|
|
2
|
+
export declare const weekLabel: (nextDate: string | undefined) => "Week" | "Weeks";
|
|
3
|
+
export declare const monthLabel: (nextDate: string | undefined) => "Month" | "Months";
|
|
4
|
+
export declare const quarterLabel: (nextDate: string | undefined) => "Quarter" | "Quarters";
|
|
5
|
+
export declare const fiscalQuarterLabel: (nextDate: string | undefined) => "Fiscal Quarter" | "Fiscal Quarters";
|
|
6
|
+
export declare const yearLabel: (nextDate: string | undefined) => "Year" | "Years";
|
|
7
|
+
export declare const fiscalYearLabel: (nextDate: string | undefined) => "Fiscal Year" | "Fiscal Years";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ColumnRefInput } from '../../generated/graphql/graphql';
|
|
2
|
+
export interface UseStringFilterSuggestionsResult {
|
|
3
|
+
options: string[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Mirrors the frontend's `usePossibleColumnLiterals`: fires a prefix-filtered query
|
|
8
|
+
* (when the user is typing) and a no-prefix browse-mode query in parallel, merges
|
|
9
|
+
* them with deduping + case-insensitive prefix matching.
|
|
10
|
+
*
|
|
11
|
+
* Without Apollo's cache the no-prefix fetch is held in component state for the
|
|
12
|
+
* lifetime of the form so that re-typing doesn't refetch it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useStringFilterSuggestions(columnRefs: ColumnRefInput[], prefix: string | undefined): UseStringFilterSuggestionsResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ParsedVisualizationFilter } from '@wisdomai/visualization/sdk-filters';
|
|
2
|
+
import type { SdkDashboardFilterSpecFragmentFragment } from '../generated/graphql/graphql';
|
|
3
|
+
import type { DomainFilterColumn } from '../resources/dashboards';
|
|
4
|
+
export interface DashboardFilterEntry {
|
|
5
|
+
spec: SdkDashboardFilterSpecFragmentFragment;
|
|
6
|
+
/** The currently applied filter, parsed for editing. Null when no value is set. */
|
|
7
|
+
currentFilter: ParsedVisualizationFilter | null;
|
|
8
|
+
/** True while a server-side mutation for this filter is in flight. */
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseDashboardFiltersResult {
|
|
12
|
+
filters: DashboardFilterEntry[];
|
|
13
|
+
setFilterValue: (filterId: string, filter: ParsedVisualizationFilter | null) => Promise<void>;
|
|
14
|
+
/** True while any filter operation is in flight (cancel-and-restart means at most one at a time). */
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function parseCurrentFilter(spec: SdkDashboardFilterSpecFragmentFragment, matchedColumn?: DomainFilterColumn): ParsedVisualizationFilter | null;
|
|
18
|
+
/**
|
|
19
|
+
* Headless hook for the dashboard's filters. Returns the current filter
|
|
20
|
+
* specs (with parsed current values, ready to clone+edit) and a
|
|
21
|
+
* setFilterValue mutator that opens a v2 update-filter-value subscription.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useDashboardFilters(): UseDashboardFiltersResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SdkDashboardWidgetWithDataFragmentFragment } from '../generated/graphql/graphql';
|
|
2
|
+
import { type WidgetStatus } from './widgetStore';
|
|
3
|
+
export interface UseDashboardWidgetResult {
|
|
4
|
+
widget: SdkDashboardWidgetWithDataFragmentFragment | null;
|
|
5
|
+
status: WidgetStatus;
|
|
6
|
+
error: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Re-fetches the widget from offset 0 with a larger `limit`, replacing the
|
|
9
|
+
* cached visualization with the wider window. Resolves to the number of
|
|
10
|
+
* rows loaded after the attempt (unchanged on failure / abort / no-op), so
|
|
11
|
+
* callers can decide whether a target page is now reachable.
|
|
12
|
+
*/
|
|
13
|
+
fetchMore: (nextLimit: number) => Promise<number>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Headless hook for a single widget's reactive state. Owns the widget's
|
|
17
|
+
* data lifecycle: subscribes to the store, kicks off the per-widget
|
|
18
|
+
* `getWidgetData` query when the slot is cold, and aborts the in-flight
|
|
19
|
+
* query if the user activates a filter (the subscription becomes the
|
|
20
|
+
* authoritative writer at that point).
|
|
21
|
+
*
|
|
22
|
+
* Multiple call sites for the same `widgetId` share one fetch — the second
|
|
23
|
+
* mount sees `status === 'loading'` and just subscribes to the slot.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useDashboardWidget(widgetId: string, dashboardIdProp?: string): UseDashboardWidgetResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DashboardListItem } from '../resources/dashboards';
|
|
2
|
+
export interface UseDashboardsListOptions {
|
|
3
|
+
workspaceID?: string;
|
|
4
|
+
}
|
|
5
|
+
export type UseDashboardsListResult = {
|
|
6
|
+
status: 'loading';
|
|
7
|
+
dashboards: null;
|
|
8
|
+
error: null;
|
|
9
|
+
refetch: () => Promise<void>;
|
|
10
|
+
} | {
|
|
11
|
+
status: 'error';
|
|
12
|
+
dashboards: null;
|
|
13
|
+
error: Error;
|
|
14
|
+
refetch: () => Promise<void>;
|
|
15
|
+
} | {
|
|
16
|
+
status: 'success';
|
|
17
|
+
dashboards: DashboardListItem[];
|
|
18
|
+
error: null;
|
|
19
|
+
refetch: () => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export declare function useDashboardsList(options?: UseDashboardsListOptions): UseDashboardsListResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type SummaryStatus = 'empty' | 'cached' | 'streaming' | 'error' | 'unsupported';
|
|
2
|
+
export interface UseSummaryWidgetResult {
|
|
3
|
+
summary: string;
|
|
4
|
+
status: SummaryStatus;
|
|
5
|
+
/** True while a fresh summary is being generated (drives auto-scroll). */
|
|
6
|
+
isStreaming: boolean;
|
|
7
|
+
/** Force a fresh generation, bypassing the cache. */
|
|
8
|
+
refresh: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Owns a summary widget's content lifecycle. Cache-first: renders the
|
|
12
|
+
* persisted `markdownContent` when present and unfiltered; otherwise streams a
|
|
13
|
+
* fresh summary from the `dashboardSummary` subscription and persists it.
|
|
14
|
+
*
|
|
15
|
+
* Filter-aware: while a filter is applied it regenerates against the dashboard
|
|
16
|
+
* version and never persists (the per-user cache slot is keyed only by widget,
|
|
17
|
+
* so persisting a filtered summary would poison the canonical one). Clearing
|
|
18
|
+
* the filter reverts to the canonical summary without regenerating. A refetch
|
|
19
|
+
* (or `refresh()`) forces regeneration to stay consistent with the charts.
|
|
20
|
+
*
|
|
21
|
+
* Anchors to the stable root `widgetId` and reads the widget from the preserved
|
|
22
|
+
* `dashboard.widgets` array — never the widget store slot, which filtering
|
|
23
|
+
* overwrites with versioned clone ids.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useSummaryWidget(widgetId: string): UseSummaryWidgetResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WidgetFilterStatus } from '../generated/graphql/graphql';
|
|
2
|
+
export declare const EMPTY_WIDGET_FILTER_COLUMN_STATES_EXPLANATION = "No information found for the columns in this filter";
|
|
3
|
+
interface WidgetFilterColumnStateLike {
|
|
4
|
+
status: WidgetFilterStatus;
|
|
5
|
+
explanationText?: string | null;
|
|
6
|
+
columnRef?: {
|
|
7
|
+
columnName?: string | null;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
interface WidgetFilterStateLike {
|
|
11
|
+
columnStates?: readonly WidgetFilterColumnStateLike[] | null;
|
|
12
|
+
}
|
|
13
|
+
export declare const getWidgetFilterStatus: (widgetFilterState: WidgetFilterStateLike | null | undefined) => WidgetFilterStatus;
|
|
14
|
+
export declare const getWidgetFilterExplanationText: (widgetFilterState: WidgetFilterStateLike | null | undefined) => string | undefined;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type SdkDashboardWidgetFragmentFragment, type SdkDashboardWidgetWithDataFragmentFragment } from '../generated/graphql/graphql';
|
|
2
|
+
import type { WidgetData } from '../resources/dashboards';
|
|
3
|
+
export type WidgetStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
4
|
+
/**
|
|
5
|
+
* Single source of truth for one widget. Seeded from `dashboard.widgets`
|
|
6
|
+
* (metadata only), filled by `getWidgetData` (adds visualization), replaced
|
|
7
|
+
* wholesale by filter-update subscription events (metadata + visualization).
|
|
8
|
+
*
|
|
9
|
+
* The metadata-only fragment is structurally assignable to the with-data
|
|
10
|
+
* fragment because `visualization` is optional on the latter.
|
|
11
|
+
*/
|
|
12
|
+
export interface WidgetSlot {
|
|
13
|
+
status: WidgetStatus;
|
|
14
|
+
widget: SdkDashboardWidgetWithDataFragmentFragment | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
subscribers: number;
|
|
17
|
+
fetchController: AbortController | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Per-widget reactive store. `useSyncExternalStore` consumers subscribe to a
|
|
21
|
+
* single widget's slice so unrelated widgets don't re-render. Subscriber
|
|
22
|
+
* refcounts are tracked separately from the listener registry — the refcount
|
|
23
|
+
* gates fetch dedup and abort-on-last-unmount.
|
|
24
|
+
*/
|
|
25
|
+
export declare class WidgetStore {
|
|
26
|
+
private slots;
|
|
27
|
+
private listeners;
|
|
28
|
+
private allListeners;
|
|
29
|
+
private lastRefreshedCache;
|
|
30
|
+
getEntry(widgetId: string): WidgetSlot;
|
|
31
|
+
/**
|
|
32
|
+
* Stable snapshot for `useSyncExternalStore`. The returned object identity
|
|
33
|
+
* is preserved across calls until either the widgets reference changes or
|
|
34
|
+
* any slot mutates, so React's bail-out skips downstream renders when
|
|
35
|
+
* nothing relevant changed.
|
|
36
|
+
*/
|
|
37
|
+
getLastRefreshedSnapshot(widgets: readonly Pick<SdkDashboardWidgetFragmentFragment, 'id' | 'widgetType'>[]): LastRefreshedState;
|
|
38
|
+
/**
|
|
39
|
+
* Refreshes a widget's metadata in the store. If the slot already holds
|
|
40
|
+
* cached visualization data, the visualization is preserved while the
|
|
41
|
+
* fresh metadata fields (title, type, etc.) are merged in — so a
|
|
42
|
+
* `DashboardProvider` refetch never leaves stale metadata next to a
|
|
43
|
+
* cached chart.
|
|
44
|
+
*/
|
|
45
|
+
seedWidget(widget: SdkDashboardWidgetFragmentFragment): void;
|
|
46
|
+
/**
|
|
47
|
+
* Marks a widget as loading. Used both by the per-widget fetch when it
|
|
48
|
+
* starts and by `setFilterValue` for all widgets affected by a filter.
|
|
49
|
+
*/
|
|
50
|
+
markLoading(widgetIds: readonly string[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Writes per-widget query result. Merges visualization + dataError into
|
|
53
|
+
* the existing seeded metadata; preserves all other fields.
|
|
54
|
+
*/
|
|
55
|
+
setWidgetFromQuery(widgetId: string, data: WidgetData): void;
|
|
56
|
+
/**
|
|
57
|
+
* Writes a subscription-pushed widget payload. Replaces the widget
|
|
58
|
+
* wholesale because the server-side filter mutation may have changed
|
|
59
|
+
* arbitrary metadata fields (visualizationType, dataRefreshedAt, etc.).
|
|
60
|
+
*/
|
|
61
|
+
setWidgetFromSubscription(widgetId: string, widget: SdkDashboardWidgetWithDataFragmentFragment): void;
|
|
62
|
+
setWidgetError(widgetId: string, error: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Atomic reset + re-seed: drops all visualization data and error state and
|
|
65
|
+
* re-seeds slots with fresh metadata, emitting once per widget. Equivalent
|
|
66
|
+
* in net effect to `resetAll()` followed by a `seedWidget(widget)` loop,
|
|
67
|
+
* but avoids the intermediate empty-state render so the filter-mutation
|
|
68
|
+
* error path doesn't flicker. Subscriber counts are preserved for ids
|
|
69
|
+
* that survive the reset so mounted `useDashboardWidget` hooks keep their
|
|
70
|
+
* accounting.
|
|
71
|
+
*/
|
|
72
|
+
resetToSeeded(widgets: readonly SdkDashboardWidgetFragmentFragment[]): void;
|
|
73
|
+
/**
|
|
74
|
+
* Invalidates cached widget data while preserving subscribers, listeners,
|
|
75
|
+
* and widget metadata. Used by `DashboardProvider.refetch()` so each
|
|
76
|
+
* mounted widget re-issues its `getWidgetData` query once the new dashboard
|
|
77
|
+
* payload lands — `useDashboardWidget` skips the fetch effect when a slot
|
|
78
|
+
* already has a `visualization`, so clearing it is what re-arms the fetch.
|
|
79
|
+
* Aborts any in-flight fetch before clearing so a late response cannot
|
|
80
|
+
* resolve through `setWidgetFromQuery` and overwrite the reset.
|
|
81
|
+
*/
|
|
82
|
+
invalidateAllData(): void;
|
|
83
|
+
addSubscriber(widgetId: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Decrements subscriber count. If the slot drops to zero subscribers
|
|
86
|
+
* while a fetch is in-flight, the fetch is aborted (in-flight requests
|
|
87
|
+
* are wasted work; completed responses stay cached for the Provider's lifetime).
|
|
88
|
+
*/
|
|
89
|
+
removeSubscriber(widgetId: string): void;
|
|
90
|
+
setFetchController(widgetId: string, controller: AbortController | null): void;
|
|
91
|
+
/**
|
|
92
|
+
* Aborts any in-flight per-widget fetch and resets the slot status to
|
|
93
|
+
* idle so the hook can retry once conditions change (e.g., the active
|
|
94
|
+
* filter mutation completes). Called on filter activation — the
|
|
95
|
+
* subscription becomes the authoritative writer for affected widgets,
|
|
96
|
+
* but unaffected widgets need a clean slate to re-fetch from afterward.
|
|
97
|
+
*/
|
|
98
|
+
abortFetch(widgetId: string): void;
|
|
99
|
+
subscribe(widgetId: string, listener: () => void): () => void;
|
|
100
|
+
subscribeAll(listener: () => void): () => void;
|
|
101
|
+
private emit;
|
|
102
|
+
}
|
|
103
|
+
export interface LastRefreshedState {
|
|
104
|
+
lastRefreshedAt: Date | null;
|
|
105
|
+
allWidgetsReady: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Pure derivation of last-refreshed state for the header. Mirrors the
|
|
109
|
+
* frontend's `DashboardRefreshButton` filter (visualization widgets only)
|
|
110
|
+
* but reads readiness from the widget store's status rather than the
|
|
111
|
+
* presence of `widget.visualization`, so partial loads and refetches show
|
|
112
|
+
* "Refreshing…" consistently.
|
|
113
|
+
*/
|
|
114
|
+
export declare function selectLastRefreshedAt(store: WidgetStore, widgets: readonly Pick<SdkDashboardWidgetFragmentFragment, 'id' | 'widgetType'>[]): LastRefreshedState;
|
|
115
|
+
export declare function useWidgetEntry(store: WidgetStore, widgetId: string): WidgetSlot;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class WisdomError extends Error {
|
|
2
|
+
readonly cause?: unknown | undefined;
|
|
3
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
4
|
+
}
|
|
5
|
+
export declare class WisdomAuthError extends WisdomError {
|
|
6
|
+
constructor(message: string, cause?: unknown);
|
|
7
|
+
}
|
|
8
|
+
export declare class WisdomDashboardNotFoundError extends WisdomError {
|
|
9
|
+
readonly dashboardId: string;
|
|
10
|
+
constructor(dashboardId: string, cause?: unknown);
|
|
11
|
+
}
|
|
12
|
+
export declare class WisdomDashboardWidgetNotFoundError extends WisdomError {
|
|
13
|
+
readonly dashboardId: string;
|
|
14
|
+
readonly widgetId: string;
|
|
15
|
+
constructor(dashboardId: string, widgetId: string, cause?: unknown);
|
|
16
|
+
}
|