@happyvertical/smrt-ledgers 0.51.31 → 0.51.33
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/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/__tests__/helpers/postgres-scratch.d.ts +12 -0
- package/dist/__tests__/helpers/postgres-scratch.d.ts.map +1 -0
- package/dist/collections/Accounts.d.ts +104 -0
- package/dist/collections/Accounts.d.ts.map +1 -0
- package/dist/collections/JournalEntries.d.ts +98 -0
- package/dist/collections/JournalEntries.d.ts.map +1 -0
- package/dist/collections/Journals.d.ts +123 -0
- package/dist/collections/Journals.d.ts.map +1 -0
- package/dist/collections/index.d.ts +4 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/index.d.ts +73 -717
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/migrations/ledger-accounts-table.d.ts +106 -0
- package/dist/migrations/ledger-accounts-table.d.ts.map +1 -0
- package/dist/models/Account.d.ts +70 -0
- package/dist/models/Account.d.ts.map +1 -0
- package/dist/models/Journal.d.ts +116 -0
- package/dist/models/Journal.d.ts.map +1 -0
- package/dist/models/JournalEntry.d.ts +80 -0
- package/dist/models/JournalEntry.d.ts.map +1 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/prompts.d.ts +17 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +4 -4
- package/dist/types.d.ts +107 -179
- package/dist/types.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DatabaseInterface } from '@happyvertical/smrt-core/migrations';
|
|
2
|
+
type Hook = (fn: () => Promise<void>) => void;
|
|
3
|
+
export declare function withScratchDatabase(beforeEach: Hook, afterEach: Hook): {
|
|
4
|
+
/** A connection to this test's database with every registered schema. */
|
|
5
|
+
database(): Promise<DatabaseInterface>;
|
|
6
|
+
};
|
|
7
|
+
/** Rename a table and the indexes named after it, as a legacy build named them. */
|
|
8
|
+
export declare function renameTableWithIndexes(db: DatabaseInterface, from: string, to: string): Promise<void>;
|
|
9
|
+
/** The tables a column's foreign-key constraints reference. */
|
|
10
|
+
export declare function foreignKeyTargets(db: DatabaseInterface, table: string, column: string): Promise<string[]>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=postgres-scratch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-scratch.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/postgres-scratch.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI;IA2BjE,yEAAyE;gBACvD,OAAO,CAAC,iBAAiB,CAAC;EAQ/C;AAED,mFAAmF;AACnF,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,iBAAiB,EACrB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,+DAA+D;AAC/D,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,EAAE,CAAC,CAcnB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccountCollection - Collection manager for Account objects
|
|
3
|
+
*
|
|
4
|
+
* Provides querying and tree operations for chart of accounts.
|
|
5
|
+
*/
|
|
6
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
+
import { Account } from '../models/Account';
|
|
8
|
+
import type { AccountTree, AccountType } from '../types';
|
|
9
|
+
export declare class AccountCollection extends SmrtCollection<Account> {
|
|
10
|
+
static readonly _itemClass: typeof Account;
|
|
11
|
+
/**
|
|
12
|
+
* Find account by number
|
|
13
|
+
*
|
|
14
|
+
* @param number - Account number
|
|
15
|
+
* @returns Account or null
|
|
16
|
+
*/
|
|
17
|
+
findByNumber(number: string): Promise<Account | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Find accounts by type
|
|
20
|
+
*
|
|
21
|
+
* @param type - Account type
|
|
22
|
+
* @returns Array of accounts
|
|
23
|
+
*/
|
|
24
|
+
findByType(type: AccountType): Promise<Account[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Find all active accounts
|
|
27
|
+
*
|
|
28
|
+
* @returns Array of active accounts
|
|
29
|
+
*/
|
|
30
|
+
findActive(): Promise<Account[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Find top-level accounts (no parent)
|
|
33
|
+
*
|
|
34
|
+
* @returns Array of top-level accounts
|
|
35
|
+
*/
|
|
36
|
+
findTopLevel(): Promise<Account[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Find direct children of an account
|
|
39
|
+
*
|
|
40
|
+
* @param parentId - Parent account ID
|
|
41
|
+
* @returns Array of child accounts
|
|
42
|
+
*/
|
|
43
|
+
findChildren(parentId: string): Promise<Account[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Get the complete account tree
|
|
46
|
+
*
|
|
47
|
+
* @returns AccountTree structure
|
|
48
|
+
*/
|
|
49
|
+
getTree(): Promise<AccountTree>;
|
|
50
|
+
/**
|
|
51
|
+
* Get or create an account by number
|
|
52
|
+
*
|
|
53
|
+
* @param number - Account number
|
|
54
|
+
* @param defaults - Default values if creating
|
|
55
|
+
* @returns Account
|
|
56
|
+
*/
|
|
57
|
+
getOrCreateByNumber(number: string, defaults?: Partial<{
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
type: AccountType;
|
|
61
|
+
parentId: string | null;
|
|
62
|
+
}>): Promise<Account>;
|
|
63
|
+
/**
|
|
64
|
+
* Find accounts grouped by type
|
|
65
|
+
*
|
|
66
|
+
* @returns Record of type to accounts array
|
|
67
|
+
*/
|
|
68
|
+
groupByType(): Promise<Record<AccountType, Account[]>>;
|
|
69
|
+
/**
|
|
70
|
+
* Get all descendants of an account recursively
|
|
71
|
+
*
|
|
72
|
+
* @param accountId - Account ID
|
|
73
|
+
* @returns Array of all descendant accounts
|
|
74
|
+
*/
|
|
75
|
+
getDescendants(accountId: string): Promise<Account[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Find all accounts belonging to a specific tenant
|
|
78
|
+
*
|
|
79
|
+
* @param tenantId - Tenant ID
|
|
80
|
+
* @returns Array of tenant's accounts
|
|
81
|
+
*/
|
|
82
|
+
findByTenant(tenantId: string): Promise<Account[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Find all global accounts (no tenant association).
|
|
85
|
+
*
|
|
86
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
87
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
88
|
+
* flagged as an isolation violation). (#1600)
|
|
89
|
+
*
|
|
90
|
+
* @returns Array of global accounts
|
|
91
|
+
*/
|
|
92
|
+
findGlobal(): Promise<Account[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Find accounts for a tenant plus all global accounts.
|
|
95
|
+
*
|
|
96
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
97
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
98
|
+
*
|
|
99
|
+
* @param tenantId - Tenant ID
|
|
100
|
+
* @returns Array of tenant's accounts and global accounts
|
|
101
|
+
*/
|
|
102
|
+
findWithGlobals(tenantId: string): Promise<Account[]>;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMapping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B5D;;;;;OAKG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAyB3D;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIxD;;;;;;;;OAQG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;;;;;OAQG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAG5D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JournalEntryCollection - Collection manager for JournalEntry objects
|
|
3
|
+
*
|
|
4
|
+
* Provides querying and balance calculations for ledger entries.
|
|
5
|
+
*/
|
|
6
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
+
import { JournalEntry } from '../models/JournalEntry';
|
|
8
|
+
import { type TrialBalanceRow } from '../types';
|
|
9
|
+
export declare class JournalEntryCollection extends SmrtCollection<JournalEntry> {
|
|
10
|
+
static readonly _itemClass: typeof JournalEntry;
|
|
11
|
+
/**
|
|
12
|
+
* Find entries by journal
|
|
13
|
+
*
|
|
14
|
+
* @param journalId - Journal ID
|
|
15
|
+
* @returns Array of entries
|
|
16
|
+
*/
|
|
17
|
+
findByJournal(journalId: string): Promise<JournalEntry[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Find entries by account
|
|
20
|
+
*
|
|
21
|
+
* @param accountId - Account ID
|
|
22
|
+
* @returns Array of entries
|
|
23
|
+
*/
|
|
24
|
+
findByAccount(accountId: string): Promise<JournalEntry[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Get account balance
|
|
27
|
+
*
|
|
28
|
+
* For debit-normal accounts (Asset, Expense): balance = debits - credits
|
|
29
|
+
* For credit-normal accounts (Liability, Equity, Revenue): balance = credits - debits
|
|
30
|
+
*
|
|
31
|
+
* @param accountId - Account ID
|
|
32
|
+
* @param asOfDate - Optional date to calculate balance as of
|
|
33
|
+
* @returns Account balance
|
|
34
|
+
*/
|
|
35
|
+
getAccountBalance(accountId: string, asOfDate?: Date): Promise<number>;
|
|
36
|
+
/**
|
|
37
|
+
* Get trial balance
|
|
38
|
+
*
|
|
39
|
+
* @param asOfDate - Optional date for trial balance
|
|
40
|
+
* @returns Array of trial balance rows
|
|
41
|
+
*/
|
|
42
|
+
getTrialBalance(asOfDate?: Date): Promise<TrialBalanceRow[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Get total debits and credits for a date range
|
|
45
|
+
*
|
|
46
|
+
* @param start - Start date
|
|
47
|
+
* @param end - End date
|
|
48
|
+
* @returns Object with totalDebits and totalCredits
|
|
49
|
+
*/
|
|
50
|
+
getTotalsForDateRange(start: Date, end: Date): Promise<{
|
|
51
|
+
totalDebits: number;
|
|
52
|
+
totalCredits: number;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Get entries for multiple accounts
|
|
56
|
+
*
|
|
57
|
+
* @param accountIds - Array of account IDs
|
|
58
|
+
* @returns Array of entries
|
|
59
|
+
*/
|
|
60
|
+
findByAccounts(accountIds: string[]): Promise<JournalEntry[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Get the running balance for an account (list of entries with running total)
|
|
63
|
+
*
|
|
64
|
+
* @param accountId - Account ID
|
|
65
|
+
* @returns Array of entries with running balance
|
|
66
|
+
*/
|
|
67
|
+
getAccountLedger(accountId: string): Promise<Array<{
|
|
68
|
+
entry: JournalEntry;
|
|
69
|
+
runningBalance: number;
|
|
70
|
+
}>>;
|
|
71
|
+
/**
|
|
72
|
+
* Find all journal entries belonging to a specific tenant
|
|
73
|
+
*
|
|
74
|
+
* @param tenantId - Tenant ID
|
|
75
|
+
* @returns Array of tenant's journal entries
|
|
76
|
+
*/
|
|
77
|
+
findByTenant(tenantId: string): Promise<JournalEntry[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Find all global journal entries (no tenant association).
|
|
80
|
+
*
|
|
81
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
82
|
+
* an active tenant context. (#1600)
|
|
83
|
+
*
|
|
84
|
+
* @returns Array of global journal entries
|
|
85
|
+
*/
|
|
86
|
+
findGlobal(): Promise<JournalEntry[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Find journal entries for a tenant plus all global entries.
|
|
89
|
+
*
|
|
90
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
91
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
92
|
+
*
|
|
93
|
+
* @param tenantId - Tenant ID
|
|
94
|
+
* @returns Array of tenant's entries and global entries
|
|
95
|
+
*/
|
|
96
|
+
findWithGlobals(tenantId: string): Promise<JournalEntry[]>;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=JournalEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JournalEntries.d.ts","sourceRoot":"","sources":["../../src/collections/JournalEntries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAEjE,qBAAa,sBAAuB,SAAQ,cAAc,CAAC,YAAY,CAAC;IACtE,MAAM,CAAC,QAAQ,CAAC,UAAU,sBAAgB;IAE1C;;;;;OAKG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAM/D;;;;;OAKG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAM/D;;;;;;;;;OASG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IA4C5E;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IA+BlE;;;;;;OAMG;IACG,qBAAqB,CACzB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,GACR,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAsBzD;;;;;OAKG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAWnE;;;;;OAKG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,KAAK,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IA+ClE;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAI7D;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAI3C;;;;;;;;OAQG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAOjE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JournalCollection - Collection manager for Journal objects
|
|
3
|
+
*
|
|
4
|
+
* Provides querying and operations for financial journals.
|
|
5
|
+
*/
|
|
6
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
+
import { Journal } from '../models/Journal';
|
|
8
|
+
import { type CreateJournalData, type JournalStatus } from '../types';
|
|
9
|
+
export declare class JournalCollection extends SmrtCollection<Journal> {
|
|
10
|
+
static readonly _itemClass: typeof Journal;
|
|
11
|
+
/**
|
|
12
|
+
* Generate next journal number
|
|
13
|
+
*
|
|
14
|
+
* Uses timestamp and random component to avoid collisions
|
|
15
|
+
* in concurrent environments without relying on shared state.
|
|
16
|
+
*/
|
|
17
|
+
private generateJournalNumber;
|
|
18
|
+
/**
|
|
19
|
+
* Find journal by number
|
|
20
|
+
*
|
|
21
|
+
* @param number - Journal number
|
|
22
|
+
* @returns Journal or null
|
|
23
|
+
*/
|
|
24
|
+
findByNumber(number: string): Promise<Journal | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Find journals by date range
|
|
27
|
+
*
|
|
28
|
+
* @param start - Start date
|
|
29
|
+
* @param end - End date
|
|
30
|
+
* @returns Array of journals
|
|
31
|
+
*/
|
|
32
|
+
findByDateRange(start: Date, end: Date): Promise<Journal[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Find journals by source module
|
|
35
|
+
*
|
|
36
|
+
* @param sourceModule - Source module name
|
|
37
|
+
* @returns Array of journals
|
|
38
|
+
*/
|
|
39
|
+
findBySource(sourceModule: string): Promise<Journal[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Find journals by status
|
|
42
|
+
*
|
|
43
|
+
* @param status - Journal status
|
|
44
|
+
* @returns Array of journals
|
|
45
|
+
*/
|
|
46
|
+
findByStatus(status: JournalStatus): Promise<Journal[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Find draft journals
|
|
49
|
+
*
|
|
50
|
+
* @returns Array of draft journals
|
|
51
|
+
*/
|
|
52
|
+
findDrafts(): Promise<Journal[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Find posted journals
|
|
55
|
+
*
|
|
56
|
+
* @returns Array of posted journals
|
|
57
|
+
*/
|
|
58
|
+
findPosted(): Promise<Journal[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Create a complete journal with entries
|
|
61
|
+
*
|
|
62
|
+
* @param data - Journal data with entries
|
|
63
|
+
* @returns Created journal
|
|
64
|
+
*/
|
|
65
|
+
createWithEntries(data: CreateJournalData): Promise<Journal>;
|
|
66
|
+
/**
|
|
67
|
+
* Post a journal by ID
|
|
68
|
+
*
|
|
69
|
+
* @param journalId - Journal ID
|
|
70
|
+
* @returns Posted journal
|
|
71
|
+
*/
|
|
72
|
+
post(journalId: string): Promise<Journal>;
|
|
73
|
+
/**
|
|
74
|
+
* Void a journal by ID
|
|
75
|
+
*
|
|
76
|
+
* @param journalId - Journal ID
|
|
77
|
+
* @param reason - Reason for voiding
|
|
78
|
+
* @returns Voided journal
|
|
79
|
+
*/
|
|
80
|
+
void(journalId: string, reason: string): Promise<Journal>;
|
|
81
|
+
/**
|
|
82
|
+
* Find journals by source reference
|
|
83
|
+
*
|
|
84
|
+
* @param sourceRef - External reference
|
|
85
|
+
* @returns Array of journals
|
|
86
|
+
*/
|
|
87
|
+
findBySourceRef(sourceRef: string): Promise<Journal[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Get journals for a specific month
|
|
90
|
+
*
|
|
91
|
+
* @param year - Year
|
|
92
|
+
* @param month - Month (1-12)
|
|
93
|
+
* @returns Array of journals
|
|
94
|
+
*/
|
|
95
|
+
findByMonth(year: number, month: number): Promise<Journal[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Find all journals belonging to a specific tenant
|
|
98
|
+
*
|
|
99
|
+
* @param tenantId - Tenant ID
|
|
100
|
+
* @returns Array of tenant's journals
|
|
101
|
+
*/
|
|
102
|
+
findByTenant(tenantId: string): Promise<Journal[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Find all global journals (no tenant association).
|
|
105
|
+
*
|
|
106
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
107
|
+
* an active tenant context. (#1600)
|
|
108
|
+
*
|
|
109
|
+
* @returns Array of global journals
|
|
110
|
+
*/
|
|
111
|
+
findGlobal(): Promise<Journal[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Find journals for a tenant plus all global journals.
|
|
114
|
+
*
|
|
115
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
116
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
117
|
+
*
|
|
118
|
+
* @param tenantId - Tenant ID
|
|
119
|
+
* @returns Array of tenant's journals and global journals
|
|
120
|
+
*/
|
|
121
|
+
findWithGlobals(tenantId: string): Promise<Journal[]>;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=Journals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Journals.d.ts","sourceRoot":"","sources":["../../src/collections/Journals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAElB,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC5D,MAAM,CAAC,QAAQ,CAAC,UAAU,iBAAW;IAErC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAQ3D;;;;;;OAMG;IACG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAUjE;;;;;OAKG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAO5D;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAO7D;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;;OAKG;IACG,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAwClE;;;;;OAKG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS/C;;;;;;OAMG;IACG,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