@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,51 @@
|
|
|
1
|
+
import { type ColumnRefInput, DashboardScope, type SdkGetDashboardQuery, type SdkGetDashboardWidgetDataQuery, type SdkListDashboardsQuery } from '../generated/graphql/graphql';
|
|
2
|
+
import type { Transport } from '../transport';
|
|
3
|
+
export type Dashboard = NonNullable<SdkGetDashboardQuery['dashboard']>;
|
|
4
|
+
export type WidgetData = SdkGetDashboardWidgetDataQuery['dashboardWidgetData'];
|
|
5
|
+
export type DashboardListItem = SdkListDashboardsQuery['dashboards']['nodes'][number];
|
|
6
|
+
/** Flattened domain column metadata used to give a fresh enum filter its static allowed set. */
|
|
7
|
+
export interface DomainFilterColumn {
|
|
8
|
+
domainId: string;
|
|
9
|
+
tableId: string;
|
|
10
|
+
tableVersion: number | null;
|
|
11
|
+
columnName: string;
|
|
12
|
+
allowedValues: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface DashboardsGetOptions {
|
|
15
|
+
scope?: DashboardScope;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
export interface DashboardsGetWidgetDataOptions {
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
/** Zero-based row offset of the requested window. */
|
|
21
|
+
offset?: number;
|
|
22
|
+
/** Max rows to return. Omit to use the server default table cap. */
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface DashboardsListOptions {
|
|
26
|
+
workspaceID?: string;
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
export interface DashboardsGetPossibleColumnLiteralsOptions {
|
|
30
|
+
query?: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
export declare class DashboardsAPI {
|
|
34
|
+
private readonly transport;
|
|
35
|
+
constructor(transport: Transport);
|
|
36
|
+
get(id: string, options?: DashboardsGetOptions): Promise<Dashboard>;
|
|
37
|
+
list(options?: DashboardsListOptions): Promise<DashboardListItem[]>;
|
|
38
|
+
getWidgetData(dashboardId: string, widgetId: string, options?: DashboardsGetWidgetDataOptions): Promise<WidgetData>;
|
|
39
|
+
/**
|
|
40
|
+
* Persists a generated summary back to the per-user cache. Only ever
|
|
41
|
+
* called for the canonical (unfiltered) summary — filtered summaries are
|
|
42
|
+
* transient view state and must not overwrite the single cache slot.
|
|
43
|
+
*/
|
|
44
|
+
updateCachedSummary(dashboardId: string, widgetId: string, markdownContent: string, options?: {
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
getPossibleColumnLiterals(columnRefs: ColumnRefInput[], options?: DashboardsGetPossibleColumnLiteralsOptions): Promise<string[]>;
|
|
48
|
+
getDomainFilterColumns(domainId: string, options?: {
|
|
49
|
+
signal?: AbortSignal;
|
|
50
|
+
}): Promise<DomainFilterColumn[]>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
export interface SubscriptionTransportOptions {
|
|
3
|
+
jwt: string;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Override for non-browser tests; defaults to global WebSocket. */
|
|
6
|
+
webSocketImpl?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface SubscriptionObserver<TData> {
|
|
9
|
+
next: (data: TData) => void;
|
|
10
|
+
error: (err: Error) => void;
|
|
11
|
+
complete: () => void;
|
|
12
|
+
}
|
|
13
|
+
export type Unsubscribe = () => void;
|
|
14
|
+
/**
|
|
15
|
+
* GraphQL-over-WebSocket transport using the graphql-ws protocol.
|
|
16
|
+
*
|
|
17
|
+
* Auth is injected into every subscription's variables as
|
|
18
|
+
* `auth: { token: jwt }` (matching the server's SubscriptionAuthInput
|
|
19
|
+
* convention) — callers pass variables without `auth`.
|
|
20
|
+
*
|
|
21
|
+
* The WebSocket connection is opened lazily on the first subscribe()
|
|
22
|
+
* call and reused across subscriptions for the lifetime of this
|
|
23
|
+
* transport. Call dispose() to tear it down.
|
|
24
|
+
*/
|
|
25
|
+
export declare class SubscriptionTransport {
|
|
26
|
+
private readonly jwt;
|
|
27
|
+
private readonly wsUrl;
|
|
28
|
+
private readonly webSocketImpl?;
|
|
29
|
+
private client;
|
|
30
|
+
constructor(options: SubscriptionTransportOptions);
|
|
31
|
+
subscribe<TResult, TVariables>(document: TypedDocumentNode<TResult, TVariables>, variables: OmitAuth<TVariables>, observer: SubscriptionObserver<TResult>): Unsubscribe;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
private ensureClient;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Variables type with the `auth` field stripped — callers don't pass auth,
|
|
37
|
+
* the transport injects it from the JWT.
|
|
38
|
+
*/
|
|
39
|
+
type OmitAuth<T> = T extends {
|
|
40
|
+
auth: unknown;
|
|
41
|
+
} ? Omit<T, 'auth'> : T;
|
|
42
|
+
export {};
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HighchartsThemeConfig } from '@wisdomai/visualization';
|
|
2
|
+
export interface WisdomTheme {
|
|
3
|
+
primaryTextColor: string;
|
|
4
|
+
secondaryTextColor: string;
|
|
5
|
+
background: string;
|
|
6
|
+
border: string;
|
|
7
|
+
gridLineColor: string;
|
|
8
|
+
fontFamily?: string;
|
|
9
|
+
chartColors?: string[];
|
|
10
|
+
axisLineColor?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultTheme: WisdomTheme;
|
|
13
|
+
export declare const WisdomThemeContext: import("react").Context<WisdomTheme>;
|
|
14
|
+
export declare function useWisdomTheme(): WisdomTheme;
|
|
15
|
+
export declare function themeToHighchartsConfig(theme: WisdomTheme): HighchartsThemeConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
export interface TransportOptions {
|
|
3
|
+
jwt: string;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
interface GraphQLErrorShape {
|
|
9
|
+
message?: string;
|
|
10
|
+
extensions?: {
|
|
11
|
+
code?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface TransportError {
|
|
15
|
+
errors: GraphQLErrorShape[];
|
|
16
|
+
}
|
|
17
|
+
export declare class Transport {
|
|
18
|
+
private readonly jwt;
|
|
19
|
+
private readonly baseUrl;
|
|
20
|
+
private readonly fetchImpl;
|
|
21
|
+
private readonly timeoutMs;
|
|
22
|
+
constructor(options: TransportOptions);
|
|
23
|
+
request<TResult, TVariables>(document: TypedDocumentNode<TResult, TVariables>, variables: TVariables, options?: {
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}): Promise<TResult>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wisdomai/react",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "Wisdom AI React SDK",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"AGENTS.md"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/datawisdomai/wisdom.git",
|
|
22
|
+
"directory": "javascript/packages/react-sdk"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"registry": "https://registry.npmjs.org",
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": ">=18",
|
|
30
|
+
"react-dom": ">=18",
|
|
31
|
+
"highcharts": "^12",
|
|
32
|
+
"highcharts-react-official": "^3",
|
|
33
|
+
"@mui/material": "^7.3.10",
|
|
34
|
+
"@mui/x-date-pickers": "^7.10.0",
|
|
35
|
+
"@emotion/react": "^11.14.0",
|
|
36
|
+
"@emotion/styled": "^11.14.1",
|
|
37
|
+
"graphql": "^16",
|
|
38
|
+
"luxon": "^3"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
42
|
+
"graphql-ws": "^6.0.7",
|
|
43
|
+
"html-to-image": "^1.11.11",
|
|
44
|
+
"react-grid-layout": "^1.4.4",
|
|
45
|
+
"react-markdown": "^9.0.1",
|
|
46
|
+
"react-resizable": "^3.0.5",
|
|
47
|
+
"remark-gfm": "^4.0.0",
|
|
48
|
+
"@wisdomai/visualization": "^0.3.3",
|
|
49
|
+
"@wisdomai/ui-kit": "^0.1.8"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"esbuild": "^0.27.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "node build.mjs",
|
|
56
|
+
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
57
|
+
}
|
|
58
|
+
}
|