@expresscsv/sdk 0.1.25 → 1.0.0
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/README.md +47 -41
- package/dist/index.d.cts +255 -119
- package/dist/index.d.mts +255 -119
- package/dist/index.d.ts +255 -119
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,11 +4,60 @@ declare interface BICOptions {
|
|
|
4
4
|
|
|
5
5
|
declare type BooleanControlType = 'toggle' | 'checkbox' | 'dropdown';
|
|
6
6
|
|
|
7
|
+
export declare type ChunkSize = {
|
|
8
|
+
/** Size quota unit. */
|
|
9
|
+
unit: 'kb';
|
|
10
|
+
/** KB quota. Values <= 0 send all rows in one chunk. */
|
|
11
|
+
value: number;
|
|
12
|
+
} | {
|
|
13
|
+
/** Chunk by row count. */
|
|
14
|
+
unit: 'rows';
|
|
15
|
+
/** Rows per chunk. Values <= 0 send all rows in one chunk. */
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* Color mode preference
|
|
9
21
|
*/
|
|
10
22
|
export declare type ColorModePref = 'light' | 'dark' | 'system';
|
|
11
23
|
|
|
24
|
+
export declare interface ColumnMatch<TTargetField extends string = string> {
|
|
25
|
+
sourceColumnIndex: number;
|
|
26
|
+
targetField: TTargetField;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare type ColumnMatchHandler<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ColumnMatchingFn<SchemaFieldName<TSchema>>;
|
|
30
|
+
|
|
31
|
+
export declare type ColumnMatchHandlerResult<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ColumnMatchingResult<SchemaFieldName<TSchema>>;
|
|
32
|
+
|
|
33
|
+
export declare type ColumnMatchingFn<TTargetField extends string = string> = (data: ColumnMatchingParams) => Promise<ColumnMatchingResult<TTargetField>>;
|
|
34
|
+
|
|
35
|
+
export declare type ColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ManagedColumnMatchingOptions | CustomColumnMatchingOptions<TSchema>;
|
|
36
|
+
|
|
37
|
+
export declare interface ColumnMatchingParams {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
sourceColumns: ColumnMatchingSourceColumn[];
|
|
40
|
+
targetFields: ColumnMatchingTargetField[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export declare interface ColumnMatchingResult<TTargetField extends string = string> {
|
|
44
|
+
matches: Array<ColumnMatch<TTargetField>>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare interface ColumnMatchingSourceColumn {
|
|
48
|
+
sourceColumnIndex: number;
|
|
49
|
+
name: string;
|
|
50
|
+
sampleValues: string[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare interface ColumnMatchingTargetField {
|
|
54
|
+
name: string;
|
|
55
|
+
label?: string;
|
|
56
|
+
type: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
aliases: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
12
61
|
declare const Countries: readonly [{
|
|
13
62
|
readonly name: "Afghanistan";
|
|
14
63
|
readonly alpha2: "AF";
|
|
@@ -1242,7 +1291,7 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1242
1291
|
private connection;
|
|
1243
1292
|
private connectionState;
|
|
1244
1293
|
private debug;
|
|
1245
|
-
private
|
|
1294
|
+
private importNamespace;
|
|
1246
1295
|
private sessionId;
|
|
1247
1296
|
private currentSessionToken;
|
|
1248
1297
|
private currentSessionTokenExpiresAt;
|
|
@@ -1252,13 +1301,15 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1252
1301
|
private _beforeUnloadHandler;
|
|
1253
1302
|
private importerUrl;
|
|
1254
1303
|
private appUrl;
|
|
1255
|
-
private
|
|
1304
|
+
private status;
|
|
1256
1305
|
private importerMode;
|
|
1257
1306
|
private canRestart;
|
|
1258
1307
|
private lastError;
|
|
1259
|
-
private
|
|
1308
|
+
private statusChangeListeners;
|
|
1260
1309
|
private lastTerminalSessionState;
|
|
1261
1310
|
private openOptions;
|
|
1311
|
+
/** Mirrors the active delivery while slicing one `event:results` batch into chunks. */
|
|
1312
|
+
private deliveryIdForActiveBatch;
|
|
1262
1313
|
private cachedSchemaJson;
|
|
1263
1314
|
private initCompletePromise;
|
|
1264
1315
|
private resolveInitComplete;
|
|
@@ -1266,17 +1317,24 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1266
1317
|
private importerStartupGeneration;
|
|
1267
1318
|
constructor(options: SDKOptions<TSchema>);
|
|
1268
1319
|
private getCustomStorageRpcHandler;
|
|
1320
|
+
private getCustomFeatureRpcHandler;
|
|
1269
1321
|
/**
|
|
1270
|
-
* Enhanced
|
|
1322
|
+
* Enhanced status management
|
|
1271
1323
|
*/
|
|
1272
|
-
private
|
|
1324
|
+
private setStatus;
|
|
1273
1325
|
private updateDerivedState;
|
|
1274
1326
|
private createSessionId;
|
|
1275
1327
|
private getOrCreateSessionId;
|
|
1276
1328
|
private getImportSessionContext;
|
|
1277
|
-
private
|
|
1329
|
+
private getImportDeliveryContext;
|
|
1278
1330
|
private createRecordsChunk;
|
|
1331
|
+
private normalizeChunkSize;
|
|
1332
|
+
private getRecordsChunkByteLength;
|
|
1333
|
+
private groupResultsIntoChunks;
|
|
1334
|
+
private groupResultsByByteQuota;
|
|
1335
|
+
private buildByteQuotaChunks;
|
|
1279
1336
|
private handleError;
|
|
1337
|
+
private completeOpenLifecycleForClose;
|
|
1280
1338
|
private sendImportProgress;
|
|
1281
1339
|
private waitForEvent;
|
|
1282
1340
|
private fetchImporterSessionToken;
|
|
@@ -1293,7 +1351,7 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1293
1351
|
private sendStartupErrorToImporter;
|
|
1294
1352
|
private bootstrapImporterSession;
|
|
1295
1353
|
/**
|
|
1296
|
-
* Open the
|
|
1354
|
+
* Open the importer with chunk-based data processing.
|
|
1297
1355
|
* Automatically opens the importer if not already open.
|
|
1298
1356
|
*
|
|
1299
1357
|
* @param options Configuration including onData callback for processing chunks
|
|
@@ -1308,6 +1366,7 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1308
1366
|
* Process results in chunks, calling onData with backpressure control
|
|
1309
1367
|
*/
|
|
1310
1368
|
private processResultsInChunks;
|
|
1369
|
+
private parseImporterResultsPayload;
|
|
1311
1370
|
/**
|
|
1312
1371
|
* Initialize the iframe and connection.
|
|
1313
1372
|
* @param hidden Whether to create the iframe hidden (for preload) or visible (for normal open)
|
|
@@ -1335,21 +1394,21 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1335
1394
|
private setupMessageHandlers;
|
|
1336
1395
|
private createAndAppendIframe;
|
|
1337
1396
|
private destroy;
|
|
1338
|
-
close(reason?:
|
|
1397
|
+
close(reason?: ImporterCloseReason): Promise<void>;
|
|
1339
1398
|
private resetImporter;
|
|
1340
1399
|
restart(newOptions?: Partial<SDKOptions<TSchema>>): Promise<void>;
|
|
1341
1400
|
private handleImporterClosed;
|
|
1342
1401
|
private hideContainer;
|
|
1343
1402
|
getConnectionStatus(): boolean;
|
|
1344
|
-
|
|
1345
|
-
|
|
1403
|
+
subscribeToStatusChanges(listener: StatusChangeListener): () => void;
|
|
1404
|
+
getStatus(): ImporterStatus;
|
|
1346
1405
|
getMode(): ImporterMode;
|
|
1347
1406
|
getIsReady(): boolean;
|
|
1348
1407
|
getIsOpen(): boolean;
|
|
1349
1408
|
getCanRestart(): boolean;
|
|
1350
1409
|
getLastError(): Error | null;
|
|
1351
|
-
|
|
1352
|
-
|
|
1410
|
+
getStatusSnapshot(): {
|
|
1411
|
+
status: ImporterStatus;
|
|
1353
1412
|
mode: ImporterMode;
|
|
1354
1413
|
isReady: boolean;
|
|
1355
1414
|
isOpen: boolean;
|
|
@@ -2003,11 +2062,21 @@ declare const CurrencyCodes: readonly [{
|
|
|
2003
2062
|
readonly numeric: "932";
|
|
2004
2063
|
}];
|
|
2005
2064
|
|
|
2006
|
-
export declare type
|
|
2065
|
+
export declare type CustomColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
2007
2066
|
type: 'custom';
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2067
|
+
columnMatchHandler: ColumnMatchHandler<TSchema>;
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
export declare type CustomPromptedEditsOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
2071
|
+
type: 'custom';
|
|
2072
|
+
promptedEditHandler: PromptedEditHandler<TSchema>;
|
|
2073
|
+
};
|
|
2074
|
+
|
|
2075
|
+
export declare type CustomSessionRecoveryOptions = {
|
|
2076
|
+
type: 'custom';
|
|
2077
|
+
get: (key: SessionRecoveryKey) => Promise<RecoveredSession | null>;
|
|
2078
|
+
set: (key: SessionRecoveryKey, value: RecoveredSession) => Promise<void>;
|
|
2079
|
+
remove: (key: SessionRecoveryKey) => Promise<void>;
|
|
2011
2080
|
};
|
|
2012
2081
|
|
|
2013
2082
|
declare interface DatetimeOptions {
|
|
@@ -2018,44 +2087,6 @@ export declare type DeepPartial<T> = {
|
|
|
2018
2087
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
2019
2088
|
};
|
|
2020
2089
|
|
|
2021
|
-
export declare interface DeliveryOptions<T> {
|
|
2022
|
-
/** Callback for processing delivered chunks */
|
|
2023
|
-
onData: (chunk: RecordsChunk<T>, next: () => void) => void | Promise<void>;
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
/**
|
|
2027
|
-
* Font source configuration for custom fonts
|
|
2028
|
-
*/
|
|
2029
|
-
export declare type ECSVFontSource = {
|
|
2030
|
-
source: 'google';
|
|
2031
|
-
name: string;
|
|
2032
|
-
weights?: (number | string)[];
|
|
2033
|
-
} | {
|
|
2034
|
-
source: 'custom';
|
|
2035
|
-
url: string;
|
|
2036
|
-
format?: 'woff2' | 'woff';
|
|
2037
|
-
};
|
|
2038
|
-
|
|
2039
|
-
/**
|
|
2040
|
-
* Theme - can be either dual-mode (light/dark) or single-mode (applies to both)
|
|
2041
|
-
*/
|
|
2042
|
-
export declare type ECSVTheme = ECSVThemeWithModes | ECSVThemeSingle;
|
|
2043
|
-
|
|
2044
|
-
/**
|
|
2045
|
-
* Single theme that applies to both light and dark modes
|
|
2046
|
-
*/
|
|
2047
|
-
declare type ECSVThemeSingle = TailwindThemeVars;
|
|
2048
|
-
|
|
2049
|
-
/**
|
|
2050
|
-
* Theme with light and dark mode support
|
|
2051
|
-
*/
|
|
2052
|
-
declare interface ECSVThemeWithModes {
|
|
2053
|
-
modes: {
|
|
2054
|
-
light: TailwindThemeVars;
|
|
2055
|
-
dark: TailwindThemeVars;
|
|
2056
|
-
};
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
2090
|
export declare interface ExBaseDef {
|
|
2060
2091
|
typeName: string;
|
|
2061
2092
|
}
|
|
@@ -2950,6 +2981,8 @@ declare interface ExpressCSVLocale {
|
|
|
2950
2981
|
showAll: string;
|
|
2951
2982
|
moveUp: string;
|
|
2952
2983
|
moveDown: string;
|
|
2984
|
+
/** When the selected row has zero columns (cannot continue) */
|
|
2985
|
+
rowNotSelectable: string;
|
|
2953
2986
|
};
|
|
2954
2987
|
matchColumns: {
|
|
2955
2988
|
loading: string;
|
|
@@ -2984,6 +3017,8 @@ declare interface ExpressCSVLocale {
|
|
|
2984
3017
|
previewTooltip: string;
|
|
2985
3018
|
/** Available: {rowCount}, {columnName} */
|
|
2986
3019
|
previewShowing: TemplateString<'rowCount' | 'columnName'>;
|
|
3020
|
+
/** Available: {columnNumber} — 1-based index when the sheet header cell is empty */
|
|
3021
|
+
unnamedSourceColumn: TemplateString<'columnNumber'>;
|
|
2987
3022
|
};
|
|
2988
3023
|
matchOptions: {
|
|
2989
3024
|
loading: string;
|
|
@@ -3076,27 +3111,27 @@ declare interface ExpressCSVLocale {
|
|
|
3076
3111
|
filteredColumns: string;
|
|
3077
3112
|
unfilteredColumns: string;
|
|
3078
3113
|
columnsLabel: string;
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3114
|
+
promptedEditsTooltip: string;
|
|
3115
|
+
promptedEditsTitle: string;
|
|
3116
|
+
promptedEditsClose: string;
|
|
3117
|
+
promptedEditsCloseDiscardTooltip: string;
|
|
3118
|
+
promptedEditsCloseTooltip: string;
|
|
3119
|
+
promptedEditsError: string;
|
|
3120
|
+
promptedEditsPlaceholder: string;
|
|
3121
|
+
promptedEditsGenerating: string;
|
|
3122
|
+
promptedEditsApplying: string;
|
|
3123
|
+
promptedEditsDiscard: string;
|
|
3124
|
+
promptedEditsApply: string;
|
|
3125
|
+
promptedEditsUnappliedTitle: string;
|
|
3126
|
+
promptedEditsUnappliedDescription: string;
|
|
3127
|
+
promptedEditsKeepEditing: string;
|
|
3128
|
+
promptedEditsDiscardClose: string;
|
|
3129
|
+
promptedEditsAbortTitle: string;
|
|
3130
|
+
promptedEditsAbortDescription: string;
|
|
3131
|
+
promptedEditsAbortClose: string;
|
|
3132
|
+
promptedEditsSubmit: string;
|
|
3098
3133
|
};
|
|
3099
|
-
|
|
3134
|
+
emptyColumn: {
|
|
3100
3135
|
/** Available: {number} */
|
|
3101
3136
|
defaultName: TemplateString<'number'>;
|
|
3102
3137
|
remove: string;
|
|
@@ -3127,11 +3162,6 @@ declare interface ExpressCSVLocale {
|
|
|
3127
3162
|
/** User-facing locale type where every leaf is a plain `string`. */
|
|
3128
3163
|
export declare type ExpressCSVLocaleInput = StripBrand<ExpressCSVLocale>;
|
|
3129
3164
|
|
|
3130
|
-
/**
|
|
3131
|
-
* Core step identifiers for the CSV import wizard
|
|
3132
|
-
*/
|
|
3133
|
-
export declare type ExpressCSVStep = 'upload' | 'select-sheet' | 'select-header' | 'match-columns' | 'match-options' | 'review';
|
|
3134
|
-
|
|
3135
3165
|
declare type ExPrimitiveType = ExString | ExNumber | ExCurrencyNumber | ExPercentageNumber | ExBoolean | ExDate | ExTime | ExDatetime | ExSelect<string | number> | ExMultiselect<string | number> | ExOptionalPrimitiveType;
|
|
3136
3166
|
|
|
3137
3167
|
declare class ExRow<T extends ExRowShape> extends ExType<{
|
|
@@ -3587,6 +3617,19 @@ export declare abstract class ExType<Output, Def extends ExBaseDef, Input = Outp
|
|
|
3587
3617
|
protected _addCheck(type: string, params?: Record<string, unknown>, message?: string): ValidatorCheck;
|
|
3588
3618
|
}
|
|
3589
3619
|
|
|
3620
|
+
/**
|
|
3621
|
+
* Font source configuration for custom fonts
|
|
3622
|
+
*/
|
|
3623
|
+
export declare type FontSource = {
|
|
3624
|
+
source: 'google';
|
|
3625
|
+
name: string;
|
|
3626
|
+
weights?: (number | string)[];
|
|
3627
|
+
} | {
|
|
3628
|
+
source: 'custom';
|
|
3629
|
+
url: string;
|
|
3630
|
+
format?: 'woff2' | 'woff';
|
|
3631
|
+
};
|
|
3632
|
+
|
|
3590
3633
|
declare interface GTINOptions {
|
|
3591
3634
|
message?: string;
|
|
3592
3635
|
}
|
|
@@ -3603,6 +3646,13 @@ export declare class ImportCancelledError extends Error {
|
|
|
3603
3646
|
constructor(message?: string);
|
|
3604
3647
|
}
|
|
3605
3648
|
|
|
3649
|
+
export declare interface ImportDeliveryContext extends ImportSessionContext {
|
|
3650
|
+
/** Stable ID for the delivery attempt that completed or failed */
|
|
3651
|
+
deliveryId: string;
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3654
|
+
declare type ImporterCloseReason = 'user_close' | 'cancel' | 'complete' | 'error';
|
|
3655
|
+
|
|
3606
3656
|
/**
|
|
3607
3657
|
* Importer preload mode
|
|
3608
3658
|
*/
|
|
@@ -3611,10 +3661,15 @@ export declare enum ImporterMode {
|
|
|
3611
3661
|
PRELOAD = "preload"
|
|
3612
3662
|
}
|
|
3613
3663
|
|
|
3664
|
+
export declare type ImportErrorContext = ImportSessionContext & {
|
|
3665
|
+
/** Present when an error occurs while delivering records */
|
|
3666
|
+
deliveryId?: string;
|
|
3667
|
+
};
|
|
3668
|
+
|
|
3614
3669
|
/**
|
|
3615
|
-
* Importer lifecycle
|
|
3670
|
+
* Importer lifecycle status
|
|
3616
3671
|
*/
|
|
3617
|
-
export declare enum
|
|
3672
|
+
export declare enum ImporterStatus {
|
|
3618
3673
|
UNINITIALIZED = "uninitialized",
|
|
3619
3674
|
INITIALIZING = "initializing",
|
|
3620
3675
|
READY = "ready",
|
|
@@ -3626,8 +3681,13 @@ export declare enum ImporterState {
|
|
|
3626
3681
|
DESTROYED = "destroyed"
|
|
3627
3682
|
}
|
|
3628
3683
|
|
|
3684
|
+
/**
|
|
3685
|
+
* Core step identifiers for the CSV importer
|
|
3686
|
+
*/
|
|
3687
|
+
export declare type ImporterStep = 'upload' | 'select-sheet' | 'select-header' | 'match-columns' | 'match-options' | 'review';
|
|
3688
|
+
|
|
3629
3689
|
export declare interface ImportSessionContext {
|
|
3630
|
-
/**
|
|
3690
|
+
/** Stable ID that groups one import run across chunks and lifecycle callbacks */
|
|
3631
3691
|
sessionId: string;
|
|
3632
3692
|
}
|
|
3633
3693
|
|
|
@@ -3637,10 +3697,22 @@ export declare type InferCSVImporter<TSchema extends ExType<unknown, ExBaseDef,
|
|
|
3637
3697
|
|
|
3638
3698
|
declare type IPAddressVersion = 'v4' | 'v6' | 'all';
|
|
3639
3699
|
|
|
3640
|
-
export declare type
|
|
3700
|
+
export declare type LocalSessionRecoveryOptions = {
|
|
3641
3701
|
type: 'local';
|
|
3642
3702
|
};
|
|
3643
3703
|
|
|
3704
|
+
export declare type ManagedColumnMatchingOptions = {
|
|
3705
|
+
type: 'managed';
|
|
3706
|
+
exact?: boolean;
|
|
3707
|
+
caseInsensitive?: boolean;
|
|
3708
|
+
normalized?: boolean;
|
|
3709
|
+
inference?: boolean;
|
|
3710
|
+
};
|
|
3711
|
+
|
|
3712
|
+
export declare type ManagedPromptedEditsOptions = {
|
|
3713
|
+
type: 'managed';
|
|
3714
|
+
};
|
|
3715
|
+
|
|
3644
3716
|
declare interface MultiselectOptions {
|
|
3645
3717
|
enforceCaseSensitiveMatch?: boolean;
|
|
3646
3718
|
message?: string;
|
|
@@ -3650,21 +3722,21 @@ declare interface MultiselectOptions {
|
|
|
3650
3722
|
* Options for the open() method
|
|
3651
3723
|
* Requires an onData callback for delivery
|
|
3652
3724
|
*/
|
|
3653
|
-
export declare type OpenOptions<T> =
|
|
3654
|
-
/**
|
|
3655
|
-
|
|
3725
|
+
export declare type OpenOptions<T> = {
|
|
3726
|
+
/** Callback for processing delivered chunks */
|
|
3727
|
+
onData: (chunk: RecordsChunk<T>, next: () => void) => void | Promise<void>;
|
|
3728
|
+
/** Chunk size by KB quota or row count. Defaults to 500 KB. Values <= 0 send one chunk. */
|
|
3729
|
+
chunkSize?: ChunkSize;
|
|
3656
3730
|
/** Called when all chunks have been processed */
|
|
3657
|
-
onComplete?: (context:
|
|
3731
|
+
onComplete?: (context: ImportDeliveryContext) => void;
|
|
3658
3732
|
/** Called when the user cancels the import */
|
|
3659
3733
|
onCancel?: (context: ImportSessionContext) => void;
|
|
3660
3734
|
/** Called when an error occurs */
|
|
3661
|
-
onError?: (error: Error, context:
|
|
3735
|
+
onError?: (error: Error, context: ImportErrorContext) => void;
|
|
3662
3736
|
/** Called when the importer opens */
|
|
3663
|
-
|
|
3664
|
-
/** Called when the importer
|
|
3665
|
-
|
|
3666
|
-
/** Called when the step changes in the wizard */
|
|
3667
|
-
onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
|
|
3737
|
+
onOpen?: (context: ImportSessionContext) => void;
|
|
3738
|
+
/** Called when the importer step changes */
|
|
3739
|
+
onStepChange?: (stepId: ImporterStep, previousStepId?: ImporterStep) => void;
|
|
3668
3740
|
};
|
|
3669
3741
|
|
|
3670
3742
|
declare interface PersistedImportSessionData {
|
|
@@ -3693,7 +3765,6 @@ declare interface PrimitiveExBaseDef extends ExBaseDef {
|
|
|
3693
3765
|
columnNameAliases?: string[];
|
|
3694
3766
|
description?: string;
|
|
3695
3767
|
label?: string;
|
|
3696
|
-
example?: string;
|
|
3697
3768
|
message?: string;
|
|
3698
3769
|
checks?: ValidatorCheck[];
|
|
3699
3770
|
defaultValue?: unknown | (() => unknown);
|
|
@@ -3721,13 +3792,6 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3721
3792
|
* @returns The type instance for method chaining
|
|
3722
3793
|
*/
|
|
3723
3794
|
label(text: string): this;
|
|
3724
|
-
/**
|
|
3725
|
-
* Sets an example value for this field
|
|
3726
|
-
*
|
|
3727
|
-
* @param text - Example text
|
|
3728
|
-
* @returns The type instance for method chaining
|
|
3729
|
-
*/
|
|
3730
|
-
example(text: string): this;
|
|
3731
3795
|
/**
|
|
3732
3796
|
* Adds a custom refinement validator to this field.
|
|
3733
3797
|
*
|
|
@@ -3770,6 +3834,55 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3770
3834
|
protected _replaceOrAddCheck(check: ValidatorCheck, existingIndex: number): void;
|
|
3771
3835
|
}
|
|
3772
3836
|
|
|
3837
|
+
export declare type PromptedEditHandler<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = PromptedEditsFn<SchemaFieldName<TSchema>>;
|
|
3838
|
+
|
|
3839
|
+
export declare type PromptedEditResult<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = PromptedEditsResult<SchemaFieldName<TSchema>>;
|
|
3840
|
+
|
|
3841
|
+
export declare type PromptedEditsChange<TField extends string = string> = {
|
|
3842
|
+
type: 'add';
|
|
3843
|
+
values: Partial<Record<TField, unknown>>;
|
|
3844
|
+
} | {
|
|
3845
|
+
type: 'update';
|
|
3846
|
+
rowId: string;
|
|
3847
|
+
values: Partial<Record<TField, unknown>>;
|
|
3848
|
+
} | {
|
|
3849
|
+
type: 'remove';
|
|
3850
|
+
rowId: string;
|
|
3851
|
+
};
|
|
3852
|
+
|
|
3853
|
+
export declare interface PromptedEditsField<TField extends string = string> {
|
|
3854
|
+
key: TField;
|
|
3855
|
+
name: string;
|
|
3856
|
+
type: string;
|
|
3857
|
+
sampleValues: unknown[];
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
export declare type PromptedEditsFn<TField extends string = string> = (data: PromptedEditsParams<TField>) => Promise<PromptedEditsResult<TField>>;
|
|
3861
|
+
|
|
3862
|
+
export declare type PromptedEditsOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ManagedPromptedEditsOptions | CustomPromptedEditsOptions<TSchema>;
|
|
3863
|
+
|
|
3864
|
+
export declare interface PromptedEditsParams<TField extends string = string> {
|
|
3865
|
+
sessionId: string;
|
|
3866
|
+
prompt: string;
|
|
3867
|
+
fields: Array<PromptedEditsField<TField>>;
|
|
3868
|
+
rows: Array<PromptedEditsRow<TField>>;
|
|
3869
|
+
totalRows: number;
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
export declare type PromptedEditsResult<TField extends string = string> = {
|
|
3873
|
+
type: 'success';
|
|
3874
|
+
changes: Array<PromptedEditsChange<TField>>;
|
|
3875
|
+
} | {
|
|
3876
|
+
type: 'no-op';
|
|
3877
|
+
message: string;
|
|
3878
|
+
};
|
|
3879
|
+
|
|
3880
|
+
export declare interface PromptedEditsRow<TField extends string = string> {
|
|
3881
|
+
rowId: string;
|
|
3882
|
+
rowIndex: number;
|
|
3883
|
+
values: Partial<Record<TField, unknown>>;
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3773
3886
|
declare type Protocol = 'http' | 'https' | 'ftp' | 'sftp' | 'file' | 'mailto' | 'tel';
|
|
3774
3887
|
|
|
3775
3888
|
/**
|
|
@@ -3780,16 +3893,20 @@ export declare interface RecordsChunk<T> {
|
|
|
3780
3893
|
records: T[];
|
|
3781
3894
|
/** Total number of chunks */
|
|
3782
3895
|
totalChunks: number;
|
|
3783
|
-
/**
|
|
3784
|
-
|
|
3896
|
+
/** Chunk index within this delivery (0-based) */
|
|
3897
|
+
chunkIndex: number;
|
|
3785
3898
|
/** Total number of records across all chunks */
|
|
3786
3899
|
totalRecords: number;
|
|
3787
|
-
/**
|
|
3900
|
+
/** Stable ID that groups one import run across chunks and lifecycle callbacks */
|
|
3788
3901
|
sessionId: string;
|
|
3789
|
-
/** Stable
|
|
3790
|
-
|
|
3902
|
+
/** Stable ID for this delivery attempt within the import session */
|
|
3903
|
+
deliveryId: string;
|
|
3791
3904
|
}
|
|
3792
3905
|
|
|
3906
|
+
export declare type RecoveredSession = PersistedImportSessionData;
|
|
3907
|
+
|
|
3908
|
+
export declare type RecoveredSessionData = PersistedImportSessionPayload;
|
|
3909
|
+
|
|
3793
3910
|
declare type RefineBatchResultItem = {
|
|
3794
3911
|
valid: boolean;
|
|
3795
3912
|
message?: string;
|
|
@@ -3819,23 +3936,26 @@ declare type RefineResultItem = {
|
|
|
3819
3936
|
};
|
|
3820
3937
|
};
|
|
3821
3938
|
|
|
3939
|
+
export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, unknown>> = Extract<keyof Infer<TSchema>, string>;
|
|
3940
|
+
|
|
3822
3941
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3823
3942
|
schema: TSchema;
|
|
3824
3943
|
getSessionToken: () => Promise<string>;
|
|
3825
|
-
|
|
3944
|
+
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3945
|
+
importNamespace: string;
|
|
3826
3946
|
title?: string;
|
|
3827
3947
|
debug?: boolean;
|
|
3828
3948
|
preload?: boolean;
|
|
3829
|
-
theme?:
|
|
3949
|
+
theme?: Theme;
|
|
3830
3950
|
colorMode?: ColorModePref;
|
|
3831
3951
|
customCSS?: string;
|
|
3832
|
-
fonts?: Record<string,
|
|
3952
|
+
fonts?: Record<string, FontSource>;
|
|
3833
3953
|
stepDisplay?: 'progressBar' | 'segmented' | 'numbered';
|
|
3834
3954
|
previewSchemaBeforeUpload?: boolean;
|
|
3835
|
-
|
|
3836
|
-
|
|
3955
|
+
columnMatching?: ColumnMatchingOptions<TSchema>;
|
|
3956
|
+
promptedEdits?: PromptedEditsOptions<TSchema>;
|
|
3837
3957
|
templateDownload?: TemplateDownloadOptions<TSchema>;
|
|
3838
|
-
|
|
3958
|
+
sessionRecovery?: SessionRecoveryOptions;
|
|
3839
3959
|
locale?: DeepPartial<ExpressCSVLocaleInput>;
|
|
3840
3960
|
disableStatusStep?: boolean;
|
|
3841
3961
|
}
|
|
@@ -3852,15 +3972,11 @@ declare interface SelectOptions {
|
|
|
3852
3972
|
message?: string;
|
|
3853
3973
|
}
|
|
3854
3974
|
|
|
3855
|
-
declare type
|
|
3856
|
-
|
|
3857
|
-
export declare type StorageKey = PersistedImportSessionKey;
|
|
3858
|
-
|
|
3859
|
-
export declare type StorageOptions = LocalStorageOptions | CustomStorageOptions;
|
|
3975
|
+
export declare type SessionRecoveryKey = PersistedImportSessionKey;
|
|
3860
3976
|
|
|
3861
|
-
export declare type
|
|
3977
|
+
export declare type SessionRecoveryOptions = LocalSessionRecoveryOptions | CustomSessionRecoveryOptions;
|
|
3862
3978
|
|
|
3863
|
-
|
|
3979
|
+
declare type StatusChangeListener = (status: ImporterStatus) => void;
|
|
3864
3980
|
|
|
3865
3981
|
declare type StripBrand<T> = {
|
|
3866
3982
|
[K in keyof T]: T[K] extends TemplateString<string> ? string : T[K] extends object ? StripBrand<T[K]> : T[K];
|
|
@@ -3934,6 +4050,26 @@ declare type TemplateString<TVars extends string = string> = string & {
|
|
|
3934
4050
|
readonly __vars: TVars;
|
|
3935
4051
|
};
|
|
3936
4052
|
|
|
4053
|
+
/**
|
|
4054
|
+
* Theme - can be either dual-mode (light/dark) or single-mode (applies to both)
|
|
4055
|
+
*/
|
|
4056
|
+
export declare type Theme = ThemeWithModes | ThemeSingle;
|
|
4057
|
+
|
|
4058
|
+
/**
|
|
4059
|
+
* Single theme that applies to both light and dark modes
|
|
4060
|
+
*/
|
|
4061
|
+
declare type ThemeSingle = TailwindThemeVars;
|
|
4062
|
+
|
|
4063
|
+
/**
|
|
4064
|
+
* Theme with light and dark mode support
|
|
4065
|
+
*/
|
|
4066
|
+
declare interface ThemeWithModes {
|
|
4067
|
+
modes: {
|
|
4068
|
+
light: TailwindThemeVars;
|
|
4069
|
+
dark: TailwindThemeVars;
|
|
4070
|
+
};
|
|
4071
|
+
}
|
|
4072
|
+
|
|
3937
4073
|
/**
|
|
3938
4074
|
* Time validation options
|
|
3939
4075
|
*/
|