Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporting packages #12

Merged
merged 68 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
cc1e711
Remove export-types-helpers-public
tsullivan Nov 9, 2023
2ecb175
new common packages for reporting export tyeps
tsullivan Nov 9, 2023
cf1f4f8
export type packages
kibanamachine Nov 9, 2023
be3dce6
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 9, 2023
37fb05d
reset optimizer limits
tsullivan Nov 9, 2023
e70c54f
reset reporting/tsconfig.json
tsullivan Nov 9, 2023
eac8bfb
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Nov 9, 2023
e9ab730
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 9, 2023
398b093
fix jest configs
tsullivan Nov 9, 2023
de6e840
remove export-types-deprecated
tsullivan Nov 9, 2023
742361b
update imports
tsullivan Nov 9, 2023
a9aa152
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 9, 2023
5035436
Remove generate-csv-types package
tsullivan Nov 9, 2023
f00da03
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Nov 9, 2023
1aa5386
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 9, 2023
c6b0cee
polish
tsullivan Nov 9, 2023
684dfa2
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 9, 2023
4811006
polish
tsullivan Nov 9, 2023
515aefb
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Nov 9, 2023
beb762a
polish
tsullivan Nov 9, 2023
af559eb
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 9, 2023
f4f9f5e
polish
tsullivan Nov 9, 2023
a7ecae6
server setup contract rename
tsullivan Nov 9, 2023
b7c5256
fix ts
tsullivan Nov 9, 2023
06c06e8
remove export-type consts out of reporting
tsullivan Nov 10, 2023
17e9908
polish
tsullivan Nov 10, 2023
3e2ae5c
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
57dbac3
Move ReportingRequestHandlerContext to packages
tsullivan Nov 10, 2023
9be95e1
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 10, 2023
7bde9ae
polish
tsullivan Nov 10, 2023
a28c508
Break circular chain
tsullivan Nov 10, 2023
99ac7cf
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
7e73ae6
polish
tsullivan Nov 10, 2023
ad31635
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 10, 2023
d574361
polish
tsullivan Nov 10, 2023
4a58ae4
fix jest config
tsullivan Nov 10, 2023
c9149d0
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
dfceaec
move tests
tsullivan Nov 10, 2023
fdf246a
add server mocks package
tsullivan Nov 10, 2023
290397e
Update cool config mock
tsullivan Nov 10, 2023
0499ad9
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 10, 2023
57e8b69
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
f98b337
fix snake_case
tsullivan Nov 10, 2023
6627b84
fix job test
tsullivan Nov 10, 2023
c5e93e6
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Nov 10, 2023
782ac32
Fix bug
tsullivan Nov 10, 2023
9d85386
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 10, 2023
364f584
polish
tsullivan Nov 10, 2023
2889b58
polish
tsullivan Nov 10, 2023
d9108b8
consolidate ReportingRequestHandlerContext into x-pack/plugins/reporting
tsullivan Nov 10, 2023
cb3fff4
config_server
tsullivan Nov 10, 2023
b488dca
consolidate ReportingConfigType
tsullivan Nov 10, 2023
3a58d75
move get_full_redirect_app_url to server
tsullivan Nov 10, 2023
e1e1945
consolidate createMockConfigSchema
tsullivan Nov 10, 2023
1bf435c
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
5969b79
more fixes for createMockConfigSchema
tsullivan Nov 10, 2023
71933dc
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 10, 2023
d05951c
fix ts
tsullivan Nov 10, 2023
35b7f79
polish
tsullivan Nov 10, 2023
2c229fd
clean up ReportingServerPluginSetup
tsullivan Nov 10, 2023
b900596
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Nov 10, 2023
cb96783
fix ts
tsullivan Nov 10, 2023
2e06f83
Merge branch 'reporting-packages' of github.com:tsullivan/kibana into…
tsullivan Nov 10, 2023
2ade308
fix more ts
tsullivan Nov 10, 2023
c1dd73b
polish
tsullivan Nov 10, 2023
3cd8401
fix ts
tsullivan Nov 10, 2023
ac38635
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
ce671f1
Merge branch 'reporting-packages' into reporting-packages
rshen91 Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ x-pack/examples/gen_ai_streaming_response_example @elastic/response-ops
packages/kbn-generate @elastic/kibana-operations
packages/kbn-generate-console-definitions @elastic/platform-deployment-management
packages/kbn-generate-csv @elastic/appex-sharedux
packages/kbn-generate-csv-types @elastic/appex-sharedux
packages/kbn-get-repo-files @elastic/kibana-operations
x-pack/plugins/global_search_bar @elastic/appex-sharedux
x-pack/plugins/global_search @elastic/appex-sharedux
Expand Down Expand Up @@ -589,14 +588,17 @@ packages/kbn-repo-path @elastic/kibana-operations
packages/kbn-repo-source-classifier @elastic/kibana-operations
packages/kbn-repo-source-classifier-cli @elastic/kibana-operations
packages/kbn-reporting/common @elastic/appex-sharedux
packages/kbn-reporting/config_server @elastic/appex-sharedux
x-pack/examples/reporting_example @elastic/appex-sharedux
packages/kbn-reporting/export_types/csv @elastic/appex-sharedux
packages/kbn-reporting/export_types/deprecated @elastic/appex-sharedux
packages/kbn-reporting/export_types_helpers_public @elastic/appex-sharedux
packages/kbn-reporting/export_types_helpers_server @elastic/appex-sharedux
packages/kbn-reporting/export_types/printable_pdf_v2 @elastic/appex-sharedux
packages/kbn-reporting/export_types/csv_common @elastic/appex-sharedux
packages/kbn-reporting/export_types/pdf @elastic/appex-sharedux
packages/kbn-reporting/export_types/pdf_common @elastic/appex-sharedux
packages/kbn-reporting/export_types/png @elastic/appex-sharedux
packages/kbn-reporting/export_types/png_common @elastic/appex-sharedux
packages/kbn-reporting/mocks_server @elastic/appex-sharedux
x-pack/plugins/reporting @elastic/appex-sharedux
packages/kbn-reporting/server @elastic/appex-sharedux
packages/kbn-resizable-layout @elastic/kibana-data-discovery
examples/resizable_layout_examples @elastic/kibana-data-discovery
x-pack/test/plugin_functional/plugins/resolver_test @elastic/security-solution
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@
"@kbn/gen-ai-streaming-response-example-plugin": "link:x-pack/examples/gen_ai_streaming_response_example",
"@kbn/generate-console-definitions": "link:packages/kbn-generate-console-definitions",
"@kbn/generate-csv": "link:packages/kbn-generate-csv",
"@kbn/generate-csv-types": "link:packages/kbn-generate-csv-types",
"@kbn/global-search-bar-plugin": "link:x-pack/plugins/global_search_bar",
"@kbn/global-search-plugin": "link:x-pack/plugins/global_search",
"@kbn/global-search-providers-plugin": "link:x-pack/plugins/global_search_providers",
Expand Down Expand Up @@ -594,14 +593,17 @@
"@kbn/repo-info": "link:packages/kbn-repo-info",
"@kbn/repo-packages": "link:packages/kbn-repo-packages",
"@kbn/reporting-common": "link:packages/kbn-reporting/common",
"@kbn/reporting-config-server": "link:packages/kbn-reporting/config_server",
"@kbn/reporting-example-plugin": "link:x-pack/examples/reporting_example",
"@kbn/reporting-export-types-csv": "link:packages/kbn-reporting/export_types/csv",
"@kbn/reporting-export-types-deprecated": "link:packages/kbn-reporting/export_types/deprecated",
"@kbn/reporting-export-types-helpers-public": "link:packages/kbn-reporting/export_types_helpers_public",
"@kbn/reporting-export-types-helpers-server": "link:packages/kbn-reporting/export_types_helpers_server",
"@kbn/reporting-export-types-pdf": "link:packages/kbn-reporting/export_types/printable_pdf_v2",
"@kbn/reporting-export-types-csv-common": "link:packages/kbn-reporting/export_types/csv_common",
"@kbn/reporting-export-types-pdf": "link:packages/kbn-reporting/export_types/pdf",
"@kbn/reporting-export-types-pdf-common": "link:packages/kbn-reporting/export_types/pdf_common",
"@kbn/reporting-export-types-png": "link:packages/kbn-reporting/export_types/png",
"@kbn/reporting-export-types-png-common": "link:packages/kbn-reporting/export_types/png_common",
"@kbn/reporting-mocks-server": "link:packages/kbn-reporting/mocks_server",
"@kbn/reporting-plugin": "link:x-pack/plugins/reporting",
"@kbn/reporting-server": "link:packages/kbn-reporting/server",
"@kbn/resizable-layout": "link:packages/kbn-resizable-layout",
"@kbn/resizable-layout-examples-plugin": "link:examples/resizable_layout_examples",
"@kbn/resolver-test-plugin": "link:x-pack/test/plugin_functional/plugins/resolver_test",
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-generate-csv-types/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions packages/kbn-generate-csv-types/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/kbn-generate-csv/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* Side Public License, v 1.
*/

/**
* These can not be imported from reporting-common due to potential for circular dependency
*/
export const CSV_BOM_CHARS = '\ufeff';
export const CONTENT_TYPE_CSV = 'text/csv';
export const UI_SETTINGS_CSV_SEPARATOR = 'csv:separator';
Expand Down
52 changes: 27 additions & 25 deletions packages/kbn-generate-csv/src/generate_csv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,24 @@ import { searchSourceInstanceMock } from '@kbn/data-plugin/common/search/search_
import { IScopedSearchClient } from '@kbn/data-plugin/server';
import { dataPluginMock } from '@kbn/data-plugin/server/mocks';
import { FieldFormatsRegistry } from '@kbn/field-formats-plugin/common';
import { CsvConfig, JobParams } from '@kbn/generate-csv-types';
import { CancellationToken } from '@kbn/reporting-common';
import { ReportingConfigType } from '@kbn/reporting-config-server';
import { JobParamsCSV } from '@kbn/reporting-export-types-csv-common';
import {
UI_SETTINGS_CSV_QUOTE_VALUES,
UI_SETTINGS_CSV_SEPARATOR,
UI_SETTINGS_DATEFORMAT_TZ,
} from './constants';
import { CsvGenerator } from './generate_csv';

const createMockJob = (baseObj: any = {}): JobParams => ({
const createMockJob = (baseObj: any = {}): JobParamsCSV => ({
...baseObj,
});

const createMockCancellationToken = () => new CancellationToken();

describe('CsvGenerator', () => {
let mockEsClient: IScopedClusterClient;
let mockDataClient: IScopedSearchClient;
let mockConfig: CsvConfig;
let mockConfig: ReportingConfigType['csv'];
let mockLogger: jest.Mocked<Logger>;
let uiSettingsClient: IUiSettingsClient;
let stream: jest.Mocked<Writable>;
Expand Down Expand Up @@ -118,6 +117,7 @@ describe('CsvGenerator', () => {
maxSizeBytes: 180000,
useByteOrderMarkEncoding: false,
scroll: { size: 500, duration: '30s' },
enablePanelActionDownload: true,
};

searchSourceMock.getField = jest.fn((key: string) => {
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand All @@ -244,6 +244,7 @@ describe('CsvGenerator', () => {
maxSizeBytes: TEST_MAX_SIZE,
useByteOrderMarkEncoding: false,
scroll: { size: 500, duration: '30s' },
enablePanelActionDownload: true,
};

mockDataClient.search = jest.fn().mockImplementation(() =>
Expand Down Expand Up @@ -275,7 +276,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -334,7 +335,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -404,7 +405,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -442,7 +443,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -489,7 +490,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -543,7 +544,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -585,7 +586,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -623,7 +624,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -661,7 +662,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -701,7 +702,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -739,7 +740,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand All @@ -757,6 +758,7 @@ describe('CsvGenerator', () => {
maxSizeBytes: 180000,
useByteOrderMarkEncoding: false,
scroll: { size: 500, duration: '30s' },
enablePanelActionDownload: true,
};
mockDataClient.search = jest.fn().mockImplementation(() =>
Rx.of({
Expand Down Expand Up @@ -784,7 +786,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -813,7 +815,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -871,7 +873,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -915,7 +917,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -964,7 +966,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down Expand Up @@ -1023,7 +1025,7 @@ describe('CsvGenerator', () => {
searchSourceStart: mockSearchSourceService,
fieldFormatsRegistry: mockFieldFormatsRegistry,
},
createMockCancellationToken(),
new CancellationToken(),
mockLogger,
stream
);
Expand Down
9 changes: 5 additions & 4 deletions packages/kbn-generate-csv/src/generate_csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import type {
FieldFormatConfig,
IFieldFormatsRegistry,
} from '@kbn/field-formats-plugin/common';
import { CsvConfig, JobParams } from '@kbn/generate-csv-types';
import type { TaskRunResult } from '@kbn/reporting-common/types';
import {
AuthenticationExpiredError,
CancellationToken,
ReportingError,
byteSizeValueToNumber,
} from '@kbn/reporting-common';
import type { TaskRunResult } from '@kbn/reporting-common/types';
import { ReportingConfigType } from '@kbn/reporting-config-server';
import { JobParamsCSV } from '@kbn/reporting-export-types-csv-common';

import { CONTENT_TYPE_CSV } from './constants';
import { CsvExportSettings, getExportSettings } from './get_export_settings';
Expand All @@ -51,8 +52,8 @@ export class CsvGenerator {
private csvRowCount = 0;

constructor(
private job: Omit<JobParams, 'version'>,
private config: CsvConfig,
private job: Omit<JobParamsCSV, 'version'>,
private config: ReportingConfigType['csv'],
private clients: Clients,
private dependencies: Dependencies,
private cancellationToken: CancellationToken,
Expand Down
Loading
Loading