@kitledger/core 0.0.7 → 0.0.9

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/dist/fields.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Enumeration of supported field types.
3
+ */
1
4
  export declare enum FieldType {
2
5
  TEXT = "text",
3
6
  NUMBER = "number",
@@ -7,17 +10,27 @@ export declare enum FieldType {
7
10
  SELECT = "select",
8
11
  RELATION = "relation"
9
12
  }
13
+ /**
14
+ * Base interface for all field definitions.
15
+ */
10
16
  interface BaseField {
11
- readonly ref_id: string;
17
+ readonly refId: string;
12
18
  name: string;
13
19
  description?: string;
20
+ required: boolean;
14
21
  }
22
+ /**
23
+ * Type definition for a text field.
24
+ */
15
25
  export interface TextField extends BaseField {
16
26
  type: FieldType.TEXT;
17
- readonly __primitive_type?: string;
27
+ readonly __valueType: string;
18
28
  maxLength?: number;
19
29
  format?: "email" | "plain" | "rich_text";
20
30
  }
31
+ /**
32
+ * Type definition for a number field.
33
+ */
21
34
  export type NumberFormatting = {
22
35
  style: "integer";
23
36
  } | {
@@ -27,33 +40,51 @@ export type NumberFormatting = {
27
40
  style: "currency";
28
41
  currencyCode: string;
29
42
  };
43
+ /**
44
+ * Type definition for a number field.
45
+ */
30
46
  export interface NumberField extends BaseField {
31
47
  type: FieldType.NUMBER;
32
- readonly __primitive_type?: number;
48
+ readonly __valueType: number;
33
49
  min?: number;
34
50
  max?: number;
35
51
  formatting: NumberFormatting;
36
52
  }
53
+ /**
54
+ * Type definition for a date field.
55
+ */
37
56
  export interface DateField extends BaseField {
38
57
  type: FieldType.DATE;
39
- readonly __primitive_type?: Date;
58
+ readonly __valueType: Date;
40
59
  includeTime: boolean;
41
60
  formatStr: string;
42
61
  }
62
+ /**
63
+ * Type definition for a boolean field.
64
+ */
43
65
  export interface BooleanField extends BaseField {
44
66
  type: FieldType.BOOLEAN;
45
- readonly __primitive_type?: boolean;
67
+ readonly __valueType: boolean;
46
68
  defaultValue?: boolean;
47
69
  }
70
+ /**
71
+ * Type definition for a URL field.
72
+ */
48
73
  export interface URLField extends BaseField {
49
74
  type: FieldType.URL;
50
- readonly __primitive_type?: string;
75
+ readonly __valueType: string;
51
76
  defaultValue?: string;
52
77
  }
78
+ /**
79
+ * TEMPORARY: Type definition for query configuration in relation fields.
80
+ */
53
81
  export type QueryConfig = {};
82
+ /**
83
+ * Type definition for a select field.
84
+ */
54
85
  export interface SelectField extends BaseField {
55
86
  type: FieldType.SELECT;
56
- readonly __primitive_type?: string | number | (string | number)[];
87
+ readonly __valueType: string | number | (string | number)[];
57
88
  multiSelect: boolean;
58
89
  items: Array<{
59
90
  label: string;
@@ -62,55 +93,169 @@ export interface SelectField extends BaseField {
62
93
  }>;
63
94
  defaultValue?: string | number | Array<string | number>;
64
95
  }
96
+ /**
97
+ * Type definition for a relation field.
98
+ */
65
99
  export interface RelationField extends BaseField {
66
100
  type: FieldType.RELATION;
67
- readonly __primitive_type?: any;
101
+ readonly __valueType: any;
68
102
  multiSelect: boolean;
69
103
  targetEntityId: string;
70
104
  displayFieldId: string;
71
105
  query: QueryConfig;
72
106
  }
107
+ /**
108
+ * Union type for all field definitions.
109
+ */
73
110
  export type Field = TextField | NumberField | DateField | BooleanField | URLField | SelectField | RelationField;
74
- export type TextFieldOptions = Omit<TextField, "type" | "__primitive_type" | "ref_id">;
75
- export type NumberFieldOptions = Omit<NumberField, "type" | "__primitive_type" | "ref_id">;
76
- export type DateFieldOptions = Omit<DateField, "type" | "__primitive_type" | "ref_id">;
77
- export type BooleanFieldOptions = Omit<BooleanField, "type" | "__primitive_type" | "ref_id">;
78
- export type URLFieldOptions = Omit<URLField, "type" | "__primitive_type" | "ref_id">;
79
- export type SelectFieldOptions = Omit<SelectField, "type" | "__primitive_type" | "ref_id">;
80
- export type RelationFieldOptions = Omit<RelationField, "type" | "__primitive_type" | "ref_id">;
81
- export declare function defineTextField<const T extends string>(options: TextFieldOptions & {
82
- ref_id: T;
111
+ /**
112
+ * Options for defining a text field.
113
+ */
114
+ export type TextFieldOptions = Omit<TextField, "type" | "__valueType" | "refId" | "required"> & {
115
+ required?: boolean;
116
+ };
117
+ /**
118
+ * Options for defining other field types.
119
+ */
120
+ export type NumberFieldOptions = Omit<NumberField, "type" | "__valueType" | "refId" | "required"> & {
121
+ required?: boolean;
122
+ };
123
+ /**
124
+ * Options for defining other field types.
125
+ */
126
+ export type DateFieldOptions = Omit<DateField, "type" | "__valueType" | "refId" | "required"> & {
127
+ required?: boolean;
128
+ };
129
+ /**
130
+ * Options for defining other field types.
131
+ */
132
+ export type BooleanFieldOptions = Omit<BooleanField, "type" | "__valueType" | "refId" | "required"> & {
133
+ required?: boolean;
134
+ };
135
+ /**
136
+ * Options for defining other field types.
137
+ */
138
+ export type URLFieldOptions = Omit<URLField, "type" | "__valueType" | "refId" | "required"> & {
139
+ required?: boolean;
140
+ };
141
+ /**
142
+ * Options for defining other field types.
143
+ */
144
+ export type SelectFieldOptions = Omit<SelectField, "type" | "__valueType" | "refId" | "required"> & {
145
+ required?: boolean;
146
+ };
147
+ /**
148
+ * Options for defining other field types.
149
+ */
150
+ export type RelationFieldOptions = Omit<RelationField, "type" | "__valueType" | "refId" | "required"> & {
151
+ required?: boolean;
152
+ };
153
+ /**
154
+ * Factory functions to define fields of various types.
155
+ *
156
+ * @remarks
157
+ * These functions help in creating strongly typed field definitions by inferring
158
+ *
159
+ * @param options - The options for defining the field.
160
+ * @returns The defined field with its type.
161
+ */
162
+ export declare function defineTextField<const T extends string, const R extends boolean = false>(options: TextFieldOptions & {
163
+ refId: T;
164
+ required?: R;
83
165
  }): TextField & {
84
- ref_id: T;
166
+ refId: T;
167
+ required: R;
85
168
  };
86
- export declare function defineNumberField<const T extends string>(options: NumberFieldOptions & {
87
- ref_id: T;
169
+ /**
170
+ * Factory function to define a number field.
171
+ *
172
+ * @remarks
173
+ * These functions help in creating strongly typed field definitions by inferring
174
+ *
175
+ * @param options - The options for defining the field.
176
+ * @returns The defined field with its type.
177
+ */
178
+ export declare function defineNumberField<const T extends string, const R extends boolean = false>(options: NumberFieldOptions & {
179
+ refId: T;
180
+ required?: R;
88
181
  }): NumberField & {
89
- ref_id: T;
182
+ refId: T;
183
+ required: R;
90
184
  };
91
- export declare function defineDateField<const T extends string>(options: DateFieldOptions & {
92
- ref_id: T;
185
+ /**
186
+ * Factory function to define a date field.
187
+ *
188
+ * @remarks
189
+ * These functions help in creating strongly typed field definitions by inferring
190
+ *
191
+ * @param options - The options for defining the field.
192
+ * @returns The defined field with its type.
193
+ */
194
+ export declare function defineDateField<const T extends string, const R extends boolean = false>(options: DateFieldOptions & {
195
+ refId: T;
196
+ required?: R;
93
197
  }): DateField & {
94
- ref_id: T;
198
+ refId: T;
199
+ required: R;
95
200
  };
96
- export declare function defineBooleanField<const T extends string>(options: BooleanFieldOptions & {
97
- ref_id: T;
201
+ /**
202
+ * Factory function to define a boolean field.
203
+ *
204
+ * @remarks
205
+ * These functions help in creating strongly typed field definitions by inferring
206
+ *
207
+ * @param options - The options for defining the field.
208
+ * @returns The defined field with its type.
209
+ */
210
+ export declare function defineBooleanField<const T extends string, const R extends boolean = false>(options: BooleanFieldOptions & {
211
+ refId: T;
212
+ required?: R;
98
213
  }): BooleanField & {
99
- ref_id: T;
214
+ refId: T;
215
+ required: R;
100
216
  };
101
- export declare function defineURLField<const T extends string>(options: URLFieldOptions & {
102
- ref_id: T;
217
+ /**
218
+ * Factory function to define a URL field.
219
+ * @param options - The options for defining the field.
220
+ * @returns The defined field with its type.
221
+ */
222
+ export declare function defineURLField<const T extends string, const R extends boolean = false>(options: URLFieldOptions & {
223
+ refId: T;
224
+ required?: R;
103
225
  }): URLField & {
104
- ref_id: T;
226
+ refId: T;
227
+ required: R;
105
228
  };
106
- export declare function defineSelectField<const T extends string>(options: SelectFieldOptions & {
107
- ref_id: T;
229
+ /**
230
+ * Factory function to define a select field.
231
+ *
232
+ * @remarks
233
+ * These functions help in creating strongly typed field definitions by inferring
234
+ *
235
+ * @param options - The options for defining the field.
236
+ * @returns The defined field with its type.
237
+ */
238
+ export declare function defineSelectField<const T extends string, const R extends boolean = false>(options: SelectFieldOptions & {
239
+ refId: T;
240
+ required?: R;
108
241
  }): SelectField & {
109
- ref_id: T;
242
+ refId: T;
243
+ required: R;
110
244
  };
111
- export declare function defineRelationField<const T extends string>(options: RelationFieldOptions & {
112
- ref_id: T;
245
+ /**
246
+ * Factory function to define a relation field.
247
+ *
248
+ * @remarks
249
+ * These functions help in creating strongly typed field definitions by inferring
250
+ *
251
+ * @param options - The options for defining the field.
252
+ * @returns The defined field with its type.
253
+ */
254
+ export declare function defineRelationField<const T extends string, const R extends boolean = false>(options: RelationFieldOptions & {
255
+ refId: T;
256
+ required?: R;
113
257
  }): RelationField & {
114
- ref_id: T;
258
+ refId: T;
259
+ required: R;
115
260
  };
116
261
  export {};
package/dist/fields.js CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Enumeration of supported field types.
3
+ */
1
4
  export var FieldType;
2
5
  (function (FieldType) {
3
6
  FieldType["TEXT"] = "text";
@@ -8,24 +11,118 @@ export var FieldType;
8
11
  FieldType["SELECT"] = "select";
9
12
  FieldType["RELATION"] = "relation";
10
13
  })(FieldType || (FieldType = {}));
14
+ /**
15
+ * Factory functions to define fields of various types.
16
+ *
17
+ * @remarks
18
+ * These functions help in creating strongly typed field definitions by inferring
19
+ *
20
+ * @param options - The options for defining the field.
21
+ * @returns The defined field with its type.
22
+ */
11
23
  export function defineTextField(options) {
12
- return { type: FieldType.TEXT, ...options };
24
+ const { required = false, ...rest } = options;
25
+ return {
26
+ type: FieldType.TEXT,
27
+ required,
28
+ ...rest,
29
+ };
13
30
  }
31
+ /**
32
+ * Factory function to define a number field.
33
+ *
34
+ * @remarks
35
+ * These functions help in creating strongly typed field definitions by inferring
36
+ *
37
+ * @param options - The options for defining the field.
38
+ * @returns The defined field with its type.
39
+ */
14
40
  export function defineNumberField(options) {
15
- return { type: FieldType.NUMBER, ...options };
41
+ const { required = false, ...rest } = options;
42
+ return {
43
+ type: FieldType.NUMBER,
44
+ required,
45
+ ...rest,
46
+ };
16
47
  }
48
+ /**
49
+ * Factory function to define a date field.
50
+ *
51
+ * @remarks
52
+ * These functions help in creating strongly typed field definitions by inferring
53
+ *
54
+ * @param options - The options for defining the field.
55
+ * @returns The defined field with its type.
56
+ */
17
57
  export function defineDateField(options) {
18
- return { type: FieldType.DATE, ...options };
58
+ const { required = false, ...rest } = options;
59
+ return {
60
+ type: FieldType.DATE,
61
+ required,
62
+ ...rest,
63
+ };
19
64
  }
65
+ /**
66
+ * Factory function to define a boolean field.
67
+ *
68
+ * @remarks
69
+ * These functions help in creating strongly typed field definitions by inferring
70
+ *
71
+ * @param options - The options for defining the field.
72
+ * @returns The defined field with its type.
73
+ */
20
74
  export function defineBooleanField(options) {
21
- return { type: FieldType.BOOLEAN, ...options };
75
+ const { required = false, ...rest } = options;
76
+ return {
77
+ type: FieldType.BOOLEAN,
78
+ required,
79
+ ...rest,
80
+ };
22
81
  }
82
+ /**
83
+ * Factory function to define a URL field.
84
+ * @param options - The options for defining the field.
85
+ * @returns The defined field with its type.
86
+ */
23
87
  export function defineURLField(options) {
24
- return { type: FieldType.URL, ...options };
88
+ const { required = false, ...rest } = options;
89
+ return {
90
+ type: FieldType.URL,
91
+ required,
92
+ ...rest,
93
+ };
25
94
  }
95
+ /**
96
+ * Factory function to define a select field.
97
+ *
98
+ * @remarks
99
+ * These functions help in creating strongly typed field definitions by inferring
100
+ *
101
+ * @param options - The options for defining the field.
102
+ * @returns The defined field with its type.
103
+ */
26
104
  export function defineSelectField(options) {
27
- return { type: FieldType.SELECT, ...options };
105
+ const { required = false, ...rest } = options;
106
+ return {
107
+ type: FieldType.SELECT,
108
+ required,
109
+ ...rest,
110
+ };
28
111
  }
112
+ /**
113
+ * Factory function to define a relation field.
114
+ *
115
+ * @remarks
116
+ * These functions help in creating strongly typed field definitions by inferring
117
+ *
118
+ * @param options - The options for defining the field.
119
+ * @returns The defined field with its type.
120
+ */
29
121
  export function defineRelationField(options) {
30
- return { type: FieldType.RELATION, ...options };
122
+ const { required = false, ...rest } = options;
123
+ return {
124
+ type: FieldType.RELATION,
125
+ required,
126
+ ...rest,
127
+ };
31
128
  }
@@ -0,0 +1,130 @@
1
+ import type { EntityModel } from "./entities.js";
2
+ import type { Field } from "./fields.js";
3
+ import type { TransactionModel } from "./transactions.js";
4
+ import type { UnitModel } from "./units.js";
5
+ /**
6
+ * The type of form being defined.
7
+ */
8
+ export declare enum FormType {
9
+ ENTITY = "ENTITY",
10
+ TRANSACTION = "TRANSACTION",
11
+ UNIT = "UNIT"
12
+ }
13
+ /**
14
+ * How a form field is displayed.
15
+ */
16
+ export type FormFieldDisplay = "normal" | "inline" | "disabled" | "hidden";
17
+ /**
18
+ * Configuration options for a form field.
19
+ */
20
+ export type FormFieldConfig = {
21
+ label?: string;
22
+ description?: string;
23
+ display?: FormFieldDisplay;
24
+ };
25
+ /**
26
+ * Infers the form field configuration from a list of fields.
27
+ */
28
+ type InferFieldConfig<TFields extends readonly Field[]> = {
29
+ [K in TFields[number] as K["refId"]]?: FormFieldConfig & {
30
+ required?: K["required"] extends true ? true : boolean;
31
+ };
32
+ };
33
+ /**
34
+ * Base interface for all forms.
35
+ */
36
+ export interface BaseForm {
37
+ refId: string;
38
+ modelRefId: string;
39
+ name: string;
40
+ description?: string;
41
+ fieldOrder?: string[];
42
+ }
43
+ /**
44
+ * Configuration options for entity forms
45
+ */
46
+ export type EntityFormOptions<TModel extends {
47
+ fields?: readonly any[];
48
+ }> = {
49
+ name: string;
50
+ description?: string;
51
+ refId: string;
52
+ fields: InferFieldConfig<NonNullable<TModel["fields"]>>;
53
+ };
54
+ /**
55
+ * Configuration options for unit forms
56
+ */
57
+ export type UnitFormOptions<TModel extends {
58
+ fields?: readonly any[];
59
+ }> = {
60
+ name: string;
61
+ description?: string;
62
+ refId: string;
63
+ fields: InferFieldConfig<NonNullable<TModel["fields"]>>;
64
+ };
65
+ /**
66
+ * Configuration options for transaction forms
67
+ */
68
+ export type TransactionFormOptions<TModel extends {
69
+ fields?: readonly any[];
70
+ }> = {
71
+ name: string;
72
+ description?: string;
73
+ refId: string;
74
+ fields: InferFieldConfig<NonNullable<TModel["fields"]>>;
75
+ };
76
+ /**
77
+ * Form definition for transactions.
78
+ */
79
+ export interface TransactionForm<TModel extends TransactionModel> extends BaseForm {
80
+ type: FormType.TRANSACTION;
81
+ fields: InferFieldConfig<NonNullable<TModel["fields"]>>;
82
+ }
83
+ /**
84
+ * Form definition for entities.
85
+ */
86
+ export interface EntityForm<TModel extends EntityModel> extends BaseForm {
87
+ type: FormType.ENTITY;
88
+ fields: InferFieldConfig<NonNullable<TModel["fields"]>>;
89
+ }
90
+ /**
91
+ * Form definition for units.
92
+ */
93
+ export interface UnitForm<TModel extends UnitModel> extends BaseForm {
94
+ type: FormType.UNIT;
95
+ fields: InferFieldConfig<NonNullable<TModel["fields"]>>;
96
+ }
97
+ /**
98
+ * Factory function to define a transaction form.
99
+ *
100
+ * @remarks
101
+ * This is a pure configuration function that helps create a transaction form
102
+ *
103
+ * @param model The transaction model the form is based on
104
+ * @param config The configuration options for the form
105
+ * @returns A transaction form definition
106
+ */
107
+ export declare function defineTransactionForm<const TModel extends TransactionModel>(model: TModel, config: TransactionFormOptions<TModel>): TransactionForm<TModel>;
108
+ /**
109
+ * Factory function to define an entity form.
110
+ *
111
+ * @remarks
112
+ * This is a pure configuration function that helps create an entity form
113
+ *
114
+ * @param model The entity model the form is based on
115
+ * @param config The configuration options for the form
116
+ * @returns An entity form definition
117
+ */
118
+ export declare function defineEntityForm<const TModel extends EntityModel>(model: TModel, config: EntityFormOptions<TModel>): EntityForm<TModel>;
119
+ /**
120
+ * Factory function to define a unit form.
121
+ *
122
+ * @remarks
123
+ * This is a pure configuration function that helps create a unit form
124
+ *
125
+ * @param model The unit model the form is based on
126
+ * @param config The configuration options for the form
127
+ * @returns A unit form definition
128
+ */
129
+ export declare function defineUnitForm<const TModel extends UnitModel>(model: TModel, config: UnitFormOptions<TModel>): UnitForm<TModel>;
130
+ export {};
package/dist/forms.js ADDED
@@ -0,0 +1,71 @@
1
+ // --- CORE TYPES ---
2
+ /**
3
+ * The type of form being defined.
4
+ */
5
+ export var FormType;
6
+ (function (FormType) {
7
+ FormType["ENTITY"] = "ENTITY";
8
+ FormType["TRANSACTION"] = "TRANSACTION";
9
+ FormType["UNIT"] = "UNIT";
10
+ })(FormType || (FormType = {}));
11
+ // --- FACTORIES (Pure Configuration) ---
12
+ /**
13
+ * Factory function to define a transaction form.
14
+ *
15
+ * @remarks
16
+ * This is a pure configuration function that helps create a transaction form
17
+ *
18
+ * @param model The transaction model the form is based on
19
+ * @param config The configuration options for the form
20
+ * @returns A transaction form definition
21
+ */
22
+ export function defineTransactionForm(model, config) {
23
+ return {
24
+ refId: config.refId,
25
+ name: config.name,
26
+ description: config.description,
27
+ type: FormType.TRANSACTION,
28
+ modelRefId: model.refId,
29
+ fields: config.fields,
30
+ };
31
+ }
32
+ /**
33
+ * Factory function to define an entity form.
34
+ *
35
+ * @remarks
36
+ * This is a pure configuration function that helps create an entity form
37
+ *
38
+ * @param model The entity model the form is based on
39
+ * @param config The configuration options for the form
40
+ * @returns An entity form definition
41
+ */
42
+ export function defineEntityForm(model, config) {
43
+ return {
44
+ refId: config.refId,
45
+ name: config.name,
46
+ description: config.description,
47
+ type: FormType.ENTITY,
48
+ modelRefId: model.refId,
49
+ fields: config.fields,
50
+ };
51
+ }
52
+ /**
53
+ * Factory function to define a unit form.
54
+ *
55
+ * @remarks
56
+ * This is a pure configuration function that helps create a unit form
57
+ *
58
+ * @param model The unit model the form is based on
59
+ * @param config The configuration options for the form
60
+ * @returns A unit form definition
61
+ */
62
+ export function defineUnitForm(model, config) {
63
+ return {
64
+ refId: config.refId,
65
+ name: config.name,
66
+ description: config.description,
67
+ type: FormType.UNIT,
68
+ modelRefId: model.refId,
69
+ fields: config.fields,
70
+ };
71
+ }
package/dist/ledgers.d.ts CHANGED
@@ -1,22 +1,39 @@
1
- import { InferInsertModel, InferSelectModel } from "drizzle-orm";
2
- import * as v from "valibot";
3
- import { InferOutput } from "valibot";
4
- import { KitledgerDb } from "./db.js";
5
- import { FilterOperationParameters, GetOperationResult } from "./db.js";
6
- import { ledgers } from "./schema.js";
7
- export declare const LedgerCreateSchema: v.ObjectSchema<{
8
- readonly ref_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 64, undefined>]>;
9
- readonly alt_id: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 64, undefined>]>, null>;
10
- readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
11
- readonly description: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
12
- readonly unit_model_id: v.StringSchema<undefined>;
13
- readonly active: v.NullishSchema<v.BooleanSchema<undefined>, true>;
14
- readonly created_at: v.OptionalSchema<v.DateSchema<undefined>, undefined>;
15
- readonly updated_at: v.OptionalSchema<v.NullableSchema<v.DateSchema<undefined>, undefined>, undefined>;
16
- }, undefined>;
17
- import { ValidationSuccess, ValidationFailure } from "./validation.js";
18
- export type LedgerInsert = InferInsertModel<typeof ledgers>;
19
- export type Ledger = InferSelectModel<typeof ledgers>;
20
- export type LedgerCreateData = InferOutput<typeof LedgerCreateSchema>;
21
- export declare function filterLedgers(db: KitledgerDb, params: FilterOperationParameters): Promise<GetOperationResult<Ledger>>;
22
- export declare function createLedger(db: KitledgerDb, data: LedgerCreateData): Promise<ValidationSuccess<Ledger> | ValidationFailure<LedgerCreateData>>;
1
+ import type { UnitModel } from "./units.js";
2
+ /**
3
+ * Ledger definitions and utilities.
4
+ *
5
+ * @remarks
6
+ * This module provides type definitions and functions for defining ledgers in the system.
7
+ */
8
+ export type Ledger = {
9
+ refId: string;
10
+ name: string;
11
+ description?: string;
12
+ status: LedgerStatus;
13
+ baseUnitModel: string;
14
+ };
15
+ export declare enum LedgerStatus {
16
+ ACTIVE = "active",
17
+ INACTIVE = "inactive"
18
+ }
19
+ /**
20
+ * Options for defining a ledger.
21
+ *
22
+ * @param refId - The reference ID of the ledger.
23
+ * @param name - The name of the ledger.
24
+ * @param description - An optional description of the ledger.
25
+ * @param active - An optional flag indicating if the ledger is active. Defaults to true.
26
+ * @returns An object containing the options for the ledger.
27
+ */
28
+ export type LedgerOptions = {
29
+ refId: string;
30
+ name: string;
31
+ description?: string;
32
+ status?: LedgerStatus;
33
+ };
34
+ /**
35
+ * Defines a ledger with the given options.
36
+ * @param options - The options for defining the ledger.
37
+ * @returns The defined ledger.
38
+ */
39
+ export declare function defineLedger(options: LedgerOptions, baseUnitModel: UnitModel): Ledger;