@levi-gemcommerce/analytics 0.0.1-dev.2 → 0.0.1-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/core/gemxql/api/index.d.ts +2 -0
- package/dist/esm/core/gemxql/api/useCustomGemXQlQuery.d.ts +16 -0
- package/dist/esm/core/gemxql/api/useGemxQlNamedQuery.d.ts +14 -0
- package/dist/esm/core/gemxql/builder/build-gemxql-query.d.ts +15 -0
- package/dist/esm/core/gemxql/builder/clauses/condition-query.d.ts +12 -0
- package/dist/esm/core/gemxql/builder/clauses/from-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/group-query.d.ts +11 -0
- package/dist/esm/core/gemxql/builder/clauses/index.d.ts +11 -0
- package/dist/esm/core/gemxql/builder/clauses/limit-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/mode-query.d.ts +7 -0
- package/dist/esm/core/gemxql/builder/clauses/offset-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/order-by-query.d.ts +7 -0
- package/dist/esm/core/gemxql/builder/clauses/show-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/time-query.d.ts +16 -0
- package/dist/esm/core/gemxql/builder/clauses/time-series-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/timezone-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/configs/date-formats.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/configs/index.d.ts +3 -0
- package/dist/esm/core/gemxql/builder/configs/keywords.d.ts +2 -0
- package/dist/esm/core/gemxql/builder/configs/query-defaults.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/filters/build-extra-conditions.d.ts +3 -0
- package/dist/esm/core/gemxql/builder/filters/build-filter-conditions.d.ts +22 -0
- package/dist/esm/core/gemxql/builder/filters/index.d.ts +2 -0
- package/dist/esm/core/gemxql/builder/helpers/date-query-helpers.d.ts +5 -0
- package/dist/esm/core/gemxql/builder/helpers/index.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/helpers/is-valid-query-input.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/index.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/parse-gemxql-query.d.ts +4 -0
- package/dist/esm/core/gemxql/constants/analytic-data.d.ts +2 -0
- package/dist/esm/core/gemxql/constants/column-keys.d.ts +4 -0
- package/dist/esm/core/gemxql/constants/index.d.ts +4 -0
- package/dist/esm/core/gemxql/constants/operators.d.ts +2 -0
- package/dist/esm/core/gemxql/constants/row-reader-mode.d.ts +5 -0
- package/dist/esm/core/gemxql/graphql/fragments/gemxql.generated.d.ts +23 -0
- package/dist/esm/core/gemxql/graphql/index.d.ts +2 -0
- package/dist/esm/core/gemxql/graphql/queries/gemxql.generated.d.ts +9 -0
- package/dist/esm/core/gemxql/helpers/columnKeys.d.ts +3 -0
- package/dist/esm/core/gemxql/helpers/extractQueryData.d.ts +5 -0
- package/dist/esm/core/gemxql/helpers/formatAnalyticData.d.ts +10 -0
- package/dist/esm/core/gemxql/helpers/formatAnalyticDate.d.ts +1 -0
- package/dist/esm/core/gemxql/helpers/getTimeDimension.d.ts +3 -0
- package/dist/esm/core/gemxql/helpers/hasMetricData.d.ts +1 -0
- package/dist/esm/core/gemxql/helpers/index.d.ts +8 -0
- package/dist/esm/core/gemxql/helpers/parseJsonFields.d.ts +9 -0
- package/dist/esm/core/gemxql/helpers/readNumeric.d.ts +3 -0
- package/dist/esm/core/gemxql/hooks/index.d.ts +2 -0
- package/dist/esm/core/gemxql/hooks/useAnalyticData.d.ts +24 -0
- package/dist/esm/core/gemxql/hooks/useGemXQlPagination.d.ts +25 -0
- package/dist/esm/core/gemxql/index.d.ts +10 -0
- package/dist/esm/core/gemxql/types/analytic-data.d.ts +24 -0
- package/dist/esm/core/gemxql/types/analytic-mode.d.ts +5 -0
- package/dist/esm/core/gemxql/types/analytic-source.d.ts +4 -0
- package/dist/esm/core/gemxql/types/breakdown-items.d.ts +19 -0
- package/dist/esm/core/gemxql/types/date-filter.d.ts +10 -0
- package/dist/esm/core/gemxql/types/extra-condition.d.ts +28 -0
- package/dist/esm/core/gemxql/types/field-filters.d.ts +18 -0
- package/dist/esm/core/gemxql/types/field-operators.d.ts +8 -0
- package/dist/esm/core/gemxql/types/filter-types.d.ts +28 -0
- package/dist/esm/core/gemxql/types/group-with-clause.d.ts +12 -0
- package/dist/esm/core/gemxql/types/index.d.ts +14 -0
- package/dist/esm/core/gemxql/types/order-by.d.ts +10 -0
- package/dist/esm/core/gemxql/types/page-fields.d.ts +22 -0
- package/dist/esm/core/gemxql/types/row-reader-mode.d.ts +6 -0
- package/dist/esm/core/gemxql/types/time-dimension.d.ts +8 -0
- package/dist/esm/core/gemxql/utils/analytics.d.ts +13 -0
- package/dist/esm/core/gemxql/utils/dayjs.d.ts +8 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +13 -4
- package/dist/esm/index.mjs +13 -4
- package/dist/umd/esm/core/gemxql/api/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/api/useCustomGemXQlQuery.d.ts +16 -0
- package/dist/umd/esm/core/gemxql/api/useGemxQlNamedQuery.d.ts +14 -0
- package/dist/umd/esm/core/gemxql/builder/build-gemxql-query.d.ts +15 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/condition-query.d.ts +12 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/from-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/group-query.d.ts +11 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/index.d.ts +11 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/limit-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/mode-query.d.ts +7 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/offset-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/order-by-query.d.ts +7 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/show-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/time-query.d.ts +16 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/time-series-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/timezone-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/configs/date-formats.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/configs/index.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/builder/configs/keywords.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/builder/configs/query-defaults.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/filters/build-extra-conditions.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/builder/filters/build-filter-conditions.d.ts +22 -0
- package/dist/umd/esm/core/gemxql/builder/filters/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/builder/helpers/date-query-helpers.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/builder/helpers/index.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/helpers/is-valid-query-input.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/index.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/parse-gemxql-query.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/constants/analytic-data.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/constants/column-keys.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/constants/index.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/constants/operators.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/constants/row-reader-mode.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/graphql/fragments/gemxql.generated.d.ts +23 -0
- package/dist/umd/esm/core/gemxql/graphql/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/graphql/queries/gemxql.generated.d.ts +9 -0
- package/dist/umd/esm/core/gemxql/helpers/columnKeys.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/helpers/extractQueryData.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/helpers/formatAnalyticData.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/helpers/formatAnalyticDate.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/helpers/getTimeDimension.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/helpers/hasMetricData.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/helpers/index.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/helpers/parseJsonFields.d.ts +9 -0
- package/dist/umd/esm/core/gemxql/helpers/readNumeric.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/hooks/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/hooks/useAnalyticData.d.ts +24 -0
- package/dist/umd/esm/core/gemxql/hooks/useGemXQlPagination.d.ts +25 -0
- package/dist/umd/esm/core/gemxql/index.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/types/analytic-data.d.ts +24 -0
- package/dist/umd/esm/core/gemxql/types/analytic-mode.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/types/analytic-source.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/types/breakdown-items.d.ts +19 -0
- package/dist/umd/esm/core/gemxql/types/date-filter.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/types/extra-condition.d.ts +28 -0
- package/dist/umd/esm/core/gemxql/types/field-filters.d.ts +18 -0
- package/dist/umd/esm/core/gemxql/types/field-operators.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/types/filter-types.d.ts +28 -0
- package/dist/umd/esm/core/gemxql/types/group-with-clause.d.ts +12 -0
- package/dist/umd/esm/core/gemxql/types/index.d.ts +14 -0
- package/dist/umd/esm/core/gemxql/types/order-by.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/types/page-fields.d.ts +22 -0
- package/dist/umd/esm/core/gemxql/types/row-reader-mode.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/types/time-dimension.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/utils/analytics.d.ts +13 -0
- package/dist/umd/esm/core/gemxql/utils/dayjs.d.ts +8 -0
- package/dist/umd/esm/index.d.ts +1 -0
- package/dist/umd/index.js +1 -1
- package/package.json +21 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { GemxQlQueryResponse, GemxQlQueryVariables } from '../graphql';
|
|
3
|
+
type GemXQlCustomFetcher<TData, TVariables> = (document: string, variables: TVariables) => () => Promise<TData>;
|
|
4
|
+
export interface BaseHeaderResponse {
|
|
5
|
+
'x-cache'?: string;
|
|
6
|
+
'x-request-id'?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CustomGemXQlResponse extends GemxQlQueryResponse {
|
|
9
|
+
headers: BaseHeaderResponse;
|
|
10
|
+
}
|
|
11
|
+
type GemXQlQueryOptions<TData, TError> = Omit<UseQueryOptions<CustomGemXQlResponse, TError, TData, QueryKey>, 'queryKey' | 'queryFn'>;
|
|
12
|
+
export declare const useCustomGemXQlQuery: {
|
|
13
|
+
<TData = CustomGemXQlResponse, TError = unknown>(variables: GemxQlQueryVariables, fetcher: GemXQlCustomFetcher<CustomGemXQlResponse, GemxQlQueryVariables>, options?: GemXQlQueryOptions<TData, TError>): UseQueryResult<TData, TError>;
|
|
14
|
+
getKey(variables: GemxQlQueryVariables): (string | GemxQlQueryVariables)[];
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { GemxQlQueryResponse, GemxQlQueryVariables } from '../graphql';
|
|
3
|
+
type GemXQlFetcher<TData, TVariables> = (document: string, variables: TVariables) => () => Promise<TData>;
|
|
4
|
+
interface UseGemxQlNamedQueryParams {
|
|
5
|
+
name: string;
|
|
6
|
+
variables: GemxQlQueryVariables;
|
|
7
|
+
fetcher: GemXQlFetcher<GemxQlQueryResponse, GemxQlQueryVariables>;
|
|
8
|
+
}
|
|
9
|
+
type GemXQlNamedQueryOptions<TData, TError> = Omit<UseQueryOptions<GemxQlQueryResponse, TError, TData, QueryKey>, 'queryKey' | 'queryFn'>;
|
|
10
|
+
export declare const useGemxQlNamedQuery: {
|
|
11
|
+
<TData = GemxQlQueryResponse, TError = unknown>({ name, variables, fetcher }: UseGemxQlNamedQueryParams, options?: GemXQlNamedQueryOptions<TData, TError>): UseQueryResult<TData, TError>;
|
|
12
|
+
getKey(name: string, variables: GemxQlQueryVariables): (string | GemxQlQueryVariables)[];
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IBuildConditionQueryParams } from './clauses/condition-query';
|
|
2
|
+
import type { IBuildFromQueryParams } from './clauses/from-query';
|
|
3
|
+
import type { IBuildGroupQueryParams } from './clauses/group-query';
|
|
4
|
+
import type { IBuildLimitQueryParams } from './clauses/limit-query';
|
|
5
|
+
import type { IBuildModeQueryParams } from './clauses/mode-query';
|
|
6
|
+
import type { IBuildOffsetQueryParams } from './clauses/offset-query';
|
|
7
|
+
import type { IBuildOrderByQueryParams } from './clauses/order-by-query';
|
|
8
|
+
import type { IBuildShowQueryParams } from './clauses/show-query';
|
|
9
|
+
import type { IBuildTimeQueryParams } from './clauses/time-query';
|
|
10
|
+
import type { IBuildTimeSeriesQueryParams } from './clauses/time-series-query';
|
|
11
|
+
import type { IBuildTimezoneQueryParams } from './clauses/timezone-query';
|
|
12
|
+
export type IBuildGemXQlQueryParams = IBuildModeQueryParams & IBuildFromQueryParams & IBuildShowQueryParams & IBuildGroupQueryParams & IBuildTimeQueryParams & IBuildTimeSeriesQueryParams & IBuildTimezoneQueryParams & IBuildOrderByQueryParams & IBuildConditionQueryParams & IBuildLimitQueryParams & IBuildOffsetQueryParams & {
|
|
13
|
+
extraOrderByFields?: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare const buildGemXQlQuery: (params: IBuildGemXQlQueryParams) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GemXQlFilters, GemXQlVersionIds, IExtraCondition } from '../../types';
|
|
2
|
+
import type { IBuildFilterConditionsParams, IBuildVersionIdConditionParams } from '../filters/build-filter-conditions';
|
|
3
|
+
export interface IBuildConditionQueryParams extends IBuildFilterConditionsParams, IBuildVersionIdConditionParams {
|
|
4
|
+
extraConditions?: IExtraCondition[];
|
|
5
|
+
}
|
|
6
|
+
export type IParseConditionQueryResult = {
|
|
7
|
+
filters: GemXQlFilters;
|
|
8
|
+
versionIds?: GemXQlVersionIds;
|
|
9
|
+
};
|
|
10
|
+
declare const build: ({ filters, overrideFilters, versionIds, extraConditions }: IBuildConditionQueryParams) => string;
|
|
11
|
+
declare const parse: (query: string) => IParseConditionQueryResult;
|
|
12
|
+
export { build as buildConditionQuery, parse as parseConditionQuery };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EGroupWithClause } from '../../types';
|
|
2
|
+
export interface IBuildGroupQueryParams {
|
|
3
|
+
dimensions: string[];
|
|
4
|
+
groupWithClause?: EGroupWithClause;
|
|
5
|
+
}
|
|
6
|
+
declare const build: (dimensions: string[], withClause?: EGroupWithClause) => string;
|
|
7
|
+
declare const parse: (query: string) => {
|
|
8
|
+
dimensions: string[];
|
|
9
|
+
groupWithClause?: EGroupWithClause;
|
|
10
|
+
};
|
|
11
|
+
export { build as buildGroupQuery, parse as parseGroupQuery };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './condition-query';
|
|
2
|
+
export * from './from-query';
|
|
3
|
+
export * from './group-query';
|
|
4
|
+
export * from './limit-query';
|
|
5
|
+
export * from './mode-query';
|
|
6
|
+
export * from './offset-query';
|
|
7
|
+
export * from './order-by-query';
|
|
8
|
+
export * from './show-query';
|
|
9
|
+
export * from './time-query';
|
|
10
|
+
export * from './time-series-query';
|
|
11
|
+
export * from './timezone-query';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EAnalyticMode } from '../../types';
|
|
2
|
+
export interface IBuildModeQueryParams {
|
|
3
|
+
mode: EAnalyticMode;
|
|
4
|
+
}
|
|
5
|
+
declare const build: (mode: EAnalyticMode) => string;
|
|
6
|
+
declare const parse: (query: string) => EAnalyticMode | undefined;
|
|
7
|
+
export { build as buildModeQuery, parse as parseModeQuery };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OrderByFields } from '../../types';
|
|
2
|
+
export interface IBuildOrderByQueryParams {
|
|
3
|
+
orderBy?: OrderByFields;
|
|
4
|
+
}
|
|
5
|
+
declare const build: (orderBy?: OrderByFields, columns?: string[]) => string;
|
|
6
|
+
declare const parse: (query: string) => OrderByFields | undefined;
|
|
7
|
+
export { build as buildOrderByQuery, parse as parseOrderByQuery };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnalyticDateFilter, GemXQlFilters, GemXQlOverrideFilters } from '../../types';
|
|
2
|
+
export interface IBuildTimeQueryParams {
|
|
3
|
+
dateRange?: AnalyticDateFilter;
|
|
4
|
+
compareDateRange?: AnalyticDateFilter;
|
|
5
|
+
overrideFilters?: GemXQlOverrideFilters;
|
|
6
|
+
timeDimension?: string;
|
|
7
|
+
}
|
|
8
|
+
export type IParseTimeQueryResult = {
|
|
9
|
+
dateRange?: Pick<AnalyticDateFilter, 'startDate' | 'endDate'>;
|
|
10
|
+
compareDateRange?: Pick<AnalyticDateFilter, 'startDate' | 'endDate'>;
|
|
11
|
+
timeDimension?: string;
|
|
12
|
+
overrideFilters?: GemXQlFilters;
|
|
13
|
+
};
|
|
14
|
+
declare const build: (data: IBuildTimeQueryParams) => string;
|
|
15
|
+
declare const parse: (query: string) => IParseTimeQueryResult;
|
|
16
|
+
export { build as buildTimeQuery, parse as parseTimeQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DATE_QUERY_FORMAT = "YYYY-MM-DDTHH:mm:ss";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_QUERY_LIMIT = 1000;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GemXQlFilters, GemXQlOverrideFilters, GemXQlVersionIds, OrderByFields } from '../../types';
|
|
2
|
+
import { EFilterField, EOperatorField } from '../../types';
|
|
3
|
+
export interface IBuildFilterConditionsParams {
|
|
4
|
+
filters: GemXQlFilters;
|
|
5
|
+
overrideFilters?: GemXQlOverrideFilters;
|
|
6
|
+
}
|
|
7
|
+
export interface IBuildVersionIdConditionParams {
|
|
8
|
+
versionIds?: GemXQlVersionIds;
|
|
9
|
+
}
|
|
10
|
+
interface FilterConfig {
|
|
11
|
+
operator?: EOperatorField;
|
|
12
|
+
operatorVal?: string;
|
|
13
|
+
singleField: EFilterField;
|
|
14
|
+
multiField: EFilterField;
|
|
15
|
+
condition?: EFilterField;
|
|
16
|
+
fieldName?: EFilterField;
|
|
17
|
+
}
|
|
18
|
+
export declare const filterConfigs: FilterConfig[];
|
|
19
|
+
export declare const generateFilterConditions: (filters: GemXQlFilters, overrideFilters?: GemXQlOverrideFilters) => string[];
|
|
20
|
+
export declare const buildVersionIdCondition: (versionIds?: GemXQlVersionIds) => string[];
|
|
21
|
+
export declare const getFirstMetricInOrderBy: (orderBy: OrderByFields | undefined, metrics: string[]) => string[];
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './is-valid-query-input';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isValidQueryInput(query: string): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Maybe<T> = T | null | undefined;
|
|
2
|
+
export type TableDataType = 'ARRAY' | 'CURRENCY' | 'DATE' | 'DAY_TIMESTAMP' | 'DURATION' | 'HOUR_TIMESTAMP' | 'INTEGER' | 'MONTH_TIMESTAMP' | 'OBJECT' | 'PERCENT' | 'QUARTER_TIMESTAMP' | 'STRING' | 'WEEK_TIMESTAMP' | 'YEAR_TIMESTAMP';
|
|
3
|
+
export interface IColumn {
|
|
4
|
+
dataType: TableDataType;
|
|
5
|
+
displayName?: Maybe<string>;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ITableData {
|
|
9
|
+
rows: unknown;
|
|
10
|
+
columns?: Maybe<Array<Maybe<IColumn>>>;
|
|
11
|
+
}
|
|
12
|
+
export type ColumnSelectFragment = Pick<IColumn, 'dataType' | 'displayName' | 'name'>;
|
|
13
|
+
export type TableDataSelectFragment = Pick<ITableData, 'rows'> & {
|
|
14
|
+
columns?: Maybe<Array<Maybe<Pick<IColumn, 'dataType' | 'displayName' | 'name'>>>>;
|
|
15
|
+
};
|
|
16
|
+
export type GemXqlResultSelectFragment = {
|
|
17
|
+
tableData?: Maybe<Pick<ITableData, 'rows'> & {
|
|
18
|
+
columns?: Maybe<Array<Maybe<Pick<IColumn, 'dataType' | 'displayName' | 'name'>>>>;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare const ColumnSelectFragmentDoc = "\n fragment ColumnSelect on Column {\n dataType\n displayName\n name\n}\n ";
|
|
22
|
+
export declare const TableDataSelectFragmentDoc = "\n fragment TableDataSelect on TableData {\n columns {\n ...ColumnSelect\n }\n rows\n}\n ";
|
|
23
|
+
export declare const GemXqlResultSelectFragmentDoc = "\n fragment GemXQLResultSelect on GemxQLResult {\n tableData {\n ...TableDataSelect\n }\n}\n ";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Maybe } from '../fragments/gemxql.generated';
|
|
2
|
+
import { type GemXqlResultSelectFragment } from '../fragments/gemxql.generated';
|
|
3
|
+
export type GemxQlQueryVariables = {
|
|
4
|
+
input: string;
|
|
5
|
+
};
|
|
6
|
+
export type GemxQlQueryResponse = {
|
|
7
|
+
gemxQLQuery?: Maybe<GemXqlResultSelectFragment>;
|
|
8
|
+
};
|
|
9
|
+
export declare const GemxQlDocument = "\n query GemxQL($input: String!) {\n gemxQLQuery(query: $input) {\n ...GemXQLResultSelect\n }\n}\n \n fragment GemXQLResultSelect on GemxQLResult {\n tableData {\n ...TableDataSelect\n }\n}\n \n\n fragment TableDataSelect on TableData {\n columns {\n ...ColumnSelect\n }\n rows\n}\n \n\n fragment ColumnSelect on Column {\n dataType\n displayName\n name\n}\n ";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GemxQlQueryResponse, TableDataType } from '../graphql';
|
|
2
|
+
export type ColumnTypesMap = Record<string, TableDataType>;
|
|
3
|
+
export declare const extractQueryRows: (response?: GemxQlQueryResponse) => Record<string, unknown>[];
|
|
4
|
+
export declare const extractQueryColumns: (response?: GemxQlQueryResponse) => import("../graphql").Maybe<Pick<import("../graphql").IColumn, "displayName" | "dataType" | "name">>[];
|
|
5
|
+
export declare const extractColumnTypes: (response?: GemxQlQueryResponse) => ColumnTypesMap;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnalyticValueType } from '../types';
|
|
2
|
+
export type IGetTextPrice = (price?: number | string | null, hasCurrency?: boolean, options?: {
|
|
3
|
+
compact?: boolean;
|
|
4
|
+
}) => string;
|
|
5
|
+
export declare const formatAnalyticData: ({ value, formatter, getTextPrice, name, }: {
|
|
6
|
+
value: AnalyticValueType;
|
|
7
|
+
formatter?: string;
|
|
8
|
+
getTextPrice?: IGetTextPrice;
|
|
9
|
+
name?: string;
|
|
10
|
+
}) => AnalyticValueType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatAnalyticDate: (dateString: string | number | null) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hasMetricData: (metric?: Record<string, unknown>) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './columnKeys';
|
|
2
|
+
export * from './extractQueryData';
|
|
3
|
+
export * from './formatAnalyticData';
|
|
4
|
+
export * from './formatAnalyticDate';
|
|
5
|
+
export * from './getTimeDimension';
|
|
6
|
+
export * from './hasMetricData';
|
|
7
|
+
export * from './parseJsonFields';
|
|
8
|
+
export * from './readNumeric';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IPageItemsPayload } from '../types';
|
|
2
|
+
export interface IBreakdownItem<T extends string = string> {
|
|
3
|
+
type: T;
|
|
4
|
+
total: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const parseJsonObject: <T extends object>(value: unknown) => T | null;
|
|
7
|
+
export declare const parseJsonArray: <T>(raw: unknown) => T[] | undefined;
|
|
8
|
+
export declare const parseBreakdownItems: <T extends string = string>(raw: unknown) => IBreakdownItem<T>[] | undefined;
|
|
9
|
+
export declare const parsePageItems: (value: unknown) => IPageItemsPayload | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ERowReaderMode } from '../types';
|
|
2
|
+
export declare const readNumeric: (metric: Record<string, unknown> | undefined, key: string) => number;
|
|
3
|
+
export declare const createNumericRowReader: (row: Record<string, unknown>, mode?: ERowReaderMode) => (key: string) => number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IGetTextPrice } from '../helpers/formatAnalyticData';
|
|
2
|
+
import type { AnalyticValueType } from '../types';
|
|
3
|
+
interface IFormatDataParams {
|
|
4
|
+
value: AnalyticValueType;
|
|
5
|
+
formatter?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
type MetricRecord = Record<string, unknown>;
|
|
9
|
+
interface IComputeMetricParams {
|
|
10
|
+
metric?: MetricRecord;
|
|
11
|
+
previousMetric?: MetricRecord;
|
|
12
|
+
metricKey: string;
|
|
13
|
+
formatter?: string;
|
|
14
|
+
}
|
|
15
|
+
interface IComputeMetricResult {
|
|
16
|
+
value: AnalyticValueType;
|
|
17
|
+
change: number | string;
|
|
18
|
+
}
|
|
19
|
+
interface IUseAnalyticDataReturn {
|
|
20
|
+
formatData: (params: IFormatDataParams) => AnalyticValueType;
|
|
21
|
+
computeMetric: (params: IComputeMetricParams) => IComputeMetricResult;
|
|
22
|
+
}
|
|
23
|
+
export declare const useAnalyticData: (getTextPrice?: IGetTextPrice) => IUseAnalyticDataReturn;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum GPaginationDirection {
|
|
2
|
+
NEXT = "NEXT",
|
|
3
|
+
PREV = "PREV"
|
|
4
|
+
}
|
|
5
|
+
export interface GPaginationProps {
|
|
6
|
+
currentPage: number;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
handlePageChange: (direction: GPaginationDirection) => void;
|
|
10
|
+
}
|
|
11
|
+
interface IUseGemXQlPaginationProps {
|
|
12
|
+
resetKey: unknown;
|
|
13
|
+
itemsPerPage: number;
|
|
14
|
+
}
|
|
15
|
+
interface IBuildPaginationPropsParams {
|
|
16
|
+
totalRecords: number;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface IUseGemXQlPaginationReturn {
|
|
20
|
+
currentPage: number;
|
|
21
|
+
offset: number;
|
|
22
|
+
buildPagination: (params: IBuildPaginationPropsParams) => GPaginationProps;
|
|
23
|
+
}
|
|
24
|
+
export declare const useGemXQlPagination: ({ resetKey, itemsPerPage, }: IUseGemXQlPaginationProps) => IUseGemXQlPaginationReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './api';
|
|
2
|
+
export * from './builder';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './graphql';
|
|
5
|
+
export * from './helpers';
|
|
6
|
+
export * from './hooks';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export { AnalyticInterval, getFormattedByInterval, getTimeDurationLabel, numberWithCommas } from './utils/analytics';
|
|
9
|
+
export { convertDateToTz, dayjsTz, getInitialTimezone, setTz } from './utils/dayjs';
|
|
10
|
+
export type { Dayjs } from './utils/dayjs';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum EAnalyticDataType {
|
|
2
|
+
DATE = "DATE",
|
|
3
|
+
ARRAY = "ARRAY",
|
|
4
|
+
OBJECT = "OBJECT",
|
|
5
|
+
STRING = "STRING",
|
|
6
|
+
INTEGER = "INTEGER",
|
|
7
|
+
CURRENCY = "CURRENCY",
|
|
8
|
+
PERCENT = "PERCENT",
|
|
9
|
+
DURATION = "DURATION",
|
|
10
|
+
MONTH = "MONTH_TIMESTAMP",
|
|
11
|
+
QUARTER = "QUARTER_TIMESTAMP",
|
|
12
|
+
DAY = "DAY_TIMESTAMP",
|
|
13
|
+
WEEK = "WEEK_TIMESTAMP",
|
|
14
|
+
YEAR = "YEAR_TIMESTAMP",
|
|
15
|
+
HOUR = "HOUR_TIMESTAMP"
|
|
16
|
+
}
|
|
17
|
+
export declare enum EAnalyticColumnKey {
|
|
18
|
+
CAMPAIGNS = "experiments",
|
|
19
|
+
VISITOR_ITEMS = "visitor_items",
|
|
20
|
+
DEVICE_ITEMS = "device_items",
|
|
21
|
+
TRAFFIC_SOURCE_ITEMS = "traffic_source_items"
|
|
22
|
+
}
|
|
23
|
+
export type AnalyticPrimitiveValueType = string | number | null;
|
|
24
|
+
export type AnalyticValueType = AnalyticPrimitiveValueType;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum EVisitorType {
|
|
2
|
+
NEW = "new",
|
|
3
|
+
RETURNING = "returning"
|
|
4
|
+
}
|
|
5
|
+
export declare enum EDeviceType {
|
|
6
|
+
DESKTOP = "desktop",
|
|
7
|
+
MOBILE = "mobile",
|
|
8
|
+
TABLET = "tablet"
|
|
9
|
+
}
|
|
10
|
+
export declare enum ETrafficSourceType {
|
|
11
|
+
DIRECT = "direct",
|
|
12
|
+
EMAIL = "email",
|
|
13
|
+
REFERRAL = "referral",
|
|
14
|
+
ORGANIC_SOCIAL = "organic-social",
|
|
15
|
+
ORGANIC_SEARCH = "organic-search",
|
|
16
|
+
PAID_SOCIAL = "paid-social",
|
|
17
|
+
PAID_SEARCH = "paid-search",
|
|
18
|
+
SMS = "sms"
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare enum EComparisonOperator {
|
|
2
|
+
EQ = "=",
|
|
3
|
+
IN = "IN",
|
|
4
|
+
LIKE = "LIKE"
|
|
5
|
+
}
|
|
6
|
+
export declare enum EGroupOperator {
|
|
7
|
+
OR = "OR",
|
|
8
|
+
AND = "AND"
|
|
9
|
+
}
|
|
10
|
+
export type IExtraConditionEq = {
|
|
11
|
+
operator: EComparisonOperator.EQ;
|
|
12
|
+
fields: string[];
|
|
13
|
+
value: string | number;
|
|
14
|
+
groupOperator?: EGroupOperator;
|
|
15
|
+
};
|
|
16
|
+
export type IExtraConditionIn = {
|
|
17
|
+
operator: EComparisonOperator.IN;
|
|
18
|
+
fields: string[];
|
|
19
|
+
values: Array<string | number>;
|
|
20
|
+
groupOperator?: EGroupOperator;
|
|
21
|
+
};
|
|
22
|
+
export type IExtraConditionLike = {
|
|
23
|
+
operator: EComparisonOperator.LIKE;
|
|
24
|
+
fields: string[];
|
|
25
|
+
value: string;
|
|
26
|
+
groupOperator?: EGroupOperator;
|
|
27
|
+
};
|
|
28
|
+
export type IExtraCondition = IExtraConditionEq | IExtraConditionIn | IExtraConditionLike;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum EFilterField {
|
|
2
|
+
DEVICE = "device",
|
|
3
|
+
DEVICES = "devices",
|
|
4
|
+
VISITOR = "visitor_type",
|
|
5
|
+
VISITORS = "visitor_types",
|
|
6
|
+
TRAFFIC_SOURCE = "traffic_source",
|
|
7
|
+
TRAFFIC_SOURCES = "traffic_sources",
|
|
8
|
+
VERSION = "version",
|
|
9
|
+
VERSIONS = "versions",
|
|
10
|
+
SINGLE_PAGE = "page_path",
|
|
11
|
+
LIST_PAGE = "page_paths",
|
|
12
|
+
GROUP_CAMPAIGN_ITEM = "group_campaign_item",
|
|
13
|
+
GROUP_CAMPAIGN_ITEMS = "group_campaign_items",
|
|
14
|
+
SINGLE_CAMPAIGN = "experiment_id",
|
|
15
|
+
GROUP_CAMPAIGN = "experiment_group_id",
|
|
16
|
+
CAMPAIGN_VERSION_ID = "version_id",
|
|
17
|
+
GROUP_CAMPAIGN_VERSION_ID = "group_version_id"
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum EOperatorField {
|
|
2
|
+
DEVICE_OPERATOR = "deviceOperator",
|
|
3
|
+
VISITOR_OPERATOR = "visitorOperator",
|
|
4
|
+
TRAFFIC_SOURCE_OPERATOR = "trafficSourceOperator",
|
|
5
|
+
VERSION_OPERATOR = "versionOperator",
|
|
6
|
+
PAGE_OPERATOR = "pageOperator",
|
|
7
|
+
CAMPAIGN_ITEM_OPERATOR = "campaignItemOperator"
|
|
8
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EFilterField } from './field-filters';
|
|
2
|
+
import type { EOperatorField } from './field-operators';
|
|
3
|
+
export type GemXQlFilters = {
|
|
4
|
+
[EFilterField.DEVICE]?: string;
|
|
5
|
+
[EFilterField.VISITOR]?: string;
|
|
6
|
+
[EFilterField.TRAFFIC_SOURCE]?: string;
|
|
7
|
+
[EFilterField.VERSION]?: string;
|
|
8
|
+
[EFilterField.SINGLE_PAGE]?: string;
|
|
9
|
+
[EFilterField.GROUP_CAMPAIGN_ITEM]?: string;
|
|
10
|
+
[EFilterField.SINGLE_CAMPAIGN]?: string;
|
|
11
|
+
[EFilterField.CAMPAIGN_VERSION_ID]?: string;
|
|
12
|
+
[EFilterField.GROUP_CAMPAIGN_VERSION_ID]?: string;
|
|
13
|
+
[EFilterField.DEVICES]?: string[];
|
|
14
|
+
[EFilterField.VISITORS]?: string[];
|
|
15
|
+
[EFilterField.TRAFFIC_SOURCES]?: string[];
|
|
16
|
+
[EFilterField.VERSIONS]?: string[];
|
|
17
|
+
[EFilterField.LIST_PAGE]?: string[];
|
|
18
|
+
[EFilterField.GROUP_CAMPAIGN_ITEMS]?: string[];
|
|
19
|
+
[EFilterField.GROUP_CAMPAIGN]?: string[];
|
|
20
|
+
[EOperatorField.DEVICE_OPERATOR]?: string;
|
|
21
|
+
[EOperatorField.VISITOR_OPERATOR]?: string;
|
|
22
|
+
[EOperatorField.TRAFFIC_SOURCE_OPERATOR]?: string;
|
|
23
|
+
[EOperatorField.VERSION_OPERATOR]?: string;
|
|
24
|
+
[EOperatorField.PAGE_OPERATOR]?: string;
|
|
25
|
+
[EOperatorField.CAMPAIGN_ITEM_OPERATOR]?: string;
|
|
26
|
+
};
|
|
27
|
+
export type GemXQlOverrideFilters = GemXQlFilters;
|
|
28
|
+
export type GemXQlVersionIds = Record<string, string | undefined>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls which totals columns are appended to the query result.
|
|
3
|
+
*
|
|
4
|
+
* - NONE → no totals, GROUP BY only.
|
|
5
|
+
* - TOTALS → adds `<metric>___totals` (grand total only). Use with single-dimension GROUP BY.
|
|
6
|
+
* - ALL → adds subtotals per dimension group + grand total. Use with multi-dimension GROUP BY.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum EGroupWithClause {
|
|
9
|
+
NONE = "",
|
|
10
|
+
TOTALS = "TOTALS",
|
|
11
|
+
ALL = "WITH GROUP_TOTALS, TOTALS"
|
|
12
|
+
}
|