beancount 0.0.2 → 0.0.4

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 (72) hide show
  1. package/build/src/classes/DateEntry.d.mts +22 -3
  2. package/build/src/classes/DateEntry.mjs +20 -1
  3. package/build/src/classes/Entry.d.mts +61 -2
  4. package/build/src/classes/Entry.mjs +60 -0
  5. package/build/src/classes/ParseResult.d.mts +45 -3
  6. package/build/src/classes/ParseResult.mjs +56 -4
  7. package/build/src/classes/Value.d.mts +39 -0
  8. package/build/src/classes/Value.mjs +34 -0
  9. package/build/src/classes/entryTypes/Balance.d.mts +19 -0
  10. package/build/src/classes/entryTypes/Balance.mjs +16 -0
  11. package/build/src/classes/entryTypes/Blankline.d.mts +16 -0
  12. package/build/src/classes/entryTypes/Blankline.mjs +16 -0
  13. package/build/src/classes/entryTypes/Close.d.mts +12 -0
  14. package/build/src/classes/entryTypes/Close.mjs +11 -0
  15. package/build/src/classes/entryTypes/Comment.d.mts +17 -0
  16. package/build/src/classes/entryTypes/Comment.mjs +17 -0
  17. package/build/src/classes/entryTypes/Commodity.d.mts +12 -0
  18. package/build/src/classes/entryTypes/Commodity.mjs +11 -0
  19. package/build/src/classes/entryTypes/Custom.d.mts +13 -0
  20. package/build/src/classes/entryTypes/Custom.mjs +11 -0
  21. package/build/src/classes/entryTypes/Document.d.mts +13 -0
  22. package/build/src/classes/entryTypes/Document.mjs +11 -0
  23. package/build/src/classes/entryTypes/Event.d.mts +13 -0
  24. package/build/src/classes/entryTypes/Event.mjs +11 -0
  25. package/build/src/classes/entryTypes/Include.d.mts +12 -0
  26. package/build/src/classes/entryTypes/Include.mjs +11 -0
  27. package/build/src/classes/entryTypes/Note.d.mts +13 -0
  28. package/build/src/classes/entryTypes/Note.mjs +11 -0
  29. package/build/src/classes/entryTypes/Open.d.mts +15 -0
  30. package/build/src/classes/entryTypes/Open.mjs +12 -0
  31. package/build/src/classes/entryTypes/Option.d.mts +13 -0
  32. package/build/src/classes/entryTypes/Option.mjs +11 -0
  33. package/build/src/classes/entryTypes/Pad.d.mts +13 -0
  34. package/build/src/classes/entryTypes/Pad.mjs +11 -0
  35. package/build/src/classes/entryTypes/Plugin.d.mts +13 -0
  36. package/build/src/classes/entryTypes/Plugin.mjs +11 -0
  37. package/build/src/classes/entryTypes/Poptag.d.mts +12 -0
  38. package/build/src/classes/entryTypes/Poptag.mjs +11 -0
  39. package/build/src/classes/entryTypes/Price.d.mts +18 -0
  40. package/build/src/classes/entryTypes/Price.mjs +15 -0
  41. package/build/src/classes/entryTypes/Pushtag.d.mts +12 -0
  42. package/build/src/classes/entryTypes/Pushtag.mjs +11 -0
  43. package/build/src/classes/entryTypes/Query.d.mts +13 -0
  44. package/build/src/classes/entryTypes/Query.mjs +11 -0
  45. package/build/src/classes/entryTypes/Transaction/Posting.d.mts +41 -0
  46. package/build/src/classes/entryTypes/Transaction/Posting.mjs +33 -0
  47. package/build/src/classes/entryTypes/Transaction/Tag.d.mts +19 -0
  48. package/build/src/classes/entryTypes/Transaction/Tag.mjs +17 -0
  49. package/build/src/classes/entryTypes/Transaction/index.d.mts +42 -1
  50. package/build/src/classes/entryTypes/Transaction/index.mjs +69 -5
  51. package/build/src/entryTypeToClass.d.mts +59 -0
  52. package/build/src/entryTypeToClass.mjs +37 -0
  53. package/build/src/genericParse.d.mts +39 -2
  54. package/build/src/genericParse.mjs +13 -0
  55. package/build/src/main.d.mts +58 -0
  56. package/build/src/main.mjs +55 -0
  57. package/build/src/parse.d.mts +76 -23
  58. package/build/src/parse.mjs +69 -22
  59. package/build/src/utils/countChar.d.mts +7 -0
  60. package/build/src/utils/countChar.mjs +7 -0
  61. package/build/src/utils/formatPrice.d.mts +7 -2
  62. package/build/src/utils/formatPrice.mjs +7 -2
  63. package/build/src/utils/parseMetadata.d.mts +12 -0
  64. package/build/src/utils/parseMetadata.mjs +8 -0
  65. package/build/src/utils/simpleParseLine.d.mts +7 -0
  66. package/build/src/utils/simpleParseLine.mjs +7 -0
  67. package/build/src/utils/stringAwareParseLine.d.mts +7 -0
  68. package/build/src/utils/stringAwareParseLine.mjs +7 -0
  69. package/build/src/utils/stringAwareSplitLine.d.mts +9 -0
  70. package/build/src/utils/stringAwareSplitLine.mjs +9 -0
  71. package/build/tsconfig.build.tsbuildinfo +1 -1
  72. package/package.json +1 -1
@@ -1,10 +1,20 @@
1
1
  import { assertEntryConstructor } from '../Entry.mjs';
2
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
+ */
3
7
  export class Close extends DateEntry {
4
8
  constructor() {
5
9
  super(...arguments);
10
+ /** @inheritdoc */
6
11
  this.type = 'close';
7
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
+ */
8
18
  static fromGenericParseResult(genericParseResult) {
9
19
  const account = genericParseResult.header.trim();
10
20
  return new Close({
@@ -12,6 +22,7 @@ export class Close extends DateEntry {
12
22
  account,
13
23
  });
14
24
  }
25
+ /** @inheritdoc */
15
26
  toString() {
16
27
  return `${this.getDateTypePrefix()} ${this.account}${this.getMetaDataString()}`;
17
28
  }
@@ -1,8 +1,25 @@
1
1
  import type { GenericParseResult } from '../../genericParse.mjs';
2
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
+ */
3
7
  export declare class Comment extends Entry {
8
+ /** @inheritdoc */
4
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
+ */
5
16
  static fromGenericParseResult(genericParseResult: GenericParseResult): Comment;
17
+ /** @inheritdoc */
6
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
+ */
7
24
  static fromString<T extends Entry>(this: EntryConstructor<T>, input: string): T;
8
25
  }
@@ -1,17 +1,34 @@
1
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
+ */
2
6
  export class Comment extends Entry {
3
7
  constructor() {
4
8
  super(...arguments);
9
+ /** @inheritdoc */
5
10
  this.type = 'comment';
6
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
+ */
7
18
  static fromGenericParseResult(genericParseResult) {
8
19
  return new Comment({
9
20
  comment: genericParseResult.props.comment,
10
21
  });
11
22
  }
23
+ /** @inheritdoc */
12
24
  toString() {
13
25
  return this.comment;
14
26
  }
27
+ /**
28
+ * Creates a Comment instance directly from a string.
29
+ * @param input - The comment text
30
+ * @returns A new Comment instance
31
+ */
15
32
  static fromString(input) {
16
33
  return this.fromGenericParseResult({
17
34
  props: { comment: input },
@@ -1,8 +1,20 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
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
+ */
3
7
  export declare class Commodity extends DateEntry {
8
+ /** @inheritdoc */
4
9
  type: "commodity";
10
+ /** The currency/commodity code being declared */
5
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
+ */
6
17
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Commodity;
18
+ /** @inheritdoc */
7
19
  toString(): string;
8
20
  }
@@ -1,10 +1,20 @@
1
1
  import { assertEntryConstructor } from '../Entry.mjs';
2
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
+ */
3
7
  export class Commodity extends DateEntry {
4
8
  constructor() {
5
9
  super(...arguments);
10
+ /** @inheritdoc */
6
11
  this.type = 'commodity';
7
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
+ */
8
18
  static fromGenericParseResult(genericParseResult) {
9
19
  const currency = genericParseResult.header.trim();
10
20
  return new Commodity({
@@ -12,6 +22,7 @@ export class Commodity extends DateEntry {
12
22
  currency,
13
23
  });
14
24
  }
25
+ /** @inheritdoc */
15
26
  toString() {
16
27
  return `${this.getDateTypePrefix()} ${this.currency}${this.getMetaDataString()}`;
17
28
  }
@@ -1,10 +1,23 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
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
+ */
4
8
  export declare class Custom extends DateEntry {
9
+ /** @inheritdoc */
5
10
  type: "custom";
11
+ /** The custom directive type */
6
12
  customType: Value;
13
+ /** Optional array of values associated with the custom directive */
7
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
+ */
8
20
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Custom;
21
+ /** @inheritdoc */
9
22
  toString(): string;
10
23
  }
@@ -2,11 +2,21 @@ import { assertEntryConstructor } from '../Entry.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
3
  import { simpleParseLine } from '../../utils/simpleParseLine.mjs';
4
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
+ */
5
9
  export class Custom extends DateEntry {
6
10
  constructor() {
7
11
  super(...arguments);
12
+ /** @inheritdoc */
8
13
  this.type = 'custom';
9
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
+ */
10
20
  static fromGenericParseResult(genericParseResult) {
11
21
  const [customType, ...others] = simpleParseLine(genericParseResult.header);
12
22
  return new Custom({
@@ -15,6 +25,7 @@ export class Custom extends DateEntry {
15
25
  values: others.length > 0 ? others.map((o) => Value.fromString(o)) : undefined,
16
26
  });
17
27
  }
28
+ /** @inheritdoc */
18
29
  toString() {
19
30
  const parts = [`${this.getDateTypePrefix()} ${this.customType.toString()}`];
20
31
  if (this.values !== undefined) {
@@ -1,9 +1,22 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
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
+ */
3
7
  export declare class Document extends DateEntry {
8
+ /** @inheritdoc */
4
9
  type: "document";
10
+ /** The account the document is associated with */
5
11
  account: string;
12
+ /** The file path to the document */
6
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
+ */
7
19
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Document;
20
+ /** @inheritdoc */
8
21
  toString(): string;
9
22
  }
@@ -2,11 +2,21 @@ import { assertEntryConstructor } from '../Entry.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
3
  import { parseString } from '../Value.mjs';
4
4
  import { simpleParseLine } from '../../utils/simpleParseLine.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
+ */
5
9
  export class Document extends DateEntry {
6
10
  constructor() {
7
11
  super(...arguments);
12
+ /** @inheritdoc */
8
13
  this.type = 'document';
9
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
+ */
10
20
  static fromGenericParseResult(genericParseResult) {
11
21
  const [account, pathToDocument] = simpleParseLine(genericParseResult.header);
12
22
  return new Document({
@@ -15,6 +25,7 @@ export class Document extends DateEntry {
15
25
  pathToDocument: parseString(pathToDocument),
16
26
  });
17
27
  }
28
+ /** @inheritdoc */
18
29
  toString() {
19
30
  return `${this.getDateTypePrefix()} ${this.account} "${this.pathToDocument}"${this.getMetaDataString()}`;
20
31
  }
@@ -1,10 +1,23 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
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
+ */
4
8
  export declare class Event extends DateEntry {
9
+ /** @inheritdoc */
5
10
  type: "event";
11
+ /** The name of the event */
6
12
  name: string;
13
+ /** The value associated with the event */
7
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
+ */
8
20
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Event;
21
+ /** @inheritdoc */
9
22
  toString(): string;
10
23
  }
@@ -2,11 +2,21 @@ import { assertEntryConstructor } from '../Entry.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
3
  import { parseString, Value } from '../Value.mjs';
4
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
+ */
5
9
  export class Event extends DateEntry {
6
10
  constructor() {
7
11
  super(...arguments);
12
+ /** @inheritdoc */
8
13
  this.type = 'event';
9
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
+ */
10
20
  static fromGenericParseResult(genericParseResult) {
11
21
  const [name, value] = stringAwareParseLine(genericParseResult.header);
12
22
  return new Event({
@@ -15,6 +25,7 @@ export class Event extends DateEntry {
15
25
  value: Value.fromString(value),
16
26
  });
17
27
  }
28
+ /** @inheritdoc */
18
29
  toString() {
19
30
  return `${this.getDateTypePrefix()} "${this.name}" ${this.value.toString()}${this.getMetaDataString()}`;
20
31
  }
@@ -1,8 +1,20 @@
1
1
  import type { GenericParseResult } from '../../genericParse.mjs';
2
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
+ */
3
7
  export declare class Include extends Entry {
8
+ /** @inheritdoc */
4
9
  type: "include";
10
+ /** The filename/path of the file to include */
5
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
+ */
6
17
  static fromGenericParseResult(genericParseResult: GenericParseResult): Include;
18
+ /** @inheritdoc */
7
19
  toString(): string;
8
20
  }
@@ -1,17 +1,28 @@
1
1
  import { parseString } from '../Value.mjs';
2
2
  import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
3
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
+ */
4
8
  export class Include extends Entry {
5
9
  constructor() {
6
10
  super(...arguments);
11
+ /** @inheritdoc */
7
12
  this.type = 'include';
8
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
+ */
9
19
  static fromGenericParseResult(genericParseResult) {
10
20
  const [filename] = stringAwareParseLine(genericParseResult.header);
11
21
  return new Include({
12
22
  filename: parseString(filename),
13
23
  });
14
24
  }
25
+ /** @inheritdoc */
15
26
  toString() {
16
27
  return `${this.type} "${this.filename}"`;
17
28
  }
@@ -1,9 +1,22 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
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
+ */
3
7
  export declare class Note extends DateEntry {
8
+ /** @inheritdoc */
4
9
  type: "note";
10
+ /** The account the note is attached to */
5
11
  account: string;
12
+ /** The note description text */
6
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
+ */
7
19
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Note;
20
+ /** @inheritdoc */
8
21
  toString(): string;
9
22
  }
@@ -2,11 +2,21 @@ import { assertEntryConstructor } from '../Entry.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
3
  import { parseString } from '../Value.mjs';
4
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
+ */
5
9
  export class Note extends DateEntry {
6
10
  constructor() {
7
11
  super(...arguments);
12
+ /** @inheritdoc */
8
13
  this.type = 'note';
9
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
+ */
10
20
  static fromGenericParseResult(genericParseResult) {
11
21
  const [account, description] = stringAwareParseLine(genericParseResult.header);
12
22
  return new Note({
@@ -15,6 +25,7 @@ export class Note extends DateEntry {
15
25
  description: parseString(description),
16
26
  });
17
27
  }
28
+ /** @inheritdoc */
18
29
  toString() {
19
30
  return `${this.getDateTypePrefix()} ${this.account} "${this.description}"${this.getMetaDataString()}`;
20
31
  }
@@ -1,12 +1,27 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
2
  import { FormatOptions } from '../Entry.mjs';
3
3
  import { DateEntry } from '../DateEntry.mjs';
4
+ /**
5
+ * Represents an Open entry that declares a new account.
6
+ * Open directives define the beginning of an account's lifespan.
7
+ */
4
8
  export declare class Open extends DateEntry {
9
+ /** @inheritdoc */
5
10
  type: "open";
11
+ /** The account name being opened */
6
12
  account: string;
13
+ /** Optional list of allowed currencies for this account */
7
14
  constraintCurrencies?: string[];
15
+ /** Optional booking method specification */
8
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
+ */
9
22
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Open;
23
+ /** @inheritdoc */
10
24
  toString(): string;
25
+ /** @inheritdoc */
11
26
  toFormattedString(formatOptions: FormatOptions): string;
12
27
  }
@@ -2,11 +2,21 @@ import { assertEntryConstructor } from '../Entry.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
3
  import { simpleParseLine } from '../../utils/simpleParseLine.mjs';
4
4
  import { parseString } from '../Value.mjs';
5
+ /**
6
+ * Represents an Open entry that declares a new account.
7
+ * Open directives define the beginning of an account's lifespan.
8
+ */
5
9
  export class Open extends DateEntry {
6
10
  constructor() {
7
11
  super(...arguments);
12
+ /** @inheritdoc */
8
13
  this.type = 'open';
9
14
  }
15
+ /**
16
+ * Creates an Open instance from a generic parse result.
17
+ * @param genericParseResult - The parsed open entry data
18
+ * @returns A new Open instance
19
+ */
10
20
  static fromGenericParseResult(genericParseResult) {
11
21
  const [account, ...other] = simpleParseLine(genericParseResult.header);
12
22
  let constraintCurrencies, bookingMethod;
@@ -29,9 +39,11 @@ export class Open extends DateEntry {
29
39
  bookingMethod,
30
40
  });
31
41
  }
42
+ /** @inheritdoc */
32
43
  toString() {
33
44
  return this.toFormattedString({ currencyColumn: 0 });
34
45
  }
46
+ /** @inheritdoc */
35
47
  toFormattedString(formatOptions) {
36
48
  const parts = [`${this.getDateTypePrefix()} ${this.account}`];
37
49
  if (this.constraintCurrencies !== undefined) {
@@ -1,10 +1,23 @@
1
1
  import type { GenericParseResult } from '../../genericParse.mjs';
2
2
  import { Value } from '../Value.mjs';
3
3
  import { Entry } from '../Entry.mjs';
4
+ /**
5
+ * Represents an Option entry that sets a Beancount configuration option.
6
+ * Option directives configure various aspects of Beancount's behavior.
7
+ */
4
8
  export declare class Option extends Entry {
9
+ /** @inheritdoc */
5
10
  type: "option";
11
+ /** The option name */
6
12
  name: string;
13
+ /** The option value */
7
14
  value: Value;
15
+ /**
16
+ * Creates an Option instance from a generic parse result.
17
+ * @param genericParseResult - The parsed option entry data
18
+ * @returns A new Option instance
19
+ */
8
20
  static fromGenericParseResult(genericParseResult: GenericParseResult): Option;
21
+ /** @inheritdoc */
9
22
  toString(): string;
10
23
  }
@@ -1,11 +1,21 @@
1
1
  import { parseString, Value } from '../Value.mjs';
2
2
  import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
3
3
  import { assertEntryConstructor, Entry } from '../Entry.mjs';
4
+ /**
5
+ * Represents an Option entry that sets a Beancount configuration option.
6
+ * Option directives configure various aspects of Beancount's behavior.
7
+ */
4
8
  export class Option extends Entry {
5
9
  constructor() {
6
10
  super(...arguments);
11
+ /** @inheritdoc */
7
12
  this.type = 'option';
8
13
  }
14
+ /**
15
+ * Creates an Option instance from a generic parse result.
16
+ * @param genericParseResult - The parsed option entry data
17
+ * @returns A new Option instance
18
+ */
9
19
  static fromGenericParseResult(genericParseResult) {
10
20
  const [name, value] = stringAwareParseLine(genericParseResult.header);
11
21
  return new Option({
@@ -13,6 +23,7 @@ export class Option extends Entry {
13
23
  value: Value.fromString(value),
14
24
  });
15
25
  }
26
+ /** @inheritdoc */
16
27
  toString() {
17
28
  return `${this.type} "${this.name}" ${this.value.toString()}`;
18
29
  }
@@ -1,9 +1,22 @@
1
1
  import type { GenericParseResultWithDate } from '../../genericParse.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
+ /**
4
+ * Represents a Pad entry that automatically balances accounts.
5
+ * Pad directives insert transactions to bring an account to a specific balance.
6
+ */
3
7
  export declare class Pad extends DateEntry {
8
+ /** @inheritdoc */
4
9
  type: "pad";
10
+ /** The account to be padded/balanced */
5
11
  account: string;
12
+ /** The source account to use for padding */
6
13
  accountPad: string;
14
+ /**
15
+ * Creates a Pad instance from a generic parse result.
16
+ * @param genericParseResult - The parsed pad entry data
17
+ * @returns A new Pad instance
18
+ */
7
19
  static fromGenericParseResult(genericParseResult: GenericParseResultWithDate): Pad;
20
+ /** @inheritdoc */
8
21
  toString(): string;
9
22
  }
@@ -1,11 +1,21 @@
1
1
  import { assertEntryConstructor } from '../Entry.mjs';
2
2
  import { DateEntry } from '../DateEntry.mjs';
3
3
  import { simpleParseLine } from '../../utils/simpleParseLine.mjs';
4
+ /**
5
+ * Represents a Pad entry that automatically balances accounts.
6
+ * Pad directives insert transactions to bring an account to a specific balance.
7
+ */
4
8
  export class Pad extends DateEntry {
5
9
  constructor() {
6
10
  super(...arguments);
11
+ /** @inheritdoc */
7
12
  this.type = 'pad';
8
13
  }
14
+ /**
15
+ * Creates a Pad instance from a generic parse result.
16
+ * @param genericParseResult - The parsed pad entry data
17
+ * @returns A new Pad instance
18
+ */
9
19
  static fromGenericParseResult(genericParseResult) {
10
20
  const [account, accountPad] = simpleParseLine(genericParseResult.header);
11
21
  return new Pad({
@@ -14,6 +24,7 @@ export class Pad extends DateEntry {
14
24
  accountPad,
15
25
  });
16
26
  }
27
+ /** @inheritdoc */
17
28
  toString() {
18
29
  return `${this.getDateTypePrefix()} ${this.account} ${this.accountPad}${this.getMetaDataString()}`;
19
30
  }
@@ -1,9 +1,22 @@
1
1
  import type { GenericParseResult } from '../../genericParse.mjs';
2
2
  import { Entry } from '../Entry.mjs';
3
+ /**
4
+ * Represents a Plugin entry that loads a Beancount plugin.
5
+ * Plugin directives enable plugins to process the ledger.
6
+ */
3
7
  export declare class Plugin extends Entry {
8
+ /** @inheritdoc */
4
9
  type: "plugin";
10
+ /** The Python module name of the plugin */
5
11
  moduleName: string;
12
+ /** Optional configuration string for the plugin */
6
13
  config?: string;
14
+ /**
15
+ * Creates a Plugin instance from a generic parse result.
16
+ * @param genericParseResult - The parsed plugin entry data
17
+ * @returns A new Plugin instance
18
+ */
7
19
  static fromGenericParseResult(genericParseResult: GenericParseResult): Plugin;
20
+ /** @inheritdoc */
8
21
  toString(): string;
9
22
  }
@@ -1,11 +1,21 @@
1
1
  import { parseString } from '../Value.mjs';
2
2
  import { stringAwareParseLine } from '../../utils/stringAwareParseLine.mjs';
3
3
  import { assertEntryConstructor, Entry } from '../Entry.mjs';
4
+ /**
5
+ * Represents a Plugin entry that loads a Beancount plugin.
6
+ * Plugin directives enable plugins to process the ledger.
7
+ */
4
8
  export class Plugin extends Entry {
5
9
  constructor() {
6
10
  super(...arguments);
11
+ /** @inheritdoc */
7
12
  this.type = 'plugin';
8
13
  }
14
+ /**
15
+ * Creates a Plugin instance from a generic parse result.
16
+ * @param genericParseResult - The parsed plugin entry data
17
+ * @returns A new Plugin instance
18
+ */
9
19
  static fromGenericParseResult(genericParseResult) {
10
20
  const [moduleName, config] = stringAwareParseLine(genericParseResult.header);
11
21
  return new Plugin({
@@ -13,6 +23,7 @@ export class Plugin extends Entry {
13
23
  config: config ? parseString(config) : undefined,
14
24
  });
15
25
  }
26
+ /** @inheritdoc */
16
27
  toString() {
17
28
  const parts = [`${this.type} "${this.moduleName}"`];
18
29
  if (this.config !== undefined) {
@@ -1,9 +1,21 @@
1
1
  import type { GenericParseResult } from '../../genericParse.mjs';
2
2
  import { Entry } from '../Entry.mjs';
3
3
  import { Tag } from './Transaction/Tag.mjs';
4
+ /**
5
+ * Represents a Poptag entry that removes a tag from the tag stack.
6
+ * Transactions after this will no longer inherit the popped tag.
7
+ */
4
8
  export declare class Poptag extends Entry {
9
+ /** @inheritdoc */
5
10
  type: "poptag";
11
+ /** The tag being popped from the stack */
6
12
  tag: Tag;
13
+ /**
14
+ * Creates a Poptag instance from a generic parse result.
15
+ * @param genericParseResult - The parsed poptag entry data
16
+ * @returns A new Poptag instance
17
+ */
7
18
  static fromGenericParseResult(genericParseResult: GenericParseResult): Poptag;
19
+ /** @inheritdoc */
8
20
  toString(): string;
9
21
  }