@dpuse/dpuse-shared 1.0.206 → 1.0.208

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.
@@ -1,8 +1,8 @@
1
1
  import { BaseConfig } from '../../index';
2
+ import { ComponentInstanceConfig } from '..';
2
3
  import { ConnectorConfig } from '../module/connector';
3
4
  import { LocaleLabel } from '../../locale/label';
4
5
  import { LocalisedConfig } from '../../locale';
5
- import { ComponentInstanceConfig } from '..';
6
6
  import { DataSubtypeId, DataTypeId } from '../dataView';
7
7
  export interface ConnectionConfig extends ComponentInstanceConfig {
8
8
  typeId: 'connectorConnection';
@@ -13,16 +13,21 @@ export interface DataViewConfig extends ComponentInstanceConfig {
13
13
  }
14
14
  export interface ReadingConfig {
15
15
  dataFormatId: DataFormatId;
16
+ dataFormatSourceId?: DataFormatSourceId | undefined;
16
17
  encodingConfidenceLevel: number | undefined;
17
18
  encodingId: string | undefined;
19
+ encodingSourceId?: EncodingSourceId | undefined;
18
20
  fileType: FileTypeResult | undefined;
19
21
  hasHeaders: boolean | undefined;
20
22
  isDeclared?: boolean | undefined;
21
23
  parserId: string | undefined;
22
24
  recordDelimiterId: RecordDelimiterId | undefined;
25
+ replacementCharacterCount?: number | undefined;
23
26
  valueDelimiterId: ValueDelimiterId | undefined;
24
27
  }
25
28
  export type DataFormatId = (typeof DATA_FORMAT_CONFIGS)[number]['id'];
29
+ export type DataFormatSourceId = 'choice' | 'fileContent' | 'jsonSyntax' | 'mimeType' | 'extension' | 'default';
30
+ export type EncodingSourceId = 'choice' | 'byteOrderMark' | 'xmlDeclaration' | 'xmlDefault' | 'utf8Validation' | 'detection' | 'asciiAssumption' | 'fallback';
26
31
  export type RecordDelimiterId = '\n' | '\r' | '\r\n';
27
32
  export type ValueDelimiterId = (typeof VALUE_DELIMITER_CONFIGS)[number]['id'] | '';
28
33
  export interface SampleConfig {
@@ -1,4 +1,5 @@
1
1
  import { InferOutput } from 'valibot';
2
+ import { EncodingDetectionConfig } from '../../../encoding';
2
3
  import { EngineConnectorActionOptions } from '../engine';
3
4
  import { LocalisedConfig } from '../../../locale';
4
5
  import { ToolConfig } from '../tool';
@@ -152,6 +153,7 @@ export interface PreviewObjectResult {
152
153
  contentAuditConfig: ContentAuditConfig;
153
154
  sampleConfig: SampleConfig;
154
155
  readingConfig: ReadingConfig;
156
+ encodingCandidates?: EncodingDetectionConfig[] | undefined;
155
157
  }
156
158
  export interface QueryRecordsOptions extends EngineConnectorActionOptions {
157
159
  aggregates: QueryAggregate[];
@@ -228,7 +230,7 @@ export interface UpsertRecordsOptions extends EngineConnectorActionOptions {
228
230
  path: string;
229
231
  }
230
232
  export type ConnectorUsageId = InferOutput<typeof connectorUsageIdSchema>;
231
- export { auditObjectContentWithParser, buildPreviewObjectResult, type ObjectFilePreview, retrieveRecordsWithParser } from './objectParsing';
233
+ export { auditObjectContentWithParser, buildPreviewObjectResult, retrieveRecordsWithParser } from './objectParsing';
232
234
  export { readTableSchema } from './tableSchema';
233
235
  export declare function determineConnectorUsageId(actionNames: ConnectorActionName[]): ConnectorUsageId;
234
236
  export declare const constructConnectorCategoryConfig: (id: string, localeId?: import('../../../locale').LocaleId) => LocalisedConfig<ConnectorCategoryConfig>;
@@ -1,21 +1,11 @@
1
- import { FileTypeResult } from 'file-type';
2
1
  import { AuditObjectContentOptions, AuditObjectContentResult, ConnectorUtilities, PreviewObjectResult, RecordRetrievalTypeId, RetrieveRecordsOptions, RetrieveRecordsSummary } from '.';
3
- import { DataFormatId, DeclaredColumnConfig, DeclaredReadingConfig, ParsedRecord, ValueDelimiterId } from '../../dataView';
4
- import { ToolConfig } from '../tool';
5
- export interface ObjectFilePreview {
6
- bytes: Uint8Array;
7
- dataFormatId: DataFormatId | undefined;
8
- encodingConfidenceLevel: number | undefined;
9
- encodingId: string | undefined;
10
- fileTypeConfig: FileTypeResult | undefined;
11
- isComplete: boolean;
12
- text: string | undefined;
13
- }
2
+ import { DeclaredColumnConfig, DeclaredReadingConfig, ParsedRecord, ValueDelimiterId } from '../../dataView';
3
+ import { FilePreviewResult, ToolConfig } from '../tool';
14
4
  export declare function buildPreviewObjectResult(input: {
15
5
  asAt: number;
16
6
  declaredColumnConfigs?: DeclaredColumnConfig[] | undefined;
17
7
  declaredReadingConfig?: DeclaredReadingConfig | undefined;
18
- filePreview: ObjectFilePreview;
8
+ filePreview: FilePreviewResult;
19
9
  inferDataTypes: ConnectorUtilities['inferDataTypes'];
20
10
  parserId: string | undefined;
21
11
  startedAt: number;
@@ -0,0 +1,23 @@
1
+ import { FileTypeResult } from 'file-type';
2
+ import { EncodingDetectionConfig } from '../../../encoding';
3
+ import { DataFormatId, DataFormatSourceId, EncodingSourceId } from '../../dataView';
4
+ export interface FilePreviewerInterface {
5
+ previewFile: (url: string, signal: AbortSignal, chunkSize?: number, mimeType?: string, choices?: PreviewChoices) => Promise<FilePreviewResult>;
6
+ }
7
+ export interface PreviewChoices {
8
+ dataFormatId: DataFormatId | undefined;
9
+ encodingId: string | undefined;
10
+ }
11
+ export interface FilePreviewResult {
12
+ bytes: Uint8Array;
13
+ dataFormatId: DataFormatId | undefined;
14
+ dataFormatSourceId: DataFormatSourceId | undefined;
15
+ encodingId: string | undefined;
16
+ encodingConfidenceLevel: number | undefined;
17
+ encodingSourceId: EncodingSourceId | undefined;
18
+ encodingCandidates: EncodingDetectionConfig[] | undefined;
19
+ replacementCharacterCount: number | undefined;
20
+ fileTypeConfig: FileTypeResult | undefined;
21
+ isComplete: boolean;
22
+ text: string | undefined;
23
+ }
@@ -4,6 +4,7 @@ import { parserConfigSchema, toolConfigSchema } from './toolConfig.schema';
4
4
  export { toolConfigSchema } from './toolConfig.schema';
5
5
  export type ToolConfig = InferOutput<typeof toolConfigSchema>;
6
6
  export type ParserConfig = InferOutput<typeof parserConfigSchema>;
7
+ export type { FilePreviewerInterface, FilePreviewResult, PreviewChoices } from './filePreviewer';
7
8
  export type { ParserInterface, ParseStreamOptions, ParseTextOptions, ParseTextResult } from './parser';
8
9
  export { parseDelimitedText, type ParseTextWithDelimiter } from './delimitedText';
9
10
  export declare const TOOL_NAME_PREFIX = "dpuse-tool-";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpuse/dpuse-shared",
3
- "version": "1.0.206",
3
+ "version": "1.0.208",
4
4
  "private": false,
5
5
  "description": "Common constants, types and utilities used across DPUse projects.",
6
6
  "license": "MIT",
@@ -76,7 +76,7 @@
76
76
  "prettier": "^3.9.10",
77
77
  "sonda": "^0.14.0",
78
78
  "typescript": "^6.0.3",
79
- "vite": "^8.3.7",
79
+ "vite": "^8.3.8",
80
80
  "vite-plugin-dts": "^5.1.2",
81
81
  "vitest": "^5.1.0"
82
82
  }