@bluecopa/core 0.1.14 → 0.1.16

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.
@@ -0,0 +1,47 @@
1
+ import { LineFilterOverride } from '../../../models/src/lib/ui-models/reportModel';
2
+ export type StatementInputsType = {
3
+ inputs: {
4
+ global_date_col_filter?: unknown;
5
+ global_to_currency?: string;
6
+ global_time_bin?: string;
7
+ bin_order_by_desc?: string;
8
+ };
9
+ line_inputs: Record<string, unknown>;
10
+ };
11
+ export type StatementRunOptions = {
12
+ workflowId: string;
13
+ runId: string;
14
+ name?: string;
15
+ runInputs?: unknown;
16
+ customFields?: Record<string, unknown>;
17
+ };
18
+ export type StatementResultOptions = {
19
+ runId: string;
20
+ includeData?: boolean;
21
+ };
22
+ export type StatementPromotedFiltersType = {
23
+ name: string;
24
+ filterType: "promoted";
25
+ column: string;
26
+ values: string[];
27
+ lineIds: string[];
28
+ sheetId: string;
29
+ datasetId: string;
30
+ datasetName: string;
31
+ };
32
+ export type StatementCommonFiltersType = {
33
+ name: string;
34
+ filterType: "common";
35
+ column: string;
36
+ values: string[];
37
+ linesToApply: {
38
+ lineId: string;
39
+ column: string;
40
+ }[];
41
+ sheetId: string;
42
+ datasetId: string;
43
+ datasetName: string;
44
+ };
45
+ export type StatementRunInputs = {
46
+ [lineName: string]: LineFilterOverride | LineFilterOverride[];
47
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Fancy ID generator that creates 20-character string identifiers with the following properties:
3
+ *
4
+ * 1. They're based on timestamp so that they sort *after* any existing ids.
5
+ * 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
6
+ * 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
7
+ * 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
8
+ * latter ones will sort after the former ones. We do this by using the previous random bits
9
+ * but "incrementing" them by 1 (only in the case of a timestamp collision).
10
+ */
11
+ export declare const generatePushID: () => string;
@@ -0,0 +1 @@
1
+ export declare const getUniqueDuplicateName: (name: string, collectionToCheckIn: string[], suffix?: string, concatChar?: string) => string;
@@ -2,3 +2,8 @@ export * from './date';
2
2
  export { getMetricDefinition } from './metric/getMetricDefinition';
3
3
  export * as inputTableUtils from './inputTable/inputTableDefinition';
4
4
  export * as websocketUtils from './websockets/websocketProviderFactory';
5
+ export * as statementFilterUtils from './statement/filterUtils';
6
+ export * as statementFilterConverters from './statement/filterConverters';
7
+ export { hydrateStatement } from './statement/hydrateStatement';
8
+ export { generatePushID } from './common/generatePushId';
9
+ export { getUniqueDuplicateName } from './common/generateRandomName';
@@ -26,7 +26,7 @@ export declare const generateDefinitionModel: ({ filters, sort, metricSeries, ta
26
26
  definition: InputTableDefinitionModel;
27
27
  };
28
28
  export declare const sortConfigFromValue: (sortBy: SortOptions) => {
29
- [x: number]: string;
29
+ [x: number]: any;
30
30
  };
31
31
  export declare const getMetricSeries: (props: {
32
32
  pivotCols: string[];
@@ -2,7 +2,7 @@ import { DatasetImportMetadata } from '../../../../models/src/lib/gen/Api';
2
2
  import { SelectOptionType } from '../../../../models/src/lib/types/selectType';
3
3
  import { DateRange } from '../../../../models/src/lib/ui-models/dateRangeModel';
4
4
  import { ProjectFractionEnum, Definition, Import, Inputs, TimeBin, Variable } from '../../../../models/src/lib/ui-models/definitionModel';
5
- import { CommonFilter, FilterPanelStoreType, FilterRule, FilterSelectOptionsType, FilterUniqueValueSelectOptionsType, RuleType } from '../../../../models/src/lib/ui-models/filterModel';
5
+ import { CommonFilter, FilterPanelStoreType, FilterRule, FilterSelectOptionsType, RuleType } from '../../../../models/src/lib/ui-models/filterModel';
6
6
  import { CustomCalculationShowAsEnum, ShowAsEnum, WorkbookCustomModel, ColumnSetting, GridColumnState, MetricCustomModel, MetricMetadataType, PivotCustomModel, Sheet, SortOptions, ValueColsType, LimitOptions, RowGroupsType } from '../../../../models/src/lib/ui-models/workbookModel';
7
7
  export type MetricToolPanelType = {
8
8
  pivotCols: string[];
@@ -32,22 +32,7 @@ export declare const getPivotGridData: (props: {
32
32
  export declare const replaceFilterColumn: (props: {
33
33
  fr: FilterSelectOptionsType[];
34
34
  column: SelectOptionType<ColumnSetting>;
35
- }) => {
36
- label: string;
37
- value: any;
38
- selectable?: boolean;
39
- group?: string;
40
- hint?: string;
41
- option: {
42
- aggFun?: string;
43
- uniqueValues: FilterUniqueValueSelectOptionsType[];
44
- ruleType: RuleType;
45
- type: string;
46
- uniqueValueCount: number;
47
- datasetId?: string;
48
- datasetName?: string;
49
- };
50
- }[];
35
+ }) => any;
51
36
  export declare const mergeCommonFilters: (props: {
52
37
  commonFilters: CommonFilter[];
53
38
  rule: FilterSelectOptionsType[];
@@ -55,7 +40,7 @@ export declare const mergeCommonFilters: (props: {
55
40
  lineId: string;
56
41
  }) => {
57
42
  defaultType: RuleType;
58
- rules: FilterSelectOptionsType[];
43
+ rules: any;
59
44
  };
60
45
  export declare const getUniqueValues: (column: string[], sheetDetails?: {
61
46
  sheetId: string;
@@ -239,7 +224,7 @@ export declare const getValueGroupsSelectOptions: (props: {
239
224
  option: {
240
225
  formulaMode: boolean;
241
226
  aggFun: string;
242
- fieldLabel: string;
227
+ fieldLabel: any;
243
228
  impact: "positive" | "negative";
244
229
  type: ValueColsType["type"];
245
230
  currency: import('../../../../models/src/lib/common/localeUtils').NewCurrencyType;
@@ -286,19 +271,7 @@ export declare const getNewMetricSheet: (props: {
286
271
  metadata: import('../../../../models/src/lib/ui-models/dashboardModel').BlockMetadataType;
287
272
  settings: import('../../../../models/src/lib/ui-models/dashboardModel').BlockSettingsType;
288
273
  }>>;
289
- export declare const getColumnSettingsToSelectOptions: (columnSettings: ColumnSetting[]) => {
290
- label: string;
291
- value: string;
292
- option: {
293
- type: "date" | "str" | "f64" | "i64" | "datetime(time_unit='us', time_zone=None)";
294
- uniqueCount: number;
295
- fieldLabel: string;
296
- currency: import('../../../../models/src/lib/common/localeUtils').NewCurrencyType;
297
- precision: number;
298
- dateFormat: string;
299
- isCurrency: boolean;
300
- };
301
- }[];
274
+ export declare const getColumnSettingsToSelectOptions: (columnSettings: ColumnSetting[]) => any;
302
275
  export declare const getDefinitionModelWithUpdatedValueCols: (props: {
303
276
  definition: Definition;
304
277
  valueCols: ValueColsType[];
@@ -329,7 +302,7 @@ export declare const applyFilter: (props: {
329
302
  }) => Promise<any[]>;
330
303
  export declare const defaultFilterRule: FilterRule;
331
304
  export declare const getPromotedFiltersSelectOptionsForLine: (metricSheet: Sheet<MetricCustomModel>) => SelectOptionType[];
332
- export declare const getAllLinesFilterSelectOptions: (metricSheets: Sheet<MetricCustomModel>[]) => SelectOptionType<any>[];
305
+ export declare const getAllLinesFilterSelectOptions: (metricSheets: Sheet<MetricCustomModel>[]) => any;
333
306
  export declare function formatDate(date: any): string;
334
307
  export declare const getQuarterDates: (props: {
335
308
  month: number;
@@ -420,7 +393,7 @@ export declare const checkIfCurrencyFormula: (props: {
420
393
  formula: string;
421
394
  columns: any;
422
395
  }) => boolean;
423
- export declare const getProjectAsInput: (valueCols: ValueColsType[]) => Record<string, ProjectFractionEnum>;
396
+ export declare const getProjectAsInput: (valueCols: ValueColsType[]) => any;
424
397
  export declare const getUpdatedDefinitionCustomModel: (props: {
425
398
  metricDefinitionModel: Definition;
426
399
  parentDefinitionModel: Definition;
@@ -448,4 +421,4 @@ export declare const timeBinToIntervalMapper: {
448
421
  export declare const mapValueColsWithTrends: (props: {
449
422
  valueCols: ValueColsType[];
450
423
  compareTrends: PivotCustomModel["compareTrends"];
451
- }) => ValueColsType[];
424
+ }) => any;
@@ -18,4 +18,4 @@ export declare const getFilterRulesFromFilterSelectOptionsMap: (filterSelectOpti
18
18
  };
19
19
  export declare const getColumnFilterRuleFromCombinedFilterRule: (combinedFilterRule: FilterRule, valueCols: ValueColsType[]) => FilterRule;
20
20
  export declare const getAggregateFilterRuleFromCombinedFilterRule: (combinedFilterRule: FilterRule, valueCols: ValueColsType[]) => FilterRule;
21
- export declare const getIsNotValueForPredicateType: (predicateType: Operator) => boolean;
21
+ export declare const getIsNotValueForPredicateType: (predicateType: Operator) => any;
@@ -23,6 +23,6 @@ export declare const getMetricDefinition: (props: {
23
23
  };
24
24
  export declare const getSelectedMetricsParentIds: (selectedItems: {
25
25
  sheet: Worksheet;
26
- }[]) => string[];
26
+ }[]) => any;
27
27
  export declare const defaultDashboardDateRangeModel: DashboardDateRangeModel;
28
28
  export declare const defaultCurrencyModel: BoardCurrencyModel;
@@ -0,0 +1,11 @@
1
+ import { Workbook } from '../../../../models/src/lib/gen/Api';
2
+ import { CommonFilter, PromotedFiltersType, FilterRule } from '../../../../models/src/lib/ui-models/filterModel';
3
+ import { StatementCommonFiltersType, StatementPromotedFiltersType } from '../../types/statement';
4
+ export declare const defaultFilterRule: FilterRule;
5
+ export declare const createFilterRuleFromValues: (column: string, values: unknown[]) => FilterRule;
6
+ export declare const convertToPromotedFilter: (statementFilter: StatementPromotedFiltersType, statement: Workbook) => PromotedFiltersType | null;
7
+ export declare const convertToCommonFilter: (statementFilter: StatementCommonFiltersType, statement: Workbook) => Promise<CommonFilter | null>;
8
+ export declare const convertStatementFiltersToFullTypes: (promotedFilters: StatementPromotedFiltersType[], commonFilters: StatementCommonFiltersType[], statement: Workbook) => Promise<{
9
+ promotedFilters: PromotedFiltersType[];
10
+ commonFilters: CommonFilter[];
11
+ }>;
@@ -0,0 +1,14 @@
1
+ import { ReportCustomModel } from '../../../../models/src/lib/ui-models/reportModel';
2
+ import { Sheet } from '../../../../models/src/lib/ui-models/workbookModel';
3
+ import { StatementCommonFiltersType, StatementPromotedFiltersType, StatementRunInputs } from '../../types/statement';
4
+ /**
5
+ * Converts promoted and common filters into runInputs format for statement views
6
+ */
7
+ export declare const convertFiltersToRunInputs: (promotedFilters: StatementPromotedFiltersType[], commonFilters: StatementCommonFiltersType[], statementSheet: Sheet<ReportCustomModel>) => StatementRunInputs;
8
+ /**
9
+ * Separates columnFilters into promoted and common filters
10
+ */
11
+ export declare const separateColumnFilters: (columnFilters: (StatementPromotedFiltersType | StatementCommonFiltersType)[]) => {
12
+ promotedFilters: StatementPromotedFiltersType[];
13
+ commonFilters: StatementCommonFiltersType[];
14
+ };
@@ -0,0 +1,7 @@
1
+ import { Workbook } from '../../../../models/src/lib/gen/Api';
2
+ import { WorkbookModel } from '../../../../models/src/lib/ui-models/workbookModel';
3
+ /**
4
+ * Hydrates a statement workbook by fetching and assigning definition and custom models
5
+ * to all sheets (STATEMENT_SHEET, PIVOT, PLAN)
6
+ */
7
+ export declare const hydrateStatement: (workbook: Workbook) => Promise<Partial<WorkbookModel>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluecopa/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "5.9.2",
24
- "vite": "5.4.20",
24
+ "vite": "5.4.21",
25
25
  "vite-plugin-dts": "4.5.4"
26
26
  },
27
27
  "author": "Bluecopa",