beancount 0.2.4 → 0.2.6

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.
Files changed (66) hide show
  1. package/build/src/classes/Node.mjs +7 -7
  2. package/build/src/classes/nodes/Blankline.mjs +2 -6
  3. package/build/src/classes/nodes/Transaction/Posting.mjs +1 -1
  4. package/build/src/genericParse.d.mts +8 -2
  5. package/build/src/genericParse.mjs +19 -20
  6. package/build/src/main.d.mts +1 -1
  7. package/build/src/parse.mjs +1 -1
  8. package/build/src/utils/SourceLocation.d.mts +27 -4
  9. package/build/src/utils/splitStringIntoSourceFragments.d.ts +1 -1
  10. package/build/src/utils/splitStringIntoSourceFragments.js +63 -11
  11. package/build/tsconfig.build.tsbuildinfo +1 -1
  12. package/package.json +7 -7
  13. package/build/src/classes/DateEntry.d.mts +0 -47
  14. package/build/src/classes/DateEntry.mjs +0 -60
  15. package/build/src/classes/Entry.d.mts +0 -92
  16. package/build/src/classes/Entry.mjs +0 -107
  17. package/build/src/classes/entryTypes/Balance.d.mts +0 -32
  18. package/build/src/classes/entryTypes/Balance.mjs +0 -50
  19. package/build/src/classes/entryTypes/Blankline.d.mts +0 -24
  20. package/build/src/classes/entryTypes/Blankline.mjs +0 -38
  21. package/build/src/classes/entryTypes/Close.d.mts +0 -20
  22. package/build/src/classes/entryTypes/Close.mjs +0 -31
  23. package/build/src/classes/entryTypes/Comment.d.mts +0 -25
  24. package/build/src/classes/entryTypes/Comment.mjs +0 -42
  25. package/build/src/classes/entryTypes/Commodity.d.mts +0 -20
  26. package/build/src/classes/entryTypes/Commodity.mjs +0 -31
  27. package/build/src/classes/entryTypes/Custom.d.mts +0 -23
  28. package/build/src/classes/entryTypes/Custom.mjs +0 -38
  29. package/build/src/classes/entryTypes/Document.d.mts +0 -22
  30. package/build/src/classes/entryTypes/Document.mjs +0 -34
  31. package/build/src/classes/entryTypes/Event.d.mts +0 -23
  32. package/build/src/classes/entryTypes/Event.mjs +0 -34
  33. package/build/src/classes/entryTypes/Include.d.mts +0 -20
  34. package/build/src/classes/entryTypes/Include.mjs +0 -31
  35. package/build/src/classes/entryTypes/Note.d.mts +0 -22
  36. package/build/src/classes/entryTypes/Note.mjs +0 -34
  37. package/build/src/classes/entryTypes/Open.d.mts +0 -27
  38. package/build/src/classes/entryTypes/Open.mjs +0 -66
  39. package/build/src/classes/entryTypes/Option.d.mts +0 -23
  40. package/build/src/classes/entryTypes/Option.mjs +0 -32
  41. package/build/src/classes/entryTypes/Pad.d.mts +0 -22
  42. package/build/src/classes/entryTypes/Pad.mjs +0 -33
  43. package/build/src/classes/entryTypes/Plugin.d.mts +0 -22
  44. package/build/src/classes/entryTypes/Plugin.mjs +0 -36
  45. package/build/src/classes/entryTypes/Poptag.d.mts +0 -21
  46. package/build/src/classes/entryTypes/Poptag.mjs +0 -34
  47. package/build/src/classes/entryTypes/Price.d.mts +0 -32
  48. package/build/src/classes/entryTypes/Price.mjs +0 -57
  49. package/build/src/classes/entryTypes/Pushtag.d.mts +0 -21
  50. package/build/src/classes/entryTypes/Pushtag.mjs +0 -34
  51. package/build/src/classes/entryTypes/Query.d.mts +0 -22
  52. package/build/src/classes/entryTypes/Query.mjs +0 -34
  53. package/build/src/classes/entryTypes/Transaction/Posting.d.mts +0 -59
  54. package/build/src/classes/entryTypes/Transaction/Posting.mjs +0 -97
  55. package/build/src/classes/entryTypes/Transaction/Tag.d.mts +0 -28
  56. package/build/src/classes/entryTypes/Transaction/Tag.mjs +0 -28
  57. package/build/src/classes/entryTypes/Transaction/index.d.mts +0 -70
  58. package/build/src/classes/entryTypes/Transaction/index.mjs +0 -193
  59. package/build/src/classes/entryTypes/index.d.mts +0 -19
  60. package/build/src/classes/entryTypes/index.mjs +0 -19
  61. package/build/src/entryTypeToClass.d.mts +0 -73
  62. package/build/src/entryTypeToClass.mjs +0 -37
  63. package/build/src/entryTypes.d.mts +0 -10
  64. package/build/src/entryTypes.mjs +0 -29
  65. package/build/src/utils/splitStringIntoUnparsedEntries.d.ts +0 -14
  66. package/build/src/utils/splitStringIntoUnparsedEntries.js +0 -48
@@ -1,50 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { simpleParseLine } from '../../utils/simpleParseLine.mjs';
4
- import { formatPrice } from '../../utils/formatPrice.mjs';
5
- import { defaultFormatOptions } from '../ParseResult.mjs';
6
- /**
7
- * Represents a Balance assertion entry.
8
- * Balance directives assert that an account has a specific balance at a given date.
9
- */
10
- export class Balance extends DateEntry {
11
- constructor() {
12
- super(...arguments);
13
- /** @inheritdoc */
14
- this.type = 'balance';
15
- }
16
- /**
17
- * Gets the formatted price string (amount + currency).
18
- * @returns The formatted price string
19
- */
20
- get price() {
21
- return formatPrice(this.amount, this.currency);
22
- }
23
- /**
24
- * Creates a Balance instance from a generic parse result.
25
- * @param genericParseResult - The parsed balance entry data
26
- * @returns A new Balance instance
27
- */
28
- static fromGenericParseResult(genericParseResult) {
29
- const [account, amount, currency] = simpleParseLine(genericParseResult.header);
30
- return new Balance({
31
- ...genericParseResult.props,
32
- account,
33
- amount,
34
- currency,
35
- });
36
- }
37
- /** @inheritdoc */
38
- toString() {
39
- return this.toFormattedString({ currencyColumn: 0 });
40
- }
41
- /** @inheritdoc */
42
- toFormattedString(formatOptions = defaultFormatOptions) {
43
- const firstPart = `${this.getDateTypePrefix()} ${this.account}`;
44
- const paddingLength = formatOptions.currencyColumn - firstPart.length - this.amount.length - 2; // not sure what this is for
45
- const padding = ' '.repeat(Math.max(1, paddingLength));
46
- return [firstPart, padding, this.price, this.getMetaDataString()].join('');
47
- }
48
- }
49
- // Ensure class conforms to EntryConstructor pattern
50
- assertEntryConstructor(Balance);
@@ -1,24 +0,0 @@
1
- import type { GenericParseResult } from '../../genericParse.mjs';
2
- import { Entry, EntryConstructor } from '../Entry.mjs';
3
- /**
4
- * Represents a blank line in a Beancount file.
5
- * Blank lines are used to separate entries for readability.
6
- */
7
- export declare class Blankline extends Entry {
8
- /** @inheritdoc */
9
- type: "blankline";
10
- /**
11
- * Creates a Blankline instance from a generic parse result.
12
- * @param _genericParseResult - Unused, blank lines have no content
13
- * @returns A new Blankline instance
14
- */
15
- static fromGenericParseResult(_genericParseResult: GenericParseResult): Blankline;
16
- /** @inheritdoc */
17
- toString(): string;
18
- /**
19
- * Creates a Blankline instance from a string.
20
- * @param _input - Unused, blank lines have no content
21
- * @returns A new Blankline instance
22
- */
23
- static fromString<T extends Entry>(this: EntryConstructor<T>, _input: string): T;
24
- }
@@ -1,38 +0,0 @@
1
- import { assertEntryConstructor, Entry } from '../Entry.mjs';
2
- /**
3
- * Represents a blank line in a Beancount file.
4
- * Blank lines are used to separate entries for readability.
5
- */
6
- export class Blankline extends Entry {
7
- constructor() {
8
- super(...arguments);
9
- /** @inheritdoc */
10
- this.type = 'blankline';
11
- }
12
- /**
13
- * Creates a Blankline instance from a generic parse result.
14
- * @param _genericParseResult - Unused, blank lines have no content
15
- * @returns A new Blankline instance
16
- */
17
- static fromGenericParseResult(
18
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
- _genericParseResult) {
20
- return new Blankline({});
21
- }
22
- /** @inheritdoc */
23
- toString() {
24
- return '';
25
- }
26
- /**
27
- * Creates a Blankline instance from a string.
28
- * @param _input - Unused, blank lines have no content
29
- * @returns A new Blankline instance
30
- */
31
- static fromString(
32
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
- _input) {
34
- return this.fromGenericParseResult({});
35
- }
36
- }
37
- // Ensure class conforms to EntryConstructor pattern
38
- assertEntryConstructor(Blankline);
@@ -1,20 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- /**
4
- * Represents a Close entry that closes an account.
5
- * Close directives mark the end of an account's lifespan.
6
- */
7
- export declare class Close extends DateEntry {
8
- /** @inheritdoc */
9
- type: "close";
10
- /** The account name being closed */
11
- account: string;
12
- /**
13
- * Creates a Close instance from a generic parse result.
14
- * @param genericParseResult - The parsed close entry data
15
- * @returns A new Close instance
16
- */
17
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Close;
18
- /** @inheritdoc */
19
- toString(): string;
20
- }
@@ -1,31 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- /**
4
- * Represents a Close entry that closes an account.
5
- * Close directives mark the end of an account's lifespan.
6
- */
7
- export class Close extends DateEntry {
8
- constructor() {
9
- super(...arguments);
10
- /** @inheritdoc */
11
- this.type = 'close';
12
- }
13
- /**
14
- * Creates a Close instance from a generic parse result.
15
- * @param genericParseResult - The parsed close entry data
16
- * @returns A new Close instance
17
- */
18
- static fromGenericParseResult(genericParseResult) {
19
- const account = genericParseResult.header.trim();
20
- return new Close({
21
- ...genericParseResult.props,
22
- account,
23
- });
24
- }
25
- /** @inheritdoc */
26
- toString() {
27
- return `${this.getDateTypePrefix()} ${this.account}${this.getMetaDataString()}`;
28
- }
29
- }
30
- // Ensure class conforms to EntryConstructor pattern
31
- assertEntryConstructor(Close);
@@ -1,25 +0,0 @@
1
- import type { GenericParseResult } from '../../genericParse.mjs';
2
- import { Entry, EntryConstructor } from '../Entry.mjs';
3
- /**
4
- * Represents a Comment line in a Beancount file.
5
- * Comments are lines that start with a semicolon or hash and are ignored by the parser.
6
- */
7
- export declare class Comment extends Entry {
8
- /** @inheritdoc */
9
- type: "comment";
10
- /**
11
- * Creates a Comment instance from a generic parse result.
12
- * Note: This doesn't use a real GenericParseResult structure.
13
- * @param genericParseResult - The parsed comment data
14
- * @returns A new Comment instance
15
- */
16
- static fromGenericParseResult(genericParseResult: GenericParseResult): Comment;
17
- /** @inheritdoc */
18
- toString(): string | undefined;
19
- /**
20
- * Creates a Comment instance directly from a string.
21
- * @param input - The comment text
22
- * @returns A new Comment instance
23
- */
24
- static fromString<T extends Entry>(this: EntryConstructor<T>, input: string): T;
25
- }
@@ -1,42 +0,0 @@
1
- import { assertEntryConstructor, Entry } from '../Entry.mjs';
2
- /**
3
- * Represents a Comment line in a Beancount file.
4
- * Comments are lines that start with a semicolon or hash and are ignored by the parser.
5
- */
6
- export class Comment extends Entry {
7
- constructor() {
8
- super(...arguments);
9
- /** @inheritdoc */
10
- this.type = 'comment';
11
- }
12
- /**
13
- * Creates a Comment instance from a generic parse result.
14
- * Note: This doesn't use a real GenericParseResult structure.
15
- * @param genericParseResult - The parsed comment data
16
- * @returns A new Comment instance
17
- */
18
- static fromGenericParseResult(genericParseResult) {
19
- return new Comment({
20
- comment: genericParseResult.header,
21
- });
22
- }
23
- /** @inheritdoc */
24
- toString() {
25
- return this.comment;
26
- }
27
- /**
28
- * Creates a Comment instance directly from a string.
29
- * @param input - The comment text
30
- * @returns A new Comment instance
31
- */
32
- static fromString(input) {
33
- return this.fromGenericParseResult({
34
- type: 'comment',
35
- header: input,
36
- props: {},
37
- fake: true,
38
- });
39
- }
40
- }
41
- // Ensure class conforms to EntryConstructor pattern
42
- assertEntryConstructor(Comment);
@@ -1,20 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- /**
4
- * Represents a Commodity declaration entry.
5
- * Commodity directives declare the existence of a commodity/currency with metadata.
6
- */
7
- export declare class Commodity extends DateEntry {
8
- /** @inheritdoc */
9
- type: "commodity";
10
- /** The currency/commodity code being declared */
11
- currency: string;
12
- /**
13
- * Creates a Commodity instance from a generic parse result.
14
- * @param genericParseResult - The parsed commodity entry data
15
- * @returns A new Commodity instance
16
- */
17
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Commodity;
18
- /** @inheritdoc */
19
- toString(): string;
20
- }
@@ -1,31 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- /**
4
- * Represents a Commodity declaration entry.
5
- * Commodity directives declare the existence of a commodity/currency with metadata.
6
- */
7
- export class Commodity extends DateEntry {
8
- constructor() {
9
- super(...arguments);
10
- /** @inheritdoc */
11
- this.type = 'commodity';
12
- }
13
- /**
14
- * Creates a Commodity instance from a generic parse result.
15
- * @param genericParseResult - The parsed commodity entry data
16
- * @returns A new Commodity instance
17
- */
18
- static fromGenericParseResult(genericParseResult) {
19
- const currency = genericParseResult.header.trim();
20
- return new Commodity({
21
- ...genericParseResult.props,
22
- currency,
23
- });
24
- }
25
- /** @inheritdoc */
26
- toString() {
27
- return `${this.getDateTypePrefix()} ${this.currency}${this.getMetaDataString()}`;
28
- }
29
- }
30
- // Ensure class conforms to EntryConstructor pattern
31
- assertEntryConstructor(Commodity);
@@ -1,23 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { Value } from '../Value.mjs';
4
- /**
5
- * Represents a Custom entry for user-defined directives.
6
- * Custom directives allow for extensibility with arbitrary types and values.
7
- */
8
- export declare class Custom extends DateEntry {
9
- /** @inheritdoc */
10
- type: "custom";
11
- /** The custom directive type */
12
- customType: Value;
13
- /** Optional array of values associated with the custom directive */
14
- values?: Value[];
15
- /**
16
- * Creates a Custom instance from a generic parse result.
17
- * @param genericParseResult - The parsed custom entry data
18
- * @returns A new Custom instance
19
- */
20
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Custom;
21
- /** @inheritdoc */
22
- toString(): string;
23
- }
@@ -1,38 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { simpleParseLine } from '../../utils/simpleParseLine.mjs';
4
- import { Value } from '../Value.mjs';
5
- /**
6
- * Represents a Custom entry for user-defined directives.
7
- * Custom directives allow for extensibility with arbitrary types and values.
8
- */
9
- export class Custom extends DateEntry {
10
- constructor() {
11
- super(...arguments);
12
- /** @inheritdoc */
13
- this.type = 'custom';
14
- }
15
- /**
16
- * Creates a Custom instance from a generic parse result.
17
- * @param genericParseResult - The parsed custom entry data
18
- * @returns A new Custom instance
19
- */
20
- static fromGenericParseResult(genericParseResult) {
21
- const [customType, ...others] = simpleParseLine(genericParseResult.header);
22
- return new Custom({
23
- ...genericParseResult.props,
24
- customType: Value.fromString(customType),
25
- values: others.length > 0 ? others.map((o) => Value.fromString(o)) : undefined,
26
- });
27
- }
28
- /** @inheritdoc */
29
- toString() {
30
- const parts = [`${this.getDateTypePrefix()} ${this.customType.toString()}`];
31
- if (this.values !== undefined) {
32
- parts.push(...this.values.map((v) => v.toString()));
33
- }
34
- return parts.join(' ') + this.getMetaDataString();
35
- }
36
- }
37
- // Ensure class conforms to EntryConstructor pattern
38
- assertEntryConstructor(Custom);
@@ -1,22 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- /**
4
- * Represents a Document entry that links an external file to an account.
5
- * Document directives associate receipts, statements, or other files with accounts.
6
- */
7
- export declare class Document extends DateEntry {
8
- /** @inheritdoc */
9
- type: "document";
10
- /** The account the document is associated with */
11
- account: string;
12
- /** The file path to the document */
13
- pathToDocument: string;
14
- /**
15
- * Creates a Document instance from a generic parse result.
16
- * @param genericParseResult - The parsed document entry data
17
- * @returns A new Document instance
18
- */
19
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Document;
20
- /** @inheritdoc */
21
- toString(): string;
22
- }
@@ -1,34 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { parseString } from '../Value.mjs';
4
- import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
5
- /**
6
- * Represents a Document entry that links an external file to an account.
7
- * Document directives associate receipts, statements, or other files with accounts.
8
- */
9
- export class Document extends DateEntry {
10
- constructor() {
11
- super(...arguments);
12
- /** @inheritdoc */
13
- this.type = 'document';
14
- }
15
- /**
16
- * Creates a Document instance from a generic parse result.
17
- * @param genericParseResult - The parsed document entry data
18
- * @returns A new Document instance
19
- */
20
- static fromGenericParseResult(genericParseResult) {
21
- const [account, pathToDocument] = stringAwareParseLine(genericParseResult.header);
22
- return new Document({
23
- ...genericParseResult.props,
24
- account,
25
- pathToDocument: parseString(pathToDocument),
26
- });
27
- }
28
- /** @inheritdoc */
29
- toString() {
30
- return `${this.getDateTypePrefix()} ${this.account} "${this.pathToDocument}"${this.getMetaDataString()}`;
31
- }
32
- }
33
- // Ensure class conforms to EntryConstructor pattern
34
- assertEntryConstructor(Document);
@@ -1,23 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { Value } from '../Value.mjs';
4
- /**
5
- * Represents an Event entry that records a named event with a value.
6
- * Event directives track occurrences of specific events over time.
7
- */
8
- export declare class Event extends DateEntry {
9
- /** @inheritdoc */
10
- type: "event";
11
- /** The name of the event */
12
- name: string;
13
- /** The value associated with the event */
14
- value: Value;
15
- /**
16
- * Creates an Event instance from a generic parse result.
17
- * @param genericParseResult - The parsed event entry data
18
- * @returns A new Event instance
19
- */
20
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Event;
21
- /** @inheritdoc */
22
- toString(): string;
23
- }
@@ -1,34 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { parseString, Value } from '../Value.mjs';
4
- import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
5
- /**
6
- * Represents an Event entry that records a named event with a value.
7
- * Event directives track occurrences of specific events over time.
8
- */
9
- export class Event extends DateEntry {
10
- constructor() {
11
- super(...arguments);
12
- /** @inheritdoc */
13
- this.type = 'event';
14
- }
15
- /**
16
- * Creates an Event instance from a generic parse result.
17
- * @param genericParseResult - The parsed event entry data
18
- * @returns A new Event instance
19
- */
20
- static fromGenericParseResult(genericParseResult) {
21
- const [name, value] = stringAwareParseLine(genericParseResult.header);
22
- return new Event({
23
- ...genericParseResult.props,
24
- name: parseString(name),
25
- value: Value.fromString(value),
26
- });
27
- }
28
- /** @inheritdoc */
29
- toString() {
30
- return `${this.getDateTypePrefix()} "${this.name}" ${this.value.toString()}${this.getMetaDataString()}`;
31
- }
32
- }
33
- // Ensure class conforms to EntryConstructor pattern
34
- assertEntryConstructor(Event);
@@ -1,20 +0,0 @@
1
- import type { GenericParseResult } from '../../genericParse.mjs';
2
- import { Entry } from '../Entry.mjs';
3
- /**
4
- * Represents an Include entry that includes another Beancount file.
5
- * Include directives allow splitting ledgers across multiple files.
6
- */
7
- export declare class Include extends Entry {
8
- /** @inheritdoc */
9
- type: "include";
10
- /** The filename/path of the file to include */
11
- filename: string;
12
- /**
13
- * Creates an Include instance from a generic parse result.
14
- * @param genericParseResult - The parsed include entry data
15
- * @returns A new Include instance
16
- */
17
- static fromGenericParseResult(genericParseResult: GenericParseResult): Include;
18
- /** @inheritdoc */
19
- toString(): string;
20
- }
@@ -1,31 +0,0 @@
1
- import { parseString } from '../Value.mjs';
2
- import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
3
- import { assertEntryConstructor, Entry } from '../Entry.mjs';
4
- /**
5
- * Represents an Include entry that includes another Beancount file.
6
- * Include directives allow splitting ledgers across multiple files.
7
- */
8
- export class Include extends Entry {
9
- constructor() {
10
- super(...arguments);
11
- /** @inheritdoc */
12
- this.type = 'include';
13
- }
14
- /**
15
- * Creates an Include instance from a generic parse result.
16
- * @param genericParseResult - The parsed include entry data
17
- * @returns A new Include instance
18
- */
19
- static fromGenericParseResult(genericParseResult) {
20
- const [filename] = stringAwareParseLine(genericParseResult.header);
21
- return new Include({
22
- filename: parseString(filename),
23
- });
24
- }
25
- /** @inheritdoc */
26
- toString() {
27
- return `${this.type} "${this.filename}"`;
28
- }
29
- }
30
- // Ensure class conforms to EntryConstructor pattern
31
- assertEntryConstructor(Include);
@@ -1,22 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- /**
4
- * Represents a Note entry that attaches a comment to an account.
5
- * Note directives associate free-form text descriptions with accounts at specific dates.
6
- */
7
- export declare class Note extends DateEntry {
8
- /** @inheritdoc */
9
- type: "note";
10
- /** The account the note is attached to */
11
- account: string;
12
- /** The note description text */
13
- description: string;
14
- /**
15
- * Creates a Note instance from a generic parse result.
16
- * @param genericParseResult - The parsed note entry data
17
- * @returns A new Note instance
18
- */
19
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Note;
20
- /** @inheritdoc */
21
- toString(): string;
22
- }
@@ -1,34 +0,0 @@
1
- import { assertEntryConstructor } from '../Entry.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { parseString } from '../Value.mjs';
4
- import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
5
- /**
6
- * Represents a Note entry that attaches a comment to an account.
7
- * Note directives associate free-form text descriptions with accounts at specific dates.
8
- */
9
- export class Note extends DateEntry {
10
- constructor() {
11
- super(...arguments);
12
- /** @inheritdoc */
13
- this.type = 'note';
14
- }
15
- /**
16
- * Creates a Note instance from a generic parse result.
17
- * @param genericParseResult - The parsed note entry data
18
- * @returns A new Note instance
19
- */
20
- static fromGenericParseResult(genericParseResult) {
21
- const [account, description] = stringAwareParseLine(genericParseResult.header);
22
- return new Note({
23
- ...genericParseResult.props,
24
- account,
25
- description: parseString(description),
26
- });
27
- }
28
- /** @inheritdoc */
29
- toString() {
30
- return `${this.getDateTypePrefix()} ${this.account} "${this.description}"${this.getMetaDataString()}`;
31
- }
32
- }
33
- // Ensure class conforms to EntryConstructor pattern
34
- assertEntryConstructor(Note);
@@ -1,27 +0,0 @@
1
- import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
- import { DateEntry } from '../DateEntry.mjs';
3
- import { FormatOptions } from '../ParseResult.mjs';
4
- /**
5
- * Represents an Open entry that declares a new account.
6
- * Open directives define the beginning of an account's lifespan.
7
- */
8
- export declare class Open extends DateEntry {
9
- /** @inheritdoc */
10
- type: "open";
11
- /** The account name being opened */
12
- account: string;
13
- /** Optional list of allowed currencies for this account */
14
- constraintCurrencies?: string[];
15
- /** Optional booking method specification */
16
- bookingMethod?: string;
17
- /**
18
- * Creates an Open instance from a generic parse result.
19
- * @param genericParseResult - The parsed open entry data
20
- * @returns A new Open instance
21
- */
22
- static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Open;
23
- /** @inheritdoc */
24
- toString(): string;
25
- /** @inheritdoc */
26
- toFormattedString(formatOptions?: FormatOptions): string;
27
- }