@pbkware/fielded-text-web 0.1.2 → 0.2.1
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 +19 -41
- package/dist/api/ft-reader.js +1 -1
- package/dist/api/ft-reader.js.map +1 -1
- package/dist/api/ft-serialization.js +4 -4
- package/dist/api/ft-serialization.js.map +1 -1
- package/dist/factory/ft-field-factory.js +1 -1
- package/dist/factory/ft-field-factory.js.map +1 -1
- package/dist/factory/ft-sequence-redirect-factory.js +3 -3
- package/dist/factory/ft-sequence-redirect-factory.js.map +1 -1
- package/dist/fields/definitions/ft-boolean-field-definition.js +1 -1
- package/dist/fields/definitions/ft-boolean-field-definition.js.map +1 -1
- package/dist/fields/definitions/ft-date-time-field-definition.js +1 -1
- package/dist/fields/definitions/ft-date-time-field-definition.js.map +1 -1
- package/dist/fields/definitions/ft-decimal-field-definition.js +1 -1
- package/dist/fields/definitions/ft-decimal-field-definition.js.map +1 -1
- package/dist/fields/definitions/ft-field-definition.js +1 -1
- package/dist/fields/definitions/ft-field-definition.js.map +1 -1
- package/dist/fields/definitions/ft-float-field-definition.js +1 -1
- package/dist/fields/definitions/ft-float-field-definition.js.map +1 -1
- package/dist/fields/definitions/ft-integer-field-definition.js +1 -1
- package/dist/fields/definitions/ft-integer-field-definition.js.map +1 -1
- package/dist/fields/definitions/ft-string-field-definition.js +1 -1
- package/dist/fields/definitions/ft-string-field-definition.js.map +1 -1
- package/dist/fields/instances/errors/ft-field-null-error.js +11 -0
- package/dist/fields/instances/errors/ft-field-null-error.js.map +1 -0
- package/dist/fields/instances/errors/ft-field-type-error.js +11 -0
- package/dist/fields/instances/errors/ft-field-type-error.js.map +1 -0
- package/dist/fields/instances/ft-boolean-field.js +14 -6
- package/dist/fields/instances/ft-boolean-field.js.map +1 -1
- package/dist/fields/instances/ft-date-time-field.js +26 -8
- package/dist/fields/instances/ft-date-time-field.js.map +1 -1
- package/dist/fields/instances/ft-decimal-field.js +14 -6
- package/dist/fields/instances/ft-decimal-field.js.map +1 -1
- package/dist/fields/instances/ft-field.js +315 -123
- package/dist/fields/instances/ft-field.js.map +1 -1
- package/dist/fields/instances/ft-float-field.js +14 -6
- package/dist/fields/instances/ft-float-field.js.map +1 -1
- package/dist/fields/instances/ft-generic-field.js +29 -67
- package/dist/fields/instances/ft-generic-field.js.map +1 -1
- package/dist/fields/instances/ft-integer-field.js +24 -8
- package/dist/fields/instances/ft-integer-field.js.map +1 -1
- package/dist/fields/instances/ft-string-field.js +13 -13
- package/dist/fields/instances/ft-string-field.js.map +1 -1
- package/dist/index.d.ts +616 -288
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/meta/sequences/core/ft-meta-sequence-list.js +4 -2
- package/dist/meta/sequences/core/ft-meta-sequence-list.js.map +1 -1
- package/dist/meta/sequences/redirects/ft-meta-sequence-redirect-list.js +1 -1
- package/dist/meta/sequences/redirects/ft-meta-sequence-redirect-list.js.map +1 -1
- package/dist/meta-serialization/format/ft-xml-meta-serialization.js +4 -6
- package/dist/meta-serialization/format/ft-xml-meta-serialization.js.map +1 -1
- package/dist/meta-serialization/styles/ft-number-styles-meta-serialization.js +1 -1
- package/dist/meta-serialization/styles/ft-number-styles-meta-serialization.js.map +1 -1
- package/dist/meta-serialization/types/date-time-meta-serialization.js +1 -1
- package/dist/meta-serialization/types/date-time-meta-serialization.js.map +1 -1
- package/dist/meta-serialization/types/enums/sequence-redirect-type-meta-serialisation.js +1 -1
- package/dist/meta-serialization/types/enums/sequence-redirect-type-meta-serialisation.js.map +1 -1
- package/dist/meta-serialization/types/float-meta-serialization.js +2 -2
- package/dist/meta-serialization/types/float-meta-serialization.js.map +1 -1
- package/dist/meta-serialization/types/integer-float-meta-serialization.js +2 -2
- package/dist/meta-serialization/types/integer-float-meta-serialization.js.map +1 -1
- package/dist/meta-serialization/utils/implicit-explicit-index-sorter.js +4 -10
- package/dist/meta-serialization/utils/implicit-explicit-index-sorter.js.map +1 -1
- package/dist/meta-serialization/utils/meta-serialization-sequence-name-resolver.js +25 -2
- package/dist/meta-serialization/utils/meta-serialization-sequence-name-resolver.js.map +1 -1
- package/dist/meta-serialization/utils/sequence-item-field-indices.js +2 -2
- package/dist/meta-serialization/utils/sequence-item-field-indices.js.map +1 -1
- package/dist/sequences/redirects/ft-case-insensitive-string-sequence-redirect.js +3 -1
- package/dist/sequences/redirects/ft-case-insensitive-string-sequence-redirect.js.map +1 -1
- package/dist/serialization/char-reader.js +2 -2
- package/dist/serialization/char-reader.js.map +1 -1
- package/dist/serialization/declaration-parser.js +1 -1
- package/dist/serialization/declaration-parser.js.map +1 -1
- package/dist/serialization/delimited-field-parser.js.map +1 -1
- package/dist/serialization/events/ft-field-heading-ready-event-args.js.map +1 -0
- package/dist/serialization/events/ft-field-value-ready-event-args.js.map +1 -0
- package/dist/serialization/events/ft-heading-line-finished-event-args.js.map +1 -0
- package/dist/serialization/events/ft-heading-line-started-event-args.js.map +1 -0
- package/dist/serialization/events/ft-record-finished-event-args.js.map +1 -0
- package/dist/serialization/events/ft-record-started-event-args.js.map +1 -0
- package/dist/serialization/events/ft-sequence-redirected-event-args.js.map +1 -0
- package/dist/serialization/fixed-width-field-parser.js +1 -1
- package/dist/serialization/fixed-width-field-parser.js.map +1 -1
- package/dist/serialization/ft-declared-parameters.js +9 -8
- package/dist/serialization/ft-declared-parameters.js.map +1 -1
- package/dist/serialization/{serialization-core.js → ft-serialization-core.js} +114 -11
- package/dist/serialization/ft-serialization-core.js.map +1 -0
- package/dist/{types/errors/ft-serialization-error.js → serialization/ft-serialization-error-code.js} +2 -2
- package/dist/serialization/ft-serialization-error-code.js.map +1 -0
- package/dist/{types/errors/ft-serialization-exception.js → serialization/ft-serialization-error.js} +7 -7
- package/dist/serialization/ft-serialization-error.js.map +1 -0
- package/dist/serialization/ft-serialization-reader.js +19 -47
- package/dist/serialization/ft-serialization-reader.js.map +1 -1
- package/dist/serialization/ft-serialization-writer.js +86 -49
- package/dist/serialization/ft-serialization-writer.js.map +1 -1
- package/dist/serialization/heading-line-record-parser.js +7 -7
- package/dist/serialization/heading-line-record-parser.js.map +1 -1
- package/dist/serialization/line-parser.js +1 -1
- package/dist/serialization/line-parser.js.map +1 -1
- package/dist/serialization/{ft-text-reader.js → text-reader/ft-string-reader.js} +1 -13
- package/dist/serialization/text-reader/ft-string-reader.js.map +1 -0
- package/dist/serialization/text-reader/ft-text-reader.js +13 -0
- package/dist/serialization/text-reader/ft-text-reader.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/enums/ft-heading-constraint.js +5 -0
- package/dist/types/enums/ft-heading-constraint.js.map +1 -1
- package/dist/utils/ft-comma-text.js +247 -0
- package/dist/utils/ft-comma-text.js.map +1 -0
- package/dist/utils/ft-internal-error.js +129 -0
- package/dist/utils/ft-internal-error.js.map +1 -0
- package/dist/utils/ft-result.js +2 -0
- package/dist/utils/ft-result.js.map +1 -0
- package/dist/utils/number-parse.js +33 -0
- package/dist/utils/number-parse.js.map +1 -0
- package/dist/utils/string-builder.js +40 -0
- package/dist/utils/string-builder.js.map +1 -0
- package/package.json +25 -27
- package/src/api/ft-reader.ts +2 -1
- package/src/api/ft-serialization.ts +13 -13
- package/src/factory/ft-field-factory.ts +1 -1
- package/src/factory/ft-sequence-redirect-factory.ts +4 -4
- package/src/fields/definitions/ft-boolean-field-definition.ts +1 -1
- package/src/fields/definitions/ft-date-time-field-definition.ts +1 -1
- package/src/fields/definitions/ft-decimal-field-definition.ts +1 -1
- package/src/fields/definitions/ft-field-definition.ts +1 -1
- package/src/fields/definitions/ft-float-field-definition.ts +1 -1
- package/src/fields/definitions/ft-generic-field-definition.ts +1 -1
- package/src/fields/definitions/ft-integer-field-definition.ts +1 -1
- package/src/fields/definitions/ft-string-field-definition.ts +1 -1
- package/src/fields/instances/errors/ft-field-null-error.ts +10 -0
- package/src/fields/instances/errors/ft-field-type-error.ts +10 -0
- package/src/fields/instances/ft-boolean-field.ts +17 -6
- package/src/fields/instances/ft-date-time-field.ts +28 -7
- package/src/fields/instances/ft-decimal-field.ts +17 -6
- package/src/fields/instances/ft-field.ts +329 -145
- package/src/fields/instances/ft-float-field.ts +17 -6
- package/src/fields/instances/ft-generic-field.ts +32 -88
- package/src/fields/instances/ft-integer-field.ts +29 -7
- package/src/fields/instances/ft-string-field.ts +15 -12
- package/src/index.ts +21 -12
- package/src/meta/sequences/core/ft-meta-sequence-list.ts +4 -3
- package/src/meta/sequences/redirects/ft-meta-sequence-redirect-list.ts +1 -1
- package/src/meta-serialization/format/ft-xml-meta-serialization.ts +4 -7
- package/src/meta-serialization/styles/ft-number-styles-meta-serialization.ts +1 -1
- package/src/meta-serialization/types/date-time-meta-serialization.ts +1 -1
- package/src/meta-serialization/types/enums/meta-element-type-meta-serialization.ts +4 -4
- package/src/meta-serialization/types/enums/sequence-redirect-type-meta-serialisation.ts +1 -1
- package/src/meta-serialization/types/float-meta-serialization.ts +2 -2
- package/src/meta-serialization/types/integer-float-meta-serialization.ts +2 -2
- package/src/meta-serialization/utils/implicit-explicit-index-sorter.ts +18 -12
- package/src/meta-serialization/utils/meta-serialization-sequence-name-resolver.ts +25 -2
- package/src/meta-serialization/utils/sequence-item-field-indices.ts +2 -2
- package/src/sequences/redirects/ft-case-insensitive-string-sequence-redirect.ts +3 -1
- package/src/serialization/char-reader.ts +2 -2
- package/src/serialization/declaration-parser.ts +1 -1
- package/src/serialization/delimited-field-parser.ts +3 -3
- package/src/serialization/fixed-width-field-parser.ts +4 -4
- package/src/serialization/ft-declared-parameters.ts +12 -11
- package/src/serialization/{serialization-core.ts → ft-serialization-core.ts} +133 -17
- package/src/{types/errors/ft-serialization-error.ts → serialization/ft-serialization-error-code.ts} +2 -2
- package/src/{types/errors/ft-serialization-exception.ts → serialization/ft-serialization-error.ts} +14 -9
- package/src/serialization/ft-serialization-reader.ts +21 -54
- package/src/serialization/ft-serialization-writer.ts +97 -64
- package/src/serialization/heading-line-record-parser.ts +10 -10
- package/src/serialization/line-parser.ts +1 -1
- package/src/serialization/{ft-text-reader.ts → text-reader/ft-string-reader.ts} +1 -24
- package/src/serialization/text-reader/ft-text-reader.ts +24 -0
- package/src/types/enums/ft-heading-constraint.ts +5 -0
- package/src/utils/ft-comma-text.ts +285 -0
- package/src/utils/ft-internal-error.ts +143 -0
- package/src/utils/ft-result.ts +1 -0
- package/src/utils/number-parse.ts +35 -0
- package/src/utils/string-builder.ts +47 -0
- package/LICENSE +0 -21
- package/dist/serialization/ft-text-reader.js.map +0 -1
- package/dist/serialization/serialization-core.js.map +0 -1
- package/dist/types/errors/ft-internal-error.js +0 -14
- package/dist/types/errors/ft-internal-error.js.map +0 -1
- package/dist/types/errors/ft-serialization-error.js.map +0 -1
- package/dist/types/errors/ft-serialization-exception.js.map +0 -1
- package/dist/types/events/ft-field-heading-ready-event-args.js.map +0 -1
- package/dist/types/events/ft-field-value-ready-event-args.js.map +0 -1
- package/dist/types/events/ft-heading-line-finished-event-args.js.map +0 -1
- package/dist/types/events/ft-heading-line-started-event-args.js.map +0 -1
- package/dist/types/events/ft-record-finished-event-args.js.map +0 -1
- package/dist/types/events/ft-record-started-event-args.js.map +0 -1
- package/dist/types/events/ft-sequence-redirected-event-args.js.map +0 -1
- package/src/types/errors/ft-internal-error.ts +0 -15
- /package/dist/{types → serialization}/events/ft-field-heading-ready-event-args.js +0 -0
- /package/dist/{types → serialization}/events/ft-field-value-ready-event-args.js +0 -0
- /package/dist/{types → serialization}/events/ft-heading-line-finished-event-args.js +0 -0
- /package/dist/{types → serialization}/events/ft-heading-line-started-event-args.js +0 -0
- /package/dist/{types → serialization}/events/ft-record-finished-event-args.js +0 -0
- /package/dist/{types → serialization}/events/ft-record-started-event-args.js +0 -0
- /package/dist/{types → serialization}/events/ft-sequence-redirected-event-args.js +0 -0
- /package/src/{types → serialization}/events/ft-field-heading-ready-event-args.ts +0 -0
- /package/src/{types → serialization}/events/ft-field-value-ready-event-args.ts +0 -0
- /package/src/{types → serialization}/events/ft-heading-line-finished-event-args.ts +0 -0
- /package/src/{types → serialization}/events/ft-heading-line-started-event-args.ts +0 -0
- /package/src/{types → serialization}/events/ft-record-finished-event-args.ts +0 -0
- /package/src/{types → serialization}/events/ft-record-started-event-args.ts +0 -0
- /package/src/{types → serialization}/events/ft-sequence-redirected-event-args.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { DotNetDateTimeStyles } from '@pbkware/dot-net-date-number-formatting';
|
|
|
3
3
|
import { DotNetLocaleSettings } from '@pbkware/dot-net-date-number-formatting';
|
|
4
4
|
import { DotNetNumberStyleFlags } from '@pbkware/dot-net-date-number-formatting';
|
|
5
5
|
import { DotNetNumberStyles } from '@pbkware/dot-net-date-number-formatting';
|
|
6
|
-
import {
|
|
6
|
+
import { Err as FtErr } from '@pbkware/dot-net-date-number-formatting';
|
|
7
|
+
import { Ok as FtOk } from '@pbkware/dot-net-date-number-formatting';
|
|
8
|
+
import { Result as FtResult } from '@pbkware/dot-net-date-number-formatting';
|
|
7
9
|
|
|
8
10
|
export { DotNetDateTimeStyleFlags }
|
|
9
11
|
|
|
@@ -34,8 +36,10 @@ export declare class FtBooleanField extends FtGenericField<boolean> {
|
|
|
34
36
|
get falseText(): string;
|
|
35
37
|
get trueText(): string;
|
|
36
38
|
get styles(): FtBooleanStyles;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
static cast(field: FtField): field is FtBooleanField;
|
|
40
|
+
setValue(newValue: FtField.Value): number;
|
|
41
|
+
protected getAsBoolean(): boolean;
|
|
42
|
+
protected setAsBoolean(newValue: boolean): void;
|
|
39
43
|
protected isValueEqual(left: boolean, right: boolean): boolean;
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -51,7 +55,7 @@ export declare class FtBooleanFieldDefinition extends FtGenericFieldDefinition<b
|
|
|
51
55
|
get trueText(): string;
|
|
52
56
|
get styles(): FtBooleanStyles;
|
|
53
57
|
loadMeta(metaField: FtBooleanMetaField, myCulture: DotNetLocaleSettings | undefined, myMainHeadingIndex: number): void;
|
|
54
|
-
|
|
58
|
+
formatValue(value: boolean): string;
|
|
55
59
|
parseValueText(text: string): boolean;
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -194,6 +198,7 @@ export declare class FtCaseInsensitiveStringMetaSequenceRedirect extends FtMetaS
|
|
|
194
198
|
export declare class FtCaseInsensitiveStringSequenceRedirect extends FtSequenceRedirect {
|
|
195
199
|
static readonly TYPE: "CaseInsensitiveString";
|
|
196
200
|
private _value;
|
|
201
|
+
private _lowerCaseValue;
|
|
197
202
|
constructor(index: number);
|
|
198
203
|
get value(): string;
|
|
199
204
|
checkTriggered(field: FtField): boolean;
|
|
@@ -201,6 +206,50 @@ export declare class FtCaseInsensitiveStringSequenceRedirect extends FtSequenceR
|
|
|
201
206
|
loadMeta(metaSequenceRedirect: FtCaseInsensitiveStringMetaSequenceRedirect, metaSequenceList: FtMetaSequenceList, sequenceList: FtSequenceList): void;
|
|
202
207
|
}
|
|
203
208
|
|
|
209
|
+
/** @public */
|
|
210
|
+
export declare namespace FtCommaText {
|
|
211
|
+
const delimiterChar = ",";
|
|
212
|
+
const quoteChar = "\"";
|
|
213
|
+
const pairQuoteChar: string;
|
|
214
|
+
export function from2Values(value1: string, value2: string): string;
|
|
215
|
+
export function from3Values(value1: string, value2: string, value3: string): string;
|
|
216
|
+
export function from4Values(value1: string, value2: string, value3: string, value4: string): string;
|
|
217
|
+
export function fromStringArray(value: readonly string[]): string;
|
|
218
|
+
export function fromIntegerArray(value: number[]): string;
|
|
219
|
+
export function toStringArray(value: string): string[];
|
|
220
|
+
export function tryToStringArray(value: string, strict?: boolean): FtResult<string[], ErrorIdPlusExtra<typeof ErrorId.QuotesNotClosedInLastElement | typeof ErrorId.UnexpectedCharAfterQuotedElement>>;
|
|
221
|
+
export interface ToIntegerArrayResult {
|
|
222
|
+
success: boolean;
|
|
223
|
+
array: number[];
|
|
224
|
+
errorText: string;
|
|
225
|
+
}
|
|
226
|
+
export function toIntegerArrayWithResult(value: string): FtResult<number[], ErrorIdPlusExtra<typeof ErrorId.QuotesNotClosedInLastElement | typeof ErrorId.UnexpectedCharAfterQuotedElement | typeof ErrorId.InvalidIntegerString>>;
|
|
227
|
+
export interface StrictValidateResult {
|
|
228
|
+
success: boolean;
|
|
229
|
+
errorText: string;
|
|
230
|
+
}
|
|
231
|
+
export function strictValidate(value: string): FtResult<boolean, ErrorIdPlusExtra<typeof ErrorId.QuotesNotClosedInLastElement | typeof ErrorId.UnexpectedCharAfterQuotedElement>>;
|
|
232
|
+
const ErrorId: {
|
|
233
|
+
readonly UnexpectedCharAfterQuotedElement: "UnexpectedCharAfterQuotedElement";
|
|
234
|
+
readonly QuotesNotClosedInLastElement: "QuotesNotClosedInLastElement";
|
|
235
|
+
readonly InvalidIntegerString: "InvalidIntegerString";
|
|
236
|
+
};
|
|
237
|
+
export type ErrorId = (typeof ErrorId)[keyof typeof ErrorId];
|
|
238
|
+
export function errorIdToEnglish(errorId: ErrorId): "Unexpected char after quoted element" | "Quotes not closed in last element" | "Invalid integer string";
|
|
239
|
+
export interface ErrorIdPlusExtra<T extends ErrorId> {
|
|
240
|
+
readonly errorId: T;
|
|
241
|
+
readonly extraInfo: string;
|
|
242
|
+
}
|
|
243
|
+
export namespace ErrorIdPlusExtra {
|
|
244
|
+
export function toEnglish(errorIdPlusExtra: ErrorIdPlusExtra<ErrorId>): string;
|
|
245
|
+
}
|
|
246
|
+
export class Error extends globalThis.Error {
|
|
247
|
+
readonly errorId: ErrorId;
|
|
248
|
+
readonly extraInfo: string;
|
|
249
|
+
constructor(message: string, errorId: ErrorId, extraInfo: string);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
204
253
|
/**
|
|
205
254
|
* @public
|
|
206
255
|
*/
|
|
@@ -262,8 +311,10 @@ export declare class FtDateTimeField extends FtGenericField<Date> {
|
|
|
262
311
|
get definition(): FtDateTimeFieldDefinition;
|
|
263
312
|
get format(): string;
|
|
264
313
|
get styles(): number;
|
|
265
|
-
|
|
266
|
-
|
|
314
|
+
static cast(field: FtField): field is FtDateTimeField;
|
|
315
|
+
setValue(newValue: FtField.Value): number;
|
|
316
|
+
protected getAsDateTime(): Date;
|
|
317
|
+
protected setAsDateTime(newValue: Date): void;
|
|
267
318
|
protected isValueEqual(left: Date, right: Date): boolean;
|
|
268
319
|
}
|
|
269
320
|
|
|
@@ -280,7 +331,7 @@ export declare class FtDateTimeFieldDefinition extends FtGenericFieldDefinition<
|
|
|
280
331
|
get styles(): DotNetDateTimeStyles;
|
|
281
332
|
get constantValue(): Date;
|
|
282
333
|
loadMeta(metaField: FtMetaField, myCulture: DotNetLocaleSettings | undefined, myMainHeadingIndex: number): void;
|
|
283
|
-
|
|
334
|
+
formatValue(value: Date): string;
|
|
284
335
|
parseValueText(text: string): Date;
|
|
285
336
|
}
|
|
286
337
|
|
|
@@ -346,8 +397,10 @@ export declare class FtDecimalField extends FtGenericField<number> {
|
|
|
346
397
|
get definition(): FtDecimalFieldDefinition;
|
|
347
398
|
get format(): string;
|
|
348
399
|
get styles(): number;
|
|
349
|
-
|
|
350
|
-
|
|
400
|
+
static cast(field: FtField): field is FtDecimalField;
|
|
401
|
+
setValue(newValue: FtField.Value): number;
|
|
402
|
+
protected getAsDecimal(): number;
|
|
403
|
+
protected setAsDecimal(newValue: number): void;
|
|
351
404
|
protected isValueEqual(left: number, right: number): boolean;
|
|
352
405
|
}
|
|
353
406
|
|
|
@@ -362,7 +415,7 @@ export declare class FtDecimalFieldDefinition extends FtGenericFieldDefinition<n
|
|
|
362
415
|
get format(): string;
|
|
363
416
|
get styles(): DotNetNumberStyles;
|
|
364
417
|
loadMeta(metaField: FtDecimalMetaField, myCulture: DotNetLocaleSettings | undefined, myMainHeadingIndex: number): void;
|
|
365
|
-
|
|
418
|
+
formatValue(value: number): string;
|
|
366
419
|
parseValueText(text: string): number;
|
|
367
420
|
}
|
|
368
421
|
|
|
@@ -438,7 +491,7 @@ export declare class FtDeclaredParameters {
|
|
|
438
491
|
indexOfName(name: string): number;
|
|
439
492
|
indexOfVersion(): number;
|
|
440
493
|
setVersion(major: number, minor: number, comment?: string): void;
|
|
441
|
-
tryGetVersion():
|
|
494
|
+
tryGetVersion(): FtResult<Version, boolean>;
|
|
442
495
|
getMetaReference(): {
|
|
443
496
|
type: FtMetaReferenceType;
|
|
444
497
|
reference: string;
|
|
@@ -506,6 +559,8 @@ export declare const FtEndOfLineType: {
|
|
|
506
559
|
*/
|
|
507
560
|
export declare type FtEndOfLineType = (typeof FtEndOfLineType)[keyof typeof FtEndOfLineType];
|
|
508
561
|
|
|
562
|
+
export { FtErr }
|
|
563
|
+
|
|
509
564
|
/**
|
|
510
565
|
* Meta sequence redirect that triggers when a field value exactly matches a specific date-time value.
|
|
511
566
|
* Used in metadata to define sequence transitions based on exact date-time field values (including time component).
|
|
@@ -685,7 +740,7 @@ export declare abstract class FtField {
|
|
|
685
740
|
static readonly NO_FIELDS_AFFECTED_INDEX = -1;
|
|
686
741
|
protected static readonly IGNORED_SEQUENCE_INVOKATION_DELAY: "AfterSequence";
|
|
687
742
|
sequenceRedirectEvent: FtSequenceRedirectDelegate | undefined;
|
|
688
|
-
protected
|
|
743
|
+
protected _valueAssigned: boolean;
|
|
689
744
|
protected quoted: boolean;
|
|
690
745
|
private _index;
|
|
691
746
|
private _definition;
|
|
@@ -702,7 +757,7 @@ export declare abstract class FtField {
|
|
|
702
757
|
private _loadedLength;
|
|
703
758
|
private _loadedRawOffset;
|
|
704
759
|
private _loadedRawLength;
|
|
705
|
-
private
|
|
760
|
+
private _valueText;
|
|
706
761
|
protected constructor(sequenceInvokation: FtSequenceInvokation, sequenceItem: FtSequenceItem, valueTextNullTrimmable: boolean);
|
|
707
762
|
get definition_(): FtFieldDefinition;
|
|
708
763
|
get index(): number;
|
|
@@ -716,8 +771,14 @@ export declare abstract class FtField {
|
|
|
716
771
|
get sequenceInvokation(): FtSequenceInvokation;
|
|
717
772
|
get headingCount(): number;
|
|
718
773
|
get headings(): string[];
|
|
719
|
-
|
|
720
|
-
|
|
774
|
+
/**
|
|
775
|
+
* Indicates whether a value has been assigned to the field.
|
|
776
|
+
*/
|
|
777
|
+
get valueAssigned(): boolean;
|
|
778
|
+
/**
|
|
779
|
+
* The formatted text of the field value as loaded from the data or via {@link loadValueText}.
|
|
780
|
+
*/
|
|
781
|
+
get valueText(): string;
|
|
721
782
|
get dataType(): FtDataType;
|
|
722
783
|
get id(): number | undefined;
|
|
723
784
|
get name(): string;
|
|
@@ -760,41 +821,167 @@ export declare abstract class FtField {
|
|
|
760
821
|
get asRedirectDateTime(): Date;
|
|
761
822
|
/** @internal */
|
|
762
823
|
get asRedirectDecimal(): number;
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
824
|
+
/**
|
|
825
|
+
* The field value as an unspecified type.
|
|
826
|
+
*
|
|
827
|
+
* When setting the value, the actual type must be compatible with the field's expected type.
|
|
828
|
+
*
|
|
829
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
830
|
+
*/
|
|
831
|
+
get value(): FtField.Value;
|
|
832
|
+
set value(value: FtField.Value);
|
|
833
|
+
/**
|
|
834
|
+
* The field value as a string.
|
|
835
|
+
*
|
|
836
|
+
* @throws FtFieldTypeError if the field is not of data type `String`.
|
|
837
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
838
|
+
*/
|
|
839
|
+
get asString(): string;
|
|
840
|
+
set asString(value: string);
|
|
841
|
+
/**
|
|
842
|
+
* The field value as a boolean.
|
|
843
|
+
*
|
|
844
|
+
* @throws FtFieldTypeError if the field is not of data type `Boolean`.
|
|
845
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
846
|
+
*/
|
|
769
847
|
get asBoolean(): boolean;
|
|
770
848
|
set asBoolean(value: boolean);
|
|
849
|
+
/**
|
|
850
|
+
* The field value as an integer.
|
|
851
|
+
|
|
852
|
+
* @throws FtFieldTypeError if the field is not of data type `Integer`.
|
|
853
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
854
|
+
*/
|
|
771
855
|
get asInteger(): number;
|
|
772
856
|
set asInteger(value: number);
|
|
857
|
+
/**
|
|
858
|
+
* The field value as a bigint.
|
|
859
|
+
*
|
|
860
|
+
* @throws FtFieldTypeError if the field is not of data type `BigInt`.
|
|
861
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
862
|
+
*/
|
|
773
863
|
get asBigInt(): bigint;
|
|
774
864
|
set asBigInt(value: bigint);
|
|
865
|
+
/**
|
|
866
|
+
* The field value as a float.
|
|
867
|
+
*
|
|
868
|
+
* @throws FtFieldTypeError if the field is not of data type `Float`.
|
|
869
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
870
|
+
*/
|
|
775
871
|
get asFloat(): number;
|
|
776
872
|
set asFloat(value: number);
|
|
873
|
+
/**
|
|
874
|
+
* The field value as a DateTime.
|
|
875
|
+
*
|
|
876
|
+
* @throws FtFieldTypeError if the field is not of data type `DateTime`.
|
|
877
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
878
|
+
*/
|
|
777
879
|
get asDateTime(): Date;
|
|
778
880
|
set asDateTime(value: Date);
|
|
881
|
+
/**
|
|
882
|
+
* The field value as a number (decimal).
|
|
883
|
+
*
|
|
884
|
+
* @throws FtFieldTypeError if the field is not of data type `Decimal`.
|
|
885
|
+
* @throws FtFieldNullError if the field is `null`.
|
|
886
|
+
*/
|
|
779
887
|
get asDecimal(): number;
|
|
780
888
|
set asDecimal(value: number);
|
|
889
|
+
/**
|
|
890
|
+
* The field value as an unspecified type or null.
|
|
891
|
+
|
|
892
|
+
* Use with caution, as this bypasses type safety. Ensure that the value being set is compatible with the field's expected type.
|
|
893
|
+
*/
|
|
894
|
+
get nullableValue(): FtField.Value | null;
|
|
895
|
+
set nullableValue(value: FtField.Value | null);
|
|
896
|
+
/**
|
|
897
|
+
* The field value as a string or null.
|
|
898
|
+
*
|
|
899
|
+
* @throws FtFieldTypeError if the field is not of data type `String`.
|
|
900
|
+
*/
|
|
901
|
+
get asNullableString(): string | null;
|
|
902
|
+
set asNullableString(value: string | null);
|
|
903
|
+
/**
|
|
904
|
+
* The field value as a boolean or null.
|
|
905
|
+
*
|
|
906
|
+
* @throws FtFieldTypeError if the field is not of data type `Boolean`.
|
|
907
|
+
*/
|
|
781
908
|
get asNullableBoolean(): boolean | null;
|
|
782
909
|
set asNullableBoolean(value: boolean | null);
|
|
910
|
+
/**
|
|
911
|
+
* The field value as an integer or null.
|
|
912
|
+
*
|
|
913
|
+
* @throws FtFieldTypeError if the field is not of data type `BigInt`.
|
|
914
|
+
*/
|
|
783
915
|
get asNullableInteger(): number | null;
|
|
784
916
|
set asNullableInteger(value: number | null);
|
|
917
|
+
/**
|
|
918
|
+
* The field value as a bigint or null.
|
|
919
|
+
*
|
|
920
|
+
* @throws FtFieldTypeError if the field is not of data type `BigInt`.
|
|
921
|
+
*/
|
|
785
922
|
get asNullableBigInt(): bigint | null;
|
|
786
923
|
set asNullableBigInt(value: bigint | null);
|
|
924
|
+
/**
|
|
925
|
+
* The field value as a float or null.
|
|
926
|
+
*
|
|
927
|
+
* @throws FtFieldTypeError if the field is not of data type `Float`.
|
|
928
|
+
*/
|
|
787
929
|
get asNullableFloat(): number | null;
|
|
788
930
|
set asNullableFloat(value: number | null);
|
|
931
|
+
/**
|
|
932
|
+
* The field value as a Date or null.
|
|
933
|
+
*
|
|
934
|
+
* @throws FtFieldTypeError if the field is not of data type `DateTime`.
|
|
935
|
+
*/
|
|
789
936
|
get asNullableDateTime(): Date | null;
|
|
790
937
|
set asNullableDateTime(value: Date | null);
|
|
938
|
+
/**
|
|
939
|
+
* The field value as a number (decimal) or null.
|
|
940
|
+
*
|
|
941
|
+
* @throws FtFieldTypeError if the field is not of data type `Decimal`.
|
|
942
|
+
*/
|
|
791
943
|
get asNullableDecimal(): number | null;
|
|
792
944
|
set asNullableDecimal(value: number | null);
|
|
945
|
+
/**
|
|
946
|
+
* Checks if the field value is null.
|
|
947
|
+
* @returns True if the field value is null, false otherwise.
|
|
948
|
+
*/
|
|
793
949
|
isNull(): boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Sets the field value to null.
|
|
952
|
+
*
|
|
953
|
+
* Checks for sequence redirects that may be triggered by setting the field to null.
|
|
954
|
+
*
|
|
955
|
+
* @returns If this setting of field to null caused a sequence redirect, returns the index of the first field affected by the redirect. If no redirect occurred, returns FtField.NO_FIELDS_AFFECTED_INDEX.
|
|
956
|
+
* @throws Error if the field is constant and cannot be set to null.
|
|
957
|
+
*/
|
|
794
958
|
setNull(): number;
|
|
959
|
+
/**
|
|
960
|
+
* Loads the field value from its formatted text representation.
|
|
961
|
+
* @param valueText - Formatted text representation of field value. Formatting only includes data type formatting and not text formatting such as quoting, padding, truncating etc.
|
|
962
|
+
*/
|
|
963
|
+
loadValueText(valueText: string): void;
|
|
964
|
+
/**
|
|
965
|
+
* Loads the field headings from an array of strings.
|
|
966
|
+
*
|
|
967
|
+
* The headings are loaded according to the field's heading constraint. See {@link loadHeading} for more information.
|
|
968
|
+
*
|
|
969
|
+
* @param value - An array of headings. The length of the array should be equal to {@link headingCount}. Extra headings are ignored and missing headings are set to empty strings.
|
|
970
|
+
*/
|
|
795
971
|
loadHeadings(value: string[]): void;
|
|
972
|
+
/**
|
|
973
|
+
* Loads a heading into one of the field's heading lines.
|
|
974
|
+
*
|
|
975
|
+
* The heading is loaded according to the field's heading constraint.
|
|
976
|
+
*
|
|
977
|
+
* @param idx - Index of the heading to load.
|
|
978
|
+
* @param headingText - Text of the heading.
|
|
979
|
+
*/
|
|
796
980
|
loadHeading(idx: number, headingText: string): void;
|
|
797
|
-
/**
|
|
981
|
+
/**
|
|
982
|
+
* Checks if setting the field to null triggers a sequence redirect.
|
|
983
|
+
* @internal
|
|
984
|
+
*/
|
|
798
985
|
checkNullSequenceRedirect(): number;
|
|
799
986
|
/** @internal */
|
|
800
987
|
resetValue(): void;
|
|
@@ -806,40 +993,32 @@ export declare abstract class FtField {
|
|
|
806
993
|
loadFixedWidthValue(valueText: string): void;
|
|
807
994
|
/** @internal */
|
|
808
995
|
loadNullValue(): void;
|
|
809
|
-
/**
|
|
810
|
-
* Get the field value as text (for writing). Public accessor for protected method.
|
|
811
|
-
* @internal
|
|
812
|
-
*/
|
|
813
|
-
getValueText(): string;
|
|
814
|
-
/**
|
|
815
|
-
* Check if the field value has been assigned. Public accessor for protected property.
|
|
816
|
-
* @internal
|
|
817
|
-
*/
|
|
818
|
-
isValueAssigned(): boolean;
|
|
819
996
|
protected onSequenceRedirect(sequence: FtSequence | undefined, delay: FtSequenceInvokationDelay): number;
|
|
820
997
|
protected clearNonConstantNull(): void;
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
protected
|
|
826
|
-
protected
|
|
827
|
-
protected
|
|
828
|
-
protected
|
|
829
|
-
protected
|
|
830
|
-
protected
|
|
831
|
-
protected
|
|
832
|
-
protected
|
|
833
|
-
protected
|
|
834
|
-
protected
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
protected abstract
|
|
998
|
+
protected getAsString(): string;
|
|
999
|
+
protected getAsBoolean(): boolean;
|
|
1000
|
+
protected getAsInteger(): number;
|
|
1001
|
+
protected getAsBigInt(): bigint;
|
|
1002
|
+
protected getAsFloat(): number;
|
|
1003
|
+
protected getAsDateTime(): Date;
|
|
1004
|
+
protected getAsDecimal(): number;
|
|
1005
|
+
protected setAsString(_newValue: string): void;
|
|
1006
|
+
protected setAsBoolean(_newValue: boolean): void;
|
|
1007
|
+
protected setAsInteger(_newValue: number): void;
|
|
1008
|
+
protected setAsBigInt(_newValue: bigint): void;
|
|
1009
|
+
protected setAsFloat(_newValue: number): void;
|
|
1010
|
+
protected setAsDateTime(_newValue: Date): void;
|
|
1011
|
+
protected setAsDecimal(_newValue: number): void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Formats the field value to a string.
|
|
1014
|
+
*
|
|
1015
|
+
* The formatting includes data type formatting but not text formatting such as quoting, padding, truncating etc. This formatted string typically
|
|
1016
|
+
* is identical to the string value in the field's {@link valueText} property (unless the field value has been modified after loading).
|
|
1017
|
+
*/
|
|
1018
|
+
abstract formatValue(): string;
|
|
1019
|
+
protected abstract loadValueFromText(valueText: string): void;
|
|
1020
|
+
protected abstract getValue(): FtField.Value;
|
|
1021
|
+
protected abstract setValue(newValue: FtField.Value): number;
|
|
843
1022
|
protected abstract getAsRedirectBoolean(): boolean;
|
|
844
1023
|
protected abstract getAsRedirectInteger(): bigint;
|
|
845
1024
|
protected abstract getAsRedirectFloat(): number;
|
|
@@ -847,6 +1026,12 @@ export declare abstract class FtField {
|
|
|
847
1026
|
protected abstract getAsRedirectDecimal(): number;
|
|
848
1027
|
}
|
|
849
1028
|
|
|
1029
|
+
/** @public */
|
|
1030
|
+
export declare namespace FtField {
|
|
1031
|
+
export type Value = string | boolean | number | bigint | Date;
|
|
1032
|
+
export type NullableValue = Value | null;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
850
1035
|
/**
|
|
851
1036
|
* Abstract base class for all field definitions.
|
|
852
1037
|
* Field definitions hold metadata and configuration for fields in fielded text.
|
|
@@ -1012,8 +1197,10 @@ export declare class FtFloatField extends FtGenericField<number> {
|
|
|
1012
1197
|
get definition(): FtFloatFieldDefinition;
|
|
1013
1198
|
get format(): string;
|
|
1014
1199
|
get styles(): number;
|
|
1015
|
-
|
|
1016
|
-
|
|
1200
|
+
static cast(field: FtField): field is FtFloatField;
|
|
1201
|
+
setValue(newValue: FtField.Value): number;
|
|
1202
|
+
protected getAsFloat(): number;
|
|
1203
|
+
protected setAsFloat(newValue: number): void;
|
|
1017
1204
|
protected isValueEqual(left: number, right: number): boolean;
|
|
1018
1205
|
}
|
|
1019
1206
|
|
|
@@ -1028,7 +1215,7 @@ export declare class FtFloatFieldDefinition extends FtGenericFieldDefinition<num
|
|
|
1028
1215
|
get format(): string;
|
|
1029
1216
|
get styles(): number;
|
|
1030
1217
|
loadMeta(metaField: FtFloatMetaField, myCulture: DotNetLocaleSettings | undefined, myMainHeadingIndex: number): void;
|
|
1031
|
-
|
|
1218
|
+
formatValue(value: number): string;
|
|
1032
1219
|
parseValueText(text: string): number;
|
|
1033
1220
|
}
|
|
1034
1221
|
|
|
@@ -1078,37 +1265,23 @@ export declare class FtFloatMetaField extends FtGenericMetaField<number> {
|
|
|
1078
1265
|
* Provides type-safe value access and implements conversion methods.
|
|
1079
1266
|
* @public
|
|
1080
1267
|
*/
|
|
1081
|
-
export declare abstract class FtGenericField<T> extends FtField {
|
|
1268
|
+
export declare abstract class FtGenericField<T extends FtField.Value> extends FtField {
|
|
1082
1269
|
private _value;
|
|
1083
1270
|
protected constructor(sequenceInvokation: FtSequenceInvokation, sequenceItem: FtSequenceItem, valueTextNullTrimmable: boolean, definition: FtGenericFieldDefinition<T>);
|
|
1084
1271
|
get definition_(): FtGenericFieldDefinition<T>;
|
|
1085
1272
|
get value(): T;
|
|
1086
1273
|
set value(val: T);
|
|
1274
|
+
get nullableValue(): T | null;
|
|
1275
|
+
set nullableValue(value: T | null);
|
|
1087
1276
|
setValue(val: T): number;
|
|
1088
|
-
|
|
1089
|
-
protected
|
|
1090
|
-
protected getAsNonNullString(): string;
|
|
1091
|
-
protected getAsBoolean(): boolean;
|
|
1092
|
-
protected getAsInteger(): number;
|
|
1093
|
-
protected getAsBigInt(): bigint;
|
|
1094
|
-
protected getAsFloat(): number;
|
|
1095
|
-
protected getAsDateTime(): Date;
|
|
1096
|
-
protected getAsDecimal(): number;
|
|
1097
|
-
protected setAsNonNullObject(newValue: unknown): void;
|
|
1098
|
-
protected setAsNonNullString(newValue: string): void;
|
|
1099
|
-
protected setAsBoolean(newValue: boolean): void;
|
|
1100
|
-
protected setAsInteger(newValue: number): void;
|
|
1101
|
-
protected setAsBigInt(newValue: bigint): void;
|
|
1102
|
-
protected setAsFloat(newValue: number): void;
|
|
1103
|
-
protected setAsDateTime(newValue: Date): void;
|
|
1104
|
-
protected setAsDecimal(newValue: number): void;
|
|
1277
|
+
formatValue(): string;
|
|
1278
|
+
protected getValue(): T;
|
|
1105
1279
|
protected getAsRedirectBoolean(): boolean;
|
|
1106
1280
|
protected getAsRedirectInteger(): bigint;
|
|
1107
1281
|
protected getAsRedirectFloat(): number;
|
|
1108
1282
|
protected getAsRedirectDateTime(): Date;
|
|
1109
1283
|
protected getAsRedirectDecimal(): number;
|
|
1110
|
-
protected
|
|
1111
|
-
private getValueOrThrowNull;
|
|
1284
|
+
protected loadValueFromText(valueText: string): void;
|
|
1112
1285
|
private checkValueSequenceRedirect;
|
|
1113
1286
|
/**
|
|
1114
1287
|
* Check if two values are equal.
|
|
@@ -1139,7 +1312,7 @@ export declare abstract class FtGenericFieldDefinition<T> extends FtFieldDefinit
|
|
|
1139
1312
|
* @param value - The value to convert
|
|
1140
1313
|
* @returns The text representation
|
|
1141
1314
|
*/
|
|
1142
|
-
abstract
|
|
1315
|
+
abstract formatValue(value: T): string;
|
|
1143
1316
|
/**
|
|
1144
1317
|
* Parse text into a typed value.
|
|
1145
1318
|
* @param text - The text to parse
|
|
@@ -1167,10 +1340,15 @@ export declare abstract class FtGenericMetaField<T> extends FtMetaField {
|
|
|
1167
1340
|
* @public
|
|
1168
1341
|
*/
|
|
1169
1342
|
export declare const FtHeadingConstraint: {
|
|
1343
|
+
/** No constraings on headings */
|
|
1170
1344
|
readonly None: "None";
|
|
1345
|
+
/** All headings in the data must match the headings specified in the Meta */
|
|
1171
1346
|
readonly AllConstant: "AllConstant";
|
|
1347
|
+
/** The heading in the main heading line in the data must match the corresponding heading specified in the Meta */
|
|
1172
1348
|
readonly MainConstant: "MainConstant";
|
|
1349
|
+
/** The heading in the main heading line in the data must case-insensitively match the field's name */
|
|
1173
1350
|
readonly NameConstant: "NameConstant";
|
|
1351
|
+
/** The field's name is set to the heading in the main heading line in the data */
|
|
1174
1352
|
readonly NameIsMain: "NameIsMain";
|
|
1175
1353
|
};
|
|
1176
1354
|
|
|
@@ -1203,8 +1381,12 @@ export declare class FtIntegerField extends FtGenericField<bigint> {
|
|
|
1203
1381
|
get definition(): FtIntegerFieldDefinition;
|
|
1204
1382
|
get format(): string;
|
|
1205
1383
|
get styles(): number;
|
|
1206
|
-
|
|
1207
|
-
|
|
1384
|
+
static cast(field: FtField): field is FtIntegerField;
|
|
1385
|
+
setValue(newValue: FtField.Value): number;
|
|
1386
|
+
protected getAsBigInt(): bigint;
|
|
1387
|
+
protected setAsBigInt(newValue: bigint): void;
|
|
1388
|
+
protected getAsInteger(): number;
|
|
1389
|
+
protected setAsInteger(newValue: number): void;
|
|
1208
1390
|
protected isValueEqual(left: bigint, right: bigint): boolean;
|
|
1209
1391
|
}
|
|
1210
1392
|
|
|
@@ -1220,7 +1402,7 @@ export declare class FtIntegerFieldDefinition extends FtGenericFieldDefinition<b
|
|
|
1220
1402
|
get format(): string;
|
|
1221
1403
|
get styles(): number;
|
|
1222
1404
|
loadMeta(metaField: FtIntegerMetaField, myCulture: DotNetLocaleSettings | undefined, myMainHeadingIndex: number): void;
|
|
1223
|
-
|
|
1405
|
+
formatValue(value: bigint): string;
|
|
1224
1406
|
parseValueText(text: string): bigint;
|
|
1225
1407
|
}
|
|
1226
1408
|
|
|
@@ -1265,6 +1447,32 @@ export declare class FtIntegerMetaField extends FtGenericMetaField<bigint> {
|
|
|
1265
1447
|
protected assignFrom(source: FtMetaField): void;
|
|
1266
1448
|
}
|
|
1267
1449
|
|
|
1450
|
+
/** @public */
|
|
1451
|
+
export declare abstract class FtInternalError extends Error {
|
|
1452
|
+
readonly code: string;
|
|
1453
|
+
constructor(code: string, message: string | undefined, errorType: string);
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
/** @public */
|
|
1457
|
+
export declare namespace FtInternalError {
|
|
1458
|
+
const AssertErrorType = "FtAssert";
|
|
1459
|
+
const UnreachableCaseErrorType = "FtUnreachableCase";
|
|
1460
|
+
const ExtraFormatting: {
|
|
1461
|
+
readonly Ignore: "Ignore";
|
|
1462
|
+
readonly PrependWithColonSpace: "PrependWithColonSpace";
|
|
1463
|
+
readonly PrependWithColonSpaceQuoteError: "PrependWithColonSpaceQuoteError";
|
|
1464
|
+
readonly Postpend: "Postpend";
|
|
1465
|
+
readonly PostpendColonSpace: "PostpendColonSpace";
|
|
1466
|
+
readonly PostpendColonSpaceQuoted: "PostpendColonSpaceQuoted";
|
|
1467
|
+
};
|
|
1468
|
+
export type ExtraFormatting = (typeof ExtraFormatting)[keyof typeof ExtraFormatting];
|
|
1469
|
+
export function formatExtra(existingMessage: string, extraMessage: string, extraFormatting: ExtraFormatting): string;
|
|
1470
|
+
export function appendToErrorMessage(e: unknown, appendText: string): unknown;
|
|
1471
|
+
export function prependErrorMessage(e: unknown, prependText: string): unknown;
|
|
1472
|
+
export function createTypeIfNotError<E extends Error>(e: unknown, code: string, errorConstructor: new (code: string, message?: string) => E, extraMessage?: string, extraFormatting?: FtInternalError.ExtraFormatting): Error | E;
|
|
1473
|
+
export function throwErrorTypeIfPromiseRejected<T>(promise: Promise<T>, code: string, errorConstructor: new (code: string, message?: string) => Error, extraMessage?: string, extraFormatting?: FtInternalError.ExtraFormatting): void;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1268
1476
|
/**
|
|
1269
1477
|
* Serializes and deserializes FtMeta to/from JSON format.
|
|
1270
1478
|
* This provides a simpler alternative to XML serialization.
|
|
@@ -1877,7 +2085,7 @@ export declare class FtMetaSequenceList {
|
|
|
1877
2085
|
private readonly _list;
|
|
1878
2086
|
get count(): number;
|
|
1879
2087
|
get(index: number): FtMetaSequence;
|
|
1880
|
-
getByName(name: string): FtMetaSequence;
|
|
2088
|
+
getByName(name: string): FtMetaSequence | undefined;
|
|
1881
2089
|
set(value: readonly FtMetaSequence[]): void;
|
|
1882
2090
|
new(name?: string): FtMetaSequence;
|
|
1883
2091
|
removeAt(index: number): void;
|
|
@@ -2063,6 +2271,14 @@ export declare class FtMetaSubstitutionList {
|
|
|
2063
2271
|
assign(source: FtMetaSubstitutionList): void;
|
|
2064
2272
|
}
|
|
2065
2273
|
|
|
2274
|
+
/**
|
|
2275
|
+
* Thrown when a field value is null and an operation is attempted that requires a non-null value.
|
|
2276
|
+
* @public
|
|
2277
|
+
*/
|
|
2278
|
+
export declare class FtNullError extends Error {
|
|
2279
|
+
constructor(message: string);
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2066
2282
|
/**
|
|
2067
2283
|
* Meta sequence redirect that triggers when a field value is null.
|
|
2068
2284
|
* Used in metadata to define sequence transitions based on null field values.
|
|
@@ -2103,6 +2319,8 @@ export declare class FtNumberStylesMetaSerialization {
|
|
|
2103
2319
|
private static getDefaultNumberStyles;
|
|
2104
2320
|
}
|
|
2105
2321
|
|
|
2322
|
+
export { FtOk }
|
|
2323
|
+
|
|
2106
2324
|
/**
|
|
2107
2325
|
* @public
|
|
2108
2326
|
*/
|
|
@@ -2224,6 +2442,8 @@ export declare interface FtRecordStartedEventArgs {
|
|
|
2224
2442
|
recordIndex: number;
|
|
2225
2443
|
}
|
|
2226
2444
|
|
|
2445
|
+
export { FtResult }
|
|
2446
|
+
|
|
2227
2447
|
/**
|
|
2228
2448
|
* Represents a sequence of fielded text items.
|
|
2229
2449
|
* A sequence defines a pattern of fields that can be repeated.
|
|
@@ -2482,7 +2702,7 @@ export declare class FtSequenceRedirectFactory {
|
|
|
2482
2702
|
static unregisterConstructor(constructorOrType: FtSequenceRedirectConstructor | FtSequenceRedirectType | string): void;
|
|
2483
2703
|
static createSequenceRedirect(index: number, typeOrName: FtSequenceRedirectType | string): FtSequenceRedirect;
|
|
2484
2704
|
static getName(type: FtSequenceRedirectType): string;
|
|
2485
|
-
static tryGetType(typeName: string):
|
|
2705
|
+
static tryGetType(typeName: string): FtResult<FtSequenceRedirectType, boolean>;
|
|
2486
2706
|
private static tryFindConstructorByType;
|
|
2487
2707
|
private static tryFindConstructorByName;
|
|
2488
2708
|
}
|
|
@@ -2579,11 +2799,256 @@ export declare class FtSerialization {
|
|
|
2579
2799
|
private setCore;
|
|
2580
2800
|
}
|
|
2581
2801
|
|
|
2802
|
+
/**
|
|
2803
|
+
* Base class for serialization (reading/writing).
|
|
2804
|
+
* Manages configuration, field lists, sequences, and events.
|
|
2805
|
+
* @public
|
|
2806
|
+
*/
|
|
2807
|
+
export declare abstract class FtSerializationCore {
|
|
2808
|
+
static readonly VersionMajor = 1;
|
|
2809
|
+
static readonly VersionMinor = 1;
|
|
2810
|
+
static readonly PrefixSpaceChar = " ";
|
|
2811
|
+
protected static readonly Signature = "|!Fielded Text^|";
|
|
2812
|
+
protected static readonly VersionLabel = "Version";
|
|
2813
|
+
protected static readonly VersionSeparator = ".";
|
|
2814
|
+
protected static readonly CarriageReturnChar = "\r";
|
|
2815
|
+
protected static readonly LineFeedChar = "\n";
|
|
2816
|
+
protected static readonly CarriageReturnLineFeedString = "\r\n";
|
|
2817
|
+
onFieldHeadingReadReady?: (args: FtFieldHeadingReadyEventArgs) => void;
|
|
2818
|
+
onFieldHeadingWriteReady?: (args: FtFieldHeadingReadyEventArgs) => void;
|
|
2819
|
+
onFieldValueReadReady?: (args: FtFieldValueReadyEventArgs) => void;
|
|
2820
|
+
onFieldValueWriteReady?: (args: FtFieldValueReadyEventArgs) => void;
|
|
2821
|
+
onHeadingLineStarted?: (args: FtHeadingLineStartedEventArgs) => void;
|
|
2822
|
+
onHeadingLineFinished?: (args: FtHeadingLineFinishedEventArgs) => void;
|
|
2823
|
+
onRecordStarted?: (args: FtRecordStartedEventArgs) => void;
|
|
2824
|
+
onRecordFinished?: (args: FtRecordFinishedEventArgs) => void;
|
|
2825
|
+
onSequenceRedirected?: (args: FtSequenceRedirectedEventArgs) => void;
|
|
2826
|
+
protected _recordCount: number;
|
|
2827
|
+
protected _tableCount: number;
|
|
2828
|
+
private _fieldDefinitionList;
|
|
2829
|
+
private _fieldList;
|
|
2830
|
+
private _substitutionList;
|
|
2831
|
+
private _sequenceList;
|
|
2832
|
+
private _culture;
|
|
2833
|
+
private _endOfLineType;
|
|
2834
|
+
private _endOfLineChar;
|
|
2835
|
+
private _endOfLineAutoWriteType;
|
|
2836
|
+
private _lastLineEndedType;
|
|
2837
|
+
private _quoteChar;
|
|
2838
|
+
private _delimiterChar;
|
|
2839
|
+
private _lineCommentChar;
|
|
2840
|
+
private _allowEndOfLineCharInQuotes;
|
|
2841
|
+
private _ignoreBlankLines;
|
|
2842
|
+
private _ignoreExtraChars;
|
|
2843
|
+
private _allowIncompleteRecords;
|
|
2844
|
+
private _stuffedEmbeddedQuotes;
|
|
2845
|
+
private _substitutionsEnabled;
|
|
2846
|
+
private _substitutionChar;
|
|
2847
|
+
private _headingLineCount;
|
|
2848
|
+
private _mainHeadingLineIndex;
|
|
2849
|
+
private _headingConstraint;
|
|
2850
|
+
private _headingQuotedType;
|
|
2851
|
+
private _headingAlwaysWriteOptionalQuote;
|
|
2852
|
+
private _headingWritePrefixSpace;
|
|
2853
|
+
private _headingPadAlignment;
|
|
2854
|
+
private _headingPadCharType;
|
|
2855
|
+
private _headingPadChar;
|
|
2856
|
+
private _headingTruncateType;
|
|
2857
|
+
private _headingTruncateChar;
|
|
2858
|
+
private _headingEndOfValueChar;
|
|
2859
|
+
private _rootSequence;
|
|
2860
|
+
private _rootFieldCount;
|
|
2861
|
+
private _sequenceInvokationList;
|
|
2862
|
+
private _previousRecordSequenceInvokationList;
|
|
2863
|
+
private _rootSequenceInvokation;
|
|
2864
|
+
private _seeking;
|
|
2865
|
+
protected constructor();
|
|
2866
|
+
get fieldDefinitionList(): FtFieldDefinitionList;
|
|
2867
|
+
get fieldList(): FtFieldList;
|
|
2868
|
+
get substitutionList(): FtSubstitutionList;
|
|
2869
|
+
get sequenceList(): FtSequenceList;
|
|
2870
|
+
get sequenceInvokationList(): FtSequenceInvokationList;
|
|
2871
|
+
get previousRecordSequenceInvokationList(): FtSequenceInvokationList;
|
|
2872
|
+
get rootSequence(): FtSequence | undefined;
|
|
2873
|
+
get rootFieldCount(): number;
|
|
2874
|
+
get rootSequenceInvokation(): FtSequenceInvokation | undefined;
|
|
2875
|
+
get seeking(): boolean;
|
|
2876
|
+
get recordCount(): number;
|
|
2877
|
+
get tableCount(): number;
|
|
2878
|
+
get culture(): DotNetLocaleSettings;
|
|
2879
|
+
get endOfLineType(): FtEndOfLineType;
|
|
2880
|
+
get endOfLineChar(): string;
|
|
2881
|
+
get endOfLineAutoWriteType(): FtEndOfLineAutoWriteType;
|
|
2882
|
+
get lastLineEndedType(): FtLastLineEndedType;
|
|
2883
|
+
get quoteChar(): string;
|
|
2884
|
+
get delimiterChar(): string;
|
|
2885
|
+
get lineCommentChar(): string;
|
|
2886
|
+
get allowEndOfLineCharInQuotes(): boolean;
|
|
2887
|
+
get ignoreBlankLines(): boolean;
|
|
2888
|
+
get ignoreExtraChars(): boolean;
|
|
2889
|
+
get allowIncompleteRecords(): boolean;
|
|
2890
|
+
get stuffedEmbeddedQuotes(): boolean;
|
|
2891
|
+
get substitutionsEnabled(): boolean;
|
|
2892
|
+
get substitutionChar(): string;
|
|
2893
|
+
get headingLineCount(): number;
|
|
2894
|
+
get mainHeadingLineIndex(): number;
|
|
2895
|
+
get headingConstraint(): FtHeadingConstraint;
|
|
2896
|
+
get headingQuotedType(): FtQuotedType;
|
|
2897
|
+
get headingAlwaysWriteOptionalQuote(): boolean;
|
|
2898
|
+
get headingWritePrefixSpace(): boolean;
|
|
2899
|
+
get headingPadAlignment(): FtPadAlignment;
|
|
2900
|
+
get headingPadCharType(): FtPadCharType;
|
|
2901
|
+
get headingPadChar(): string;
|
|
2902
|
+
get headingTruncateType(): FtTruncateType;
|
|
2903
|
+
get headingTruncateChar(): string;
|
|
2904
|
+
get headingEndOfValueChar(): string;
|
|
2905
|
+
/**
|
|
2906
|
+
* Number of fields in the current record.
|
|
2907
|
+
*
|
|
2908
|
+
* IDataReader member
|
|
2909
|
+
*/
|
|
2910
|
+
get fieldCount(): number;
|
|
2911
|
+
/**
|
|
2912
|
+
* Number of sequences currently invoked (depth of sequence invokation stack).
|
|
2913
|
+
*
|
|
2914
|
+
* IDataReader member
|
|
2915
|
+
*/
|
|
2916
|
+
get depth(): number;
|
|
2917
|
+
/**
|
|
2918
|
+
* Whether the reader/writer is closed.
|
|
2919
|
+
*
|
|
2920
|
+
* IDataReader member
|
|
2921
|
+
*/
|
|
2922
|
+
abstract get isClosed(): boolean;
|
|
2923
|
+
/**
|
|
2924
|
+
* Name of the field at the given index.
|
|
2925
|
+
* Alias for {@link getFieldName}.
|
|
2926
|
+
*
|
|
2927
|
+
* IDataReader member
|
|
2928
|
+
*/
|
|
2929
|
+
getName(idx: number): string;
|
|
2930
|
+
/**
|
|
2931
|
+
* Get a index of field in record by its name.
|
|
2932
|
+
*
|
|
2933
|
+
* IDataReader member
|
|
2934
|
+
* @throws Error if the field is not found.
|
|
2935
|
+
*/
|
|
2936
|
+
getOrdinal(name: string): number;
|
|
2937
|
+
/**
|
|
2938
|
+
* Whether the field value at the given index is null.
|
|
2939
|
+
* Alias for {@link isFieldNull}.
|
|
2940
|
+
*
|
|
2941
|
+
* IDataReader member
|
|
2942
|
+
*/
|
|
2943
|
+
isDBNull(idx: number): boolean;
|
|
2944
|
+
/**
|
|
2945
|
+
* Get a FtField object at index.
|
|
2946
|
+
*/
|
|
2947
|
+
getField(idx: number): FtField;
|
|
2948
|
+
/**
|
|
2949
|
+
* Get a FtField object by name.
|
|
2950
|
+
*/
|
|
2951
|
+
getFieldByName(name: string): FtField | undefined;
|
|
2952
|
+
/**
|
|
2953
|
+
* Get a index of field in record by its name.
|
|
2954
|
+
* @throws Error if the field is not found.
|
|
2955
|
+
*/
|
|
2956
|
+
getFieldIndexByName(name: string): number | undefined;
|
|
2957
|
+
/**
|
|
2958
|
+
* Get the name of the field at the given index.
|
|
2959
|
+
*/
|
|
2960
|
+
getFieldName(idx: number): string;
|
|
2961
|
+
/**
|
|
2962
|
+
* Get a field value by index.
|
|
2963
|
+
* @throws FtFieldNullError if the field value is null.
|
|
2964
|
+
*/
|
|
2965
|
+
getFieldValue(idx: number): FtField.Value | null;
|
|
2966
|
+
/**
|
|
2967
|
+
* Whether the field value at the given index is null.
|
|
2968
|
+
*/
|
|
2969
|
+
isFieldNull(idx: number): boolean;
|
|
2970
|
+
/**
|
|
2971
|
+
* Get the value type of the field at the given index.
|
|
2972
|
+
*/
|
|
2973
|
+
getFieldValueType(idx: number): string;
|
|
2974
|
+
/**
|
|
2975
|
+
* Get a field value by index. Returns `null` if the field value is null.
|
|
2976
|
+
*/
|
|
2977
|
+
getFieldNullableValue(idx: number): FtField.Value | null;
|
|
2978
|
+
/**
|
|
2979
|
+
* Get a field value by name.
|
|
2980
|
+
* @throws FtFieldNullError if the field value is null.
|
|
2981
|
+
* @throws Error if the field is not found.
|
|
2982
|
+
*/
|
|
2983
|
+
getFieldValueByName(name: string): FtField.Value | null;
|
|
2984
|
+
/**
|
|
2985
|
+
* Get a field value by name. Returns `null` if the field value is null.
|
|
2986
|
+
* @throws Error if the field is not found.
|
|
2987
|
+
*/
|
|
2988
|
+
getFieldNullableValueByName(name: string): FtField.Value | null;
|
|
2989
|
+
tryGetSubstitutionValue(token: string): {
|
|
2990
|
+
found: boolean;
|
|
2991
|
+
value: string;
|
|
2992
|
+
};
|
|
2993
|
+
/**
|
|
2994
|
+
* Load configuration from FtMeta.
|
|
2995
|
+
*/
|
|
2996
|
+
loadMeta(meta: FtMeta): void;
|
|
2997
|
+
/**
|
|
2998
|
+
* Invoke the root sequence to begin reading/writing.
|
|
2999
|
+
* @internal For testing purposes, can be called to initialize field list.
|
|
3000
|
+
*/
|
|
3001
|
+
invokeRootSequence(): void;
|
|
3002
|
+
/** @internal */
|
|
3003
|
+
fireFieldHeadingReadReady(field: FtField, lineIndex: number): void;
|
|
3004
|
+
/** @internal */
|
|
3005
|
+
fireFieldValueReadReady(field: FtField, recordIndex: number): void;
|
|
3006
|
+
protected internalLoadMeta(meta: FtMeta): void;
|
|
3007
|
+
protected setSeeking(value: boolean): void;
|
|
3008
|
+
protected setLineCommentChar(aChar: string): void;
|
|
3009
|
+
protected redirect(redirectingField: FtField, invokedSequence: FtSequence, invokationDelay: FtSequenceInvokationDelay): number;
|
|
3010
|
+
protected unredirect(unredirectingField: FtField): number;
|
|
3011
|
+
protected fireFieldHeadingWriteReady(field: FtField, lineIndex: number): void;
|
|
3012
|
+
protected fireFieldValueWriteReady(field: FtField, recordIndex: number): void;
|
|
3013
|
+
protected fireHeadingLineStarted(lineIndex: number): void;
|
|
3014
|
+
protected fireHeadingLineFinished(lineIndex: number): void;
|
|
3015
|
+
protected fireRecordStarted(recordIndex: number): void;
|
|
3016
|
+
protected fireRecordFinished(recordIndex: number): void;
|
|
3017
|
+
protected fireSequenceRedirected(redirectingField: FtField, fieldsAffectedFromIndex: number): void;
|
|
3018
|
+
/**
|
|
3019
|
+
* Reset serialization state.
|
|
3020
|
+
*/
|
|
3021
|
+
protected reset(): void;
|
|
3022
|
+
private resetAllFieldValues;
|
|
3023
|
+
private resetFieldValues;
|
|
3024
|
+
private handleSequenceRedirectEvent;
|
|
3025
|
+
private calculateAutoEndOfLineSubstitutionValue;
|
|
3026
|
+
abstract close(): void;
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* Exception thrown during fielded text serialization/deserialization.
|
|
3031
|
+
* @public
|
|
3032
|
+
*/
|
|
3033
|
+
export declare class FtSerializationError extends Error {
|
|
3034
|
+
private readonly _error;
|
|
3035
|
+
private readonly _fieldName;
|
|
3036
|
+
private readonly _fieldIndex;
|
|
3037
|
+
private readonly _sequenceName;
|
|
3038
|
+
private readonly _sequenceItemIndex;
|
|
3039
|
+
constructor(errorCode: FtSerializationErrorCode, fieldOrMessage: FtField | string | undefined, messageOrInner?: string | Error, innerException?: Error);
|
|
3040
|
+
get error(): FtSerializationErrorCode;
|
|
3041
|
+
get fieldName(): string | undefined;
|
|
3042
|
+
get fieldIndex(): number;
|
|
3043
|
+
get sequenceName(): string | undefined;
|
|
3044
|
+
get sequenceItemIndex(): number;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
2582
3047
|
/**
|
|
2583
3048
|
* Enumeration of serialization error codes.
|
|
2584
3049
|
* @public
|
|
2585
3050
|
*/
|
|
2586
|
-
export declare const
|
|
3051
|
+
export declare const FtSerializationErrorCode: {
|
|
2587
3052
|
readonly Abort: "Abort";
|
|
2588
3053
|
readonly DeclarationParameterNameIsZeroLength: "DeclarationParameterNameIsZeroLength";
|
|
2589
3054
|
readonly DeclaredParameterNameContainsSeparator: "DeclaredParameterNameContainsSeparator";
|
|
@@ -2631,31 +3096,13 @@ export declare const FtSerializationError: {
|
|
|
2631
3096
|
/**
|
|
2632
3097
|
* @public
|
|
2633
3098
|
*/
|
|
2634
|
-
export declare type
|
|
2635
|
-
|
|
2636
|
-
/**
|
|
2637
|
-
* Exception thrown during fielded text serialization/deserialization.
|
|
2638
|
-
* @public
|
|
2639
|
-
*/
|
|
2640
|
-
export declare class FtSerializationException extends Error {
|
|
2641
|
-
private readonly _error;
|
|
2642
|
-
private readonly _fieldName;
|
|
2643
|
-
private readonly _fieldIndex;
|
|
2644
|
-
private readonly _sequenceName;
|
|
2645
|
-
private readonly _sequenceItemIndex;
|
|
2646
|
-
constructor(error: FtSerializationError, fieldOrMessage: FtField | string | undefined, messageOrInner?: string | Error, innerException?: Error);
|
|
2647
|
-
get error(): FtSerializationError;
|
|
2648
|
-
get fieldName(): string | undefined;
|
|
2649
|
-
get fieldIndex(): number;
|
|
2650
|
-
get sequenceName(): string | undefined;
|
|
2651
|
-
get sequenceItemIndex(): number;
|
|
2652
|
-
}
|
|
3099
|
+
export declare type FtSerializationErrorCode = (typeof FtSerializationErrorCode)[keyof typeof FtSerializationErrorCode];
|
|
2653
3100
|
|
|
2654
3101
|
/**
|
|
2655
3102
|
* Reader for fielded text streams. Coordinates all parsing components.
|
|
2656
3103
|
* @public
|
|
2657
3104
|
*/
|
|
2658
|
-
export declare class FtSerializationReader extends
|
|
3105
|
+
export declare class FtSerializationReader extends FtSerializationCore {
|
|
2659
3106
|
/**
|
|
2660
3107
|
* Event fired when seeking through records.
|
|
2661
3108
|
*/
|
|
@@ -2800,22 +3247,6 @@ export declare class FtSerializationReader extends SerializationCore {
|
|
|
2800
3247
|
* Seek to the end of the stream.
|
|
2801
3248
|
*/
|
|
2802
3249
|
seekEnd(): void;
|
|
2803
|
-
/**
|
|
2804
|
-
* Get a field object by index.
|
|
2805
|
-
*/
|
|
2806
|
-
getField(idx: number): FtField;
|
|
2807
|
-
/**
|
|
2808
|
-
* Get a field object by name.
|
|
2809
|
-
*/
|
|
2810
|
-
getFieldByName(name: string): FtField | undefined;
|
|
2811
|
-
/**
|
|
2812
|
-
* Get a field value by index.
|
|
2813
|
-
*/
|
|
2814
|
-
getFieldValue(idx: number): unknown;
|
|
2815
|
-
/**
|
|
2816
|
-
* Get a field value by name.
|
|
2817
|
-
*/
|
|
2818
|
-
getFieldValueByName(name: string): unknown;
|
|
2819
3250
|
/**
|
|
2820
3251
|
* Load metadata from a pre-parsed FtMeta object.
|
|
2821
3252
|
* @param meta - The metadata to load.
|
|
@@ -2865,7 +3296,7 @@ export declare namespace FtSerializationReader {
|
|
|
2865
3296
|
* Writer for fielded text streams. Coordinates all writing logic.
|
|
2866
3297
|
* @public
|
|
2867
3298
|
*/
|
|
2868
|
-
export declare class FtSerializationWriter extends
|
|
3299
|
+
export declare class FtSerializationWriter extends FtSerializationCore {
|
|
2869
3300
|
private static readonly DECLARATION_LINE2_BEFORE_COMMENT_CHARS;
|
|
2870
3301
|
private static readonly EMBEDDED_META_BEFORE_COMMENT_CHARS;
|
|
2871
3302
|
private _loadedMeta;
|
|
@@ -2914,45 +3345,85 @@ export declare class FtSerializationWriter extends SerializationCore {
|
|
|
2914
3345
|
*/
|
|
2915
3346
|
flush(): void;
|
|
2916
3347
|
/**
|
|
2917
|
-
* Set a field value by index.
|
|
3348
|
+
* Set a field value by index. Accepts `null` to set the field to null.
|
|
3349
|
+
*
|
|
3350
|
+
* @param idx - The 0-based index of the field to set.
|
|
3351
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
3352
|
+
*
|
|
3353
|
+
* @throws FtTypeError if the value being set is not of the field's expected type.
|
|
2918
3354
|
*/
|
|
2919
|
-
setFieldValue(idx: number, value:
|
|
3355
|
+
setFieldValue(idx: number, value: FtField.Value | null): void;
|
|
2920
3356
|
/**
|
|
2921
3357
|
* Set a field value by name.
|
|
3358
|
+
*
|
|
3359
|
+
* @param name - The name of the field to set.
|
|
3360
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
3361
|
+
*
|
|
3362
|
+
* @throws FtTypeError if the value being set is not of the field's expected type.
|
|
2922
3363
|
*/
|
|
2923
|
-
setFieldValueByName(name: string, value:
|
|
3364
|
+
setFieldValueByName(name: string, value: FtField.Value | null): void;
|
|
2924
3365
|
/**
|
|
2925
3366
|
* Set a field to null.
|
|
3367
|
+
*
|
|
3368
|
+
* @param idx - The 0-based index of the field to set.
|
|
2926
3369
|
*/
|
|
2927
3370
|
setNull(idx: number): void;
|
|
3371
|
+
/**
|
|
3372
|
+
* Set a field to null.
|
|
3373
|
+
*
|
|
3374
|
+
* @param name - The name of the field to set.
|
|
3375
|
+
*/
|
|
3376
|
+
setNullByName(name: string): void;
|
|
2928
3377
|
/**
|
|
2929
3378
|
* Set a boolean field.
|
|
3379
|
+
*
|
|
3380
|
+
* @param idx - The 0-based index of the field to set.
|
|
3381
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
2930
3382
|
*/
|
|
2931
|
-
setBoolean(idx: number, value: boolean): void;
|
|
3383
|
+
setBoolean(idx: number, value: boolean | null): void;
|
|
2932
3384
|
/**
|
|
2933
|
-
* Set a
|
|
3385
|
+
* Set a DateTime field's value.
|
|
3386
|
+
*
|
|
3387
|
+
* @param idx - The 0-based index of the field to set.
|
|
3388
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
2934
3389
|
*/
|
|
2935
|
-
setDateTime(idx: number, value: Date): void;
|
|
3390
|
+
setDateTime(idx: number, value: Date | null): void;
|
|
2936
3391
|
/**
|
|
2937
3392
|
* Set a decimal field.
|
|
3393
|
+
*
|
|
3394
|
+
* @param idx - The 0-based index of the field to set.
|
|
3395
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
2938
3396
|
*/
|
|
2939
|
-
setDecimal(idx: number, value: number): void;
|
|
3397
|
+
setDecimal(idx: number, value: number | null): void;
|
|
2940
3398
|
/**
|
|
2941
3399
|
* Set a float field.
|
|
3400
|
+
*
|
|
3401
|
+
* @param idx - The 0-based index of the field to set.
|
|
3402
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
2942
3403
|
*/
|
|
2943
|
-
setFloat(idx: number, value: number): void;
|
|
3404
|
+
setFloat(idx: number, value: number | null): void;
|
|
2944
3405
|
/**
|
|
2945
3406
|
* Set an integer field.
|
|
3407
|
+
*
|
|
3408
|
+
* @param idx - The 0-based index of the field to set.
|
|
3409
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
2946
3410
|
*/
|
|
2947
|
-
setInteger(idx: number, value: number | bigint): void;
|
|
3411
|
+
setInteger(idx: number, value: number | bigint | null): void;
|
|
2948
3412
|
/**
|
|
2949
3413
|
* Set a string field.
|
|
3414
|
+
*
|
|
3415
|
+
* @param idx - The 0-based index of the field to set.
|
|
3416
|
+
* @param value - The value to set for the field. Can be `null` to set the field to null.
|
|
2950
3417
|
*/
|
|
2951
|
-
setString(idx: number, value: string): void;
|
|
3418
|
+
setString(idx: number, value: string | null): void;
|
|
2952
3419
|
/**
|
|
2953
3420
|
* Set multiple field values.
|
|
3421
|
+
*
|
|
3422
|
+
* @param values - An array of values to set for the fields. The length of the array must not exceed the number of fields. Array elements can be null to set the corresponding field to null.
|
|
3423
|
+
*
|
|
3424
|
+
* @throws FtTypeError if any of the values being set is not of the corresponding field's expected type.
|
|
2954
3425
|
*/
|
|
2955
|
-
setValues(values:
|
|
3426
|
+
setValues(values: (FtField.Value | null)[]): void;
|
|
2956
3427
|
protected reset(): void;
|
|
2957
3428
|
/**
|
|
2958
3429
|
* Internal load metadata. Override from SerializationCore.
|
|
@@ -2995,9 +3466,10 @@ export declare class FtSerializationWriter extends SerializationCore {
|
|
|
2995
3466
|
export declare class FtStringField extends FtGenericField<string> {
|
|
2996
3467
|
private static readonly VALUE_TEXT_NULL_TRIMMABLE;
|
|
2997
3468
|
constructor(sequenceInvokation: FtSequenceInvokation, sequenceItem: FtSequenceItem, definition: FtStringFieldDefinition);
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3469
|
+
static cast(field: FtField): field is FtStringField;
|
|
3470
|
+
setValue(newValue: FtField.Value): number;
|
|
3471
|
+
protected getAsString(): string;
|
|
3472
|
+
protected setAsString(newValue: string): void;
|
|
3001
3473
|
protected isValueEqual(left: string, right: string): boolean;
|
|
3002
3474
|
}
|
|
3003
3475
|
|
|
@@ -3009,7 +3481,7 @@ export declare class FtStringFieldDefinition extends FtGenericFieldDefinition<st
|
|
|
3009
3481
|
static readonly AUTO_LEFT_PAD = false;
|
|
3010
3482
|
protected formatter: FtStringFieldFormatter;
|
|
3011
3483
|
constructor(index: number);
|
|
3012
|
-
|
|
3484
|
+
formatValue(value: string): string;
|
|
3013
3485
|
parseValueText(text: string): string;
|
|
3014
3486
|
}
|
|
3015
3487
|
|
|
@@ -3213,6 +3685,14 @@ export declare const FtTruncateType: {
|
|
|
3213
3685
|
*/
|
|
3214
3686
|
export declare type FtTruncateType = (typeof FtTruncateType)[keyof typeof FtTruncateType];
|
|
3215
3687
|
|
|
3688
|
+
/**
|
|
3689
|
+
* Thrown when a field value is of an unexpected type.
|
|
3690
|
+
* @public
|
|
3691
|
+
*/
|
|
3692
|
+
export declare class FtTypeError extends TypeError {
|
|
3693
|
+
constructor(message: string);
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3216
3696
|
/**
|
|
3217
3697
|
* High-level writer for fielded text files.
|
|
3218
3698
|
* Provides a convenient API for writing CSV and other delimited/fixed-width text.
|
|
@@ -3317,163 +3797,11 @@ export declare namespace FtXmlMetaSerialization {
|
|
|
3317
3797
|
export function deserialize(xml: string, warnings?: string[]): FtMeta;
|
|
3318
3798
|
}
|
|
3319
3799
|
|
|
3320
|
-
export { Result }
|
|
3321
|
-
|
|
3322
3800
|
/**
|
|
3323
3801
|
* @public
|
|
3324
3802
|
*/
|
|
3325
3803
|
declare type RootedEventHandler = (sequence: FtMetaSequence) => void;
|
|
3326
3804
|
|
|
3327
|
-
/**
|
|
3328
|
-
* Base class for serialization (reading/writing).
|
|
3329
|
-
* Manages configuration, field lists, sequences, and events.
|
|
3330
|
-
* @public
|
|
3331
|
-
*/
|
|
3332
|
-
declare abstract class SerializationCore {
|
|
3333
|
-
static readonly VersionMajor = 1;
|
|
3334
|
-
static readonly VersionMinor = 1;
|
|
3335
|
-
static readonly PrefixSpaceChar = " ";
|
|
3336
|
-
protected static readonly Signature = "|!Fielded Text^|";
|
|
3337
|
-
protected static readonly VersionLabel = "Version";
|
|
3338
|
-
protected static readonly VersionSeparator = ".";
|
|
3339
|
-
protected static readonly CarriageReturnChar = "\r";
|
|
3340
|
-
protected static readonly LineFeedChar = "\n";
|
|
3341
|
-
protected static readonly CarriageReturnLineFeedString = "\r\n";
|
|
3342
|
-
onFieldHeadingReadReady?: (args: FtFieldHeadingReadyEventArgs) => void;
|
|
3343
|
-
onFieldHeadingWriteReady?: (args: FtFieldHeadingReadyEventArgs) => void;
|
|
3344
|
-
onFieldValueReadReady?: (args: FtFieldValueReadyEventArgs) => void;
|
|
3345
|
-
onFieldValueWriteReady?: (args: FtFieldValueReadyEventArgs) => void;
|
|
3346
|
-
onHeadingLineStarted?: (args: FtHeadingLineStartedEventArgs) => void;
|
|
3347
|
-
onHeadingLineFinished?: (args: FtHeadingLineFinishedEventArgs) => void;
|
|
3348
|
-
onRecordStarted?: (args: FtRecordStartedEventArgs) => void;
|
|
3349
|
-
onRecordFinished?: (args: FtRecordFinishedEventArgs) => void;
|
|
3350
|
-
onSequenceRedirected?: (args: FtSequenceRedirectedEventArgs) => void;
|
|
3351
|
-
protected _recordCount: number;
|
|
3352
|
-
protected _tableCount: number;
|
|
3353
|
-
private _fieldDefinitionList;
|
|
3354
|
-
private _fieldList;
|
|
3355
|
-
private _substitutionList;
|
|
3356
|
-
private _sequenceList;
|
|
3357
|
-
private _culture;
|
|
3358
|
-
private _endOfLineType;
|
|
3359
|
-
private _endOfLineChar;
|
|
3360
|
-
private _endOfLineAutoWriteType;
|
|
3361
|
-
private _lastLineEndedType;
|
|
3362
|
-
private _quoteChar;
|
|
3363
|
-
private _delimiterChar;
|
|
3364
|
-
private _lineCommentChar;
|
|
3365
|
-
private _allowEndOfLineCharInQuotes;
|
|
3366
|
-
private _ignoreBlankLines;
|
|
3367
|
-
private _ignoreExtraChars;
|
|
3368
|
-
private _allowIncompleteRecords;
|
|
3369
|
-
private _stuffedEmbeddedQuotes;
|
|
3370
|
-
private _substitutionsEnabled;
|
|
3371
|
-
private _substitutionChar;
|
|
3372
|
-
private _headingLineCount;
|
|
3373
|
-
private _mainHeadingLineIndex;
|
|
3374
|
-
private _headingConstraint;
|
|
3375
|
-
private _headingQuotedType;
|
|
3376
|
-
private _headingAlwaysWriteOptionalQuote;
|
|
3377
|
-
private _headingWritePrefixSpace;
|
|
3378
|
-
private _headingPadAlignment;
|
|
3379
|
-
private _headingPadCharType;
|
|
3380
|
-
private _headingPadChar;
|
|
3381
|
-
private _headingTruncateType;
|
|
3382
|
-
private _headingTruncateChar;
|
|
3383
|
-
private _headingEndOfValueChar;
|
|
3384
|
-
private _rootSequence;
|
|
3385
|
-
private _rootFieldCount;
|
|
3386
|
-
private _sequenceInvokationList;
|
|
3387
|
-
private _previousRecordSequenceInvokationList;
|
|
3388
|
-
private _rootSequenceInvokation;
|
|
3389
|
-
private _seeking;
|
|
3390
|
-
protected constructor();
|
|
3391
|
-
get fieldDefinitionList(): FtFieldDefinitionList;
|
|
3392
|
-
get fieldList(): FtFieldList;
|
|
3393
|
-
get substitutionList(): FtSubstitutionList;
|
|
3394
|
-
get sequenceList(): FtSequenceList;
|
|
3395
|
-
get sequenceInvokationList(): FtSequenceInvokationList;
|
|
3396
|
-
get previousRecordSequenceInvokationList(): FtSequenceInvokationList;
|
|
3397
|
-
get rootSequence(): FtSequence | undefined;
|
|
3398
|
-
get rootFieldCount(): number;
|
|
3399
|
-
get rootSequenceInvokation(): FtSequenceInvokation | undefined;
|
|
3400
|
-
get seeking(): boolean;
|
|
3401
|
-
get recordCount(): number;
|
|
3402
|
-
get tableCount(): number;
|
|
3403
|
-
get culture(): DotNetLocaleSettings;
|
|
3404
|
-
get endOfLineType(): FtEndOfLineType;
|
|
3405
|
-
get endOfLineChar(): string;
|
|
3406
|
-
get endOfLineAutoWriteType(): FtEndOfLineAutoWriteType;
|
|
3407
|
-
get lastLineEndedType(): FtLastLineEndedType;
|
|
3408
|
-
get quoteChar(): string;
|
|
3409
|
-
get delimiterChar(): string;
|
|
3410
|
-
get lineCommentChar(): string;
|
|
3411
|
-
get allowEndOfLineCharInQuotes(): boolean;
|
|
3412
|
-
get ignoreBlankLines(): boolean;
|
|
3413
|
-
get ignoreExtraChars(): boolean;
|
|
3414
|
-
get allowIncompleteRecords(): boolean;
|
|
3415
|
-
get stuffedEmbeddedQuotes(): boolean;
|
|
3416
|
-
get substitutionsEnabled(): boolean;
|
|
3417
|
-
get substitutionChar(): string;
|
|
3418
|
-
get headingLineCount(): number;
|
|
3419
|
-
get mainHeadingLineIndex(): number;
|
|
3420
|
-
get headingConstraint(): FtHeadingConstraint;
|
|
3421
|
-
get headingQuotedType(): FtQuotedType;
|
|
3422
|
-
get headingAlwaysWriteOptionalQuote(): boolean;
|
|
3423
|
-
get headingWritePrefixSpace(): boolean;
|
|
3424
|
-
get headingPadAlignment(): FtPadAlignment;
|
|
3425
|
-
get headingPadCharType(): FtPadCharType;
|
|
3426
|
-
get headingPadChar(): string;
|
|
3427
|
-
get headingTruncateType(): FtTruncateType;
|
|
3428
|
-
get headingTruncateChar(): string;
|
|
3429
|
-
get headingEndOfValueChar(): string;
|
|
3430
|
-
get fieldCount(): number;
|
|
3431
|
-
get depth(): number;
|
|
3432
|
-
abstract get isClosed(): boolean;
|
|
3433
|
-
getName(idx: number): string;
|
|
3434
|
-
getOrdinal(name: string): number;
|
|
3435
|
-
getValueType(idx: number): string;
|
|
3436
|
-
isDBNull(idx: number): boolean;
|
|
3437
|
-
tryGetSubstitutionValue(token: string): {
|
|
3438
|
-
found: boolean;
|
|
3439
|
-
value: string;
|
|
3440
|
-
};
|
|
3441
|
-
/**
|
|
3442
|
-
* Load configuration from FtMeta.
|
|
3443
|
-
*/
|
|
3444
|
-
loadMeta(meta: FtMeta): void;
|
|
3445
|
-
/**
|
|
3446
|
-
* Invoke the root sequence to begin reading/writing.
|
|
3447
|
-
* @internal For testing purposes, can be called to initialize field list.
|
|
3448
|
-
*/
|
|
3449
|
-
invokeRootSequence(): void;
|
|
3450
|
-
/** @internal */
|
|
3451
|
-
fireFieldHeadingReadReady(field: FtField, lineIndex: number): void;
|
|
3452
|
-
/** @internal */
|
|
3453
|
-
fireFieldValueReadReady(field: FtField, recordIndex: number): void;
|
|
3454
|
-
protected internalLoadMeta(meta: FtMeta): void;
|
|
3455
|
-
protected setSeeking(value: boolean): void;
|
|
3456
|
-
protected setLineCommentChar(aChar: string): void;
|
|
3457
|
-
protected redirect(redirectingField: FtField, invokedSequence: FtSequence, invokationDelay: FtSequenceInvokationDelay): number;
|
|
3458
|
-
protected unredirect(unredirectingField: FtField): number;
|
|
3459
|
-
protected fireFieldHeadingWriteReady(field: FtField, lineIndex: number): void;
|
|
3460
|
-
protected fireFieldValueWriteReady(field: FtField, recordIndex: number): void;
|
|
3461
|
-
protected fireHeadingLineStarted(lineIndex: number): void;
|
|
3462
|
-
protected fireHeadingLineFinished(lineIndex: number): void;
|
|
3463
|
-
protected fireRecordStarted(recordIndex: number): void;
|
|
3464
|
-
protected fireRecordFinished(recordIndex: number): void;
|
|
3465
|
-
protected fireSequenceRedirected(redirectingField: FtField, fieldsAffectedFromIndex: number): void;
|
|
3466
|
-
/**
|
|
3467
|
-
* Reset serialization state.
|
|
3468
|
-
*/
|
|
3469
|
-
protected reset(): void;
|
|
3470
|
-
private resetAllFieldValues;
|
|
3471
|
-
private resetFieldValues;
|
|
3472
|
-
private handleSequenceRedirectEvent;
|
|
3473
|
-
private calculateAutoEndOfLineSubstitutionValue;
|
|
3474
|
-
abstract close(): void;
|
|
3475
|
-
}
|
|
3476
|
-
|
|
3477
3805
|
declare interface Version {
|
|
3478
3806
|
major: number;
|
|
3479
3807
|
minor: number;
|