@jsdev_ninja/core 0.15.3 → 0.17.0

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.
@@ -93,6 +93,7 @@ export declare const EzInvoiceSchema: z.ZodObject<{
93
93
  date?: number | undefined;
94
94
  warning?: string | undefined;
95
95
  }>;
96
+ export type TEzInvoice = z.infer<typeof EzInvoiceSchema>;
96
97
  export declare const InvoiceSchema: z.ZodObject<{
97
98
  id: z.ZodString;
98
99
  number: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../../lib/entities/Invoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCxB,CAAC"}
1
+ {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../../lib/entities/Invoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEzD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCxB,CAAC"}
@@ -2306,6 +2306,111 @@ export declare const OrderSchema: z.ZodObject<{
2306
2306
  date?: number | undefined;
2307
2307
  warning?: string | undefined;
2308
2308
  }>>;
2309
+ /**
2310
+ * Set when an admin records a full payment against o.invoice / o.ezInvoice.
2311
+ * Epoch millis. Absent means no payment has been recorded via the admin payment flow.
2312
+ * A row is "open" iff: invoice exists AND invoicePaidAt is unset AND ezReceipt is unset.
2313
+ */
2314
+ invoicePaidAt: z.ZodOptional<z.ZodNumber>;
2315
+ /**
2316
+ * EZcount receipt stored after recording payment.
2317
+ * Mirrors EzInvoiceSchema shape (doc_uuid, pdf_link, doc_number, …).
2318
+ * Present only after a successful recordInvoicePayment call.
2319
+ */
2320
+ ezReceipt: z.ZodOptional<z.ZodObject<{
2321
+ doc_uuid: z.ZodString;
2322
+ pdf_link: z.ZodString;
2323
+ pdf_link_copy: z.ZodString;
2324
+ doc_number: z.ZodString;
2325
+ sent_mails: z.ZodArray<z.ZodString, "many">;
2326
+ success: z.ZodBoolean;
2327
+ ua_uuid: z.ZodString;
2328
+ calculatedData: z.ZodObject<{
2329
+ _COMMENT: z.ZodOptional<z.ZodString>;
2330
+ transaction_id: z.ZodString;
2331
+ date: z.ZodString;
2332
+ currency: z.ZodString;
2333
+ rate: z.ZodNumber;
2334
+ vat: z.ZodString;
2335
+ vat_price: z.ZodNumber;
2336
+ price_discount: z.ZodNumber;
2337
+ price_discount_in_currency: z.ZodNumber;
2338
+ price_total: z.ZodString;
2339
+ price_total_in_currency: z.ZodNumber;
2340
+ }, "strip", z.ZodTypeAny, {
2341
+ date: string;
2342
+ vat: string;
2343
+ currency: string;
2344
+ transaction_id: string;
2345
+ rate: number;
2346
+ vat_price: number;
2347
+ price_discount: number;
2348
+ price_discount_in_currency: number;
2349
+ price_total: string;
2350
+ price_total_in_currency: number;
2351
+ _COMMENT?: string | undefined;
2352
+ }, {
2353
+ date: string;
2354
+ vat: string;
2355
+ currency: string;
2356
+ transaction_id: string;
2357
+ rate: number;
2358
+ vat_price: number;
2359
+ price_discount: number;
2360
+ price_discount_in_currency: number;
2361
+ price_total: string;
2362
+ price_total_in_currency: number;
2363
+ _COMMENT?: string | undefined;
2364
+ }>;
2365
+ warning: z.ZodOptional<z.ZodString>;
2366
+ date: z.ZodOptional<z.ZodNumber>;
2367
+ }, "strip", z.ZodTypeAny, {
2368
+ doc_uuid: string;
2369
+ pdf_link: string;
2370
+ pdf_link_copy: string;
2371
+ doc_number: string;
2372
+ sent_mails: string[];
2373
+ success: boolean;
2374
+ ua_uuid: string;
2375
+ calculatedData: {
2376
+ date: string;
2377
+ vat: string;
2378
+ currency: string;
2379
+ transaction_id: string;
2380
+ rate: number;
2381
+ vat_price: number;
2382
+ price_discount: number;
2383
+ price_discount_in_currency: number;
2384
+ price_total: string;
2385
+ price_total_in_currency: number;
2386
+ _COMMENT?: string | undefined;
2387
+ };
2388
+ date?: number | undefined;
2389
+ warning?: string | undefined;
2390
+ }, {
2391
+ doc_uuid: string;
2392
+ pdf_link: string;
2393
+ pdf_link_copy: string;
2394
+ doc_number: string;
2395
+ sent_mails: string[];
2396
+ success: boolean;
2397
+ ua_uuid: string;
2398
+ calculatedData: {
2399
+ date: string;
2400
+ vat: string;
2401
+ currency: string;
2402
+ transaction_id: string;
2403
+ rate: number;
2404
+ vat_price: number;
2405
+ price_discount: number;
2406
+ price_discount_in_currency: number;
2407
+ price_total: string;
2408
+ price_total_in_currency: number;
2409
+ _COMMENT?: string | undefined;
2410
+ };
2411
+ date?: number | undefined;
2412
+ warning?: string | undefined;
2413
+ }>>;
2309
2414
  updatedBy: z.ZodOptional<z.ZodString>;
2310
2415
  updatedAt: z.ZodOptional<z.ZodNumber>;
2311
2416
  }, "strip", z.ZodTypeAny, {
@@ -2687,6 +2792,31 @@ export declare const OrderSchema: z.ZodObject<{
2687
2792
  date?: number | undefined;
2688
2793
  warning?: string | undefined;
2689
2794
  } | undefined;
2795
+ invoicePaidAt?: number | undefined;
2796
+ ezReceipt?: {
2797
+ doc_uuid: string;
2798
+ pdf_link: string;
2799
+ pdf_link_copy: string;
2800
+ doc_number: string;
2801
+ sent_mails: string[];
2802
+ success: boolean;
2803
+ ua_uuid: string;
2804
+ calculatedData: {
2805
+ date: string;
2806
+ vat: string;
2807
+ currency: string;
2808
+ transaction_id: string;
2809
+ rate: number;
2810
+ vat_price: number;
2811
+ price_discount: number;
2812
+ price_discount_in_currency: number;
2813
+ price_total: string;
2814
+ price_total_in_currency: number;
2815
+ _COMMENT?: string | undefined;
2816
+ };
2817
+ date?: number | undefined;
2818
+ warning?: string | undefined;
2819
+ } | undefined;
2690
2820
  updatedBy?: string | undefined;
2691
2821
  updatedAt?: number | undefined;
2692
2822
  }, {
@@ -3068,6 +3198,31 @@ export declare const OrderSchema: z.ZodObject<{
3068
3198
  date?: number | undefined;
3069
3199
  warning?: string | undefined;
3070
3200
  } | undefined;
3201
+ invoicePaidAt?: number | undefined;
3202
+ ezReceipt?: {
3203
+ doc_uuid: string;
3204
+ pdf_link: string;
3205
+ pdf_link_copy: string;
3206
+ doc_number: string;
3207
+ sent_mails: string[];
3208
+ success: boolean;
3209
+ ua_uuid: string;
3210
+ calculatedData: {
3211
+ date: string;
3212
+ vat: string;
3213
+ currency: string;
3214
+ transaction_id: string;
3215
+ rate: number;
3216
+ vat_price: number;
3217
+ price_discount: number;
3218
+ price_discount_in_currency: number;
3219
+ price_total: string;
3220
+ price_total_in_currency: number;
3221
+ _COMMENT?: string | undefined;
3222
+ };
3223
+ date?: number | undefined;
3224
+ warning?: string | undefined;
3225
+ } | undefined;
3071
3226
  updatedBy?: string | undefined;
3072
3227
  updatedAt?: number | undefined;
3073
3228
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../lib/entities/Order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKF,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -76,6 +76,18 @@ export const OrderSchema = z.object({
76
76
  invoice: InvoiceSchema.optional(),
77
77
  ezInvoice: EzInvoiceSchema.optional(),
78
78
  ezDeliveryNote: EzDeliveryNoteSchema.optional(),
79
+ /**
80
+ * Set when an admin records a full payment against o.invoice / o.ezInvoice.
81
+ * Epoch millis. Absent means no payment has been recorded via the admin payment flow.
82
+ * A row is "open" iff: invoice exists AND invoicePaidAt is unset AND ezReceipt is unset.
83
+ */
84
+ invoicePaidAt: z.number().int().positive().optional(),
85
+ /**
86
+ * EZcount receipt stored after recording payment.
87
+ * Mirrors EzInvoiceSchema shape (doc_uuid, pdf_link, doc_number, …).
88
+ * Present only after a successful recordInvoicePayment call.
89
+ */
90
+ ezReceipt: EzInvoiceSchema.optional(),
79
91
  // Audit: who last changed the order + when (epoch millis). Stamped by admin writes.
80
92
  updatedBy: z.string().optional(),
81
93
  updatedAt: z.number().optional(),
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ export declare const OrganizationBalanceEntrySchema: z.ZodObject<{
3
+ /** = deterministic dedup doc id */
4
+ id: z.ZodString;
5
+ organizationId: z.ZodString;
6
+ /** "+" increases owed (accrual), "-" decreases owed (settlement/adjustment) */
7
+ sign: z.ZodEnum<["+", "-"]>;
8
+ kind: z.ZodEnum<["accrual", "settlement", "adjustment"]>;
9
+ /** Integer agorot, always positive; sign carries direction */
10
+ amount: z.ZodNumber;
11
+ currency: z.ZodLiteral<"ILS">;
12
+ source: z.ZodEnum<["delivery_note", "ledger_payment", "manual", "order_reversal"]>;
13
+ /** Present for document-sourced accruals */
14
+ document: z.ZodOptional<z.ZodObject<{
15
+ type: z.ZodEnum<["delivery_note", "invoice"]>;
16
+ id: z.ZodString;
17
+ number: z.ZodOptional<z.ZodString>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ type: "invoice" | "delivery_note";
20
+ id: string;
21
+ number?: string | undefined;
22
+ }, {
23
+ type: "invoice" | "delivery_note";
24
+ id: string;
25
+ number?: string | undefined;
26
+ }>>;
27
+ /** Order id (accrual), ledger txId (settlement), or manual ref */
28
+ reference: z.ZodOptional<z.ZodObject<{
29
+ type: z.ZodEnum<["order", "transaction", "manual"]>;
30
+ id: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ type: "order" | "manual" | "transaction";
33
+ id: string;
34
+ }, {
35
+ type: "order" | "manual" | "transaction";
36
+ id: string;
37
+ }>>;
38
+ /** Optional sub-grouping within an org */
39
+ billingAccountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ /** Deterministic dedup key; doc id is derived from this */
41
+ dedupKey: z.ZodString;
42
+ /** Event id when source is event-driven */
43
+ causedByEventId: z.ZodOptional<z.ZodString>;
44
+ /** Epoch millis — used for date-range queries */
45
+ createdAt: z.ZodNumber;
46
+ companyId: z.ZodString;
47
+ storeId: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ id: string;
50
+ companyId: string;
51
+ storeId: string;
52
+ currency: "ILS";
53
+ amount: number;
54
+ organizationId: string;
55
+ createdAt: number;
56
+ source: "manual" | "delivery_note" | "ledger_payment" | "order_reversal";
57
+ sign: "+" | "-";
58
+ kind: "accrual" | "settlement" | "adjustment";
59
+ dedupKey: string;
60
+ billingAccountId?: string | null | undefined;
61
+ causedByEventId?: string | undefined;
62
+ document?: {
63
+ type: "invoice" | "delivery_note";
64
+ id: string;
65
+ number?: string | undefined;
66
+ } | undefined;
67
+ reference?: {
68
+ type: "order" | "manual" | "transaction";
69
+ id: string;
70
+ } | undefined;
71
+ }, {
72
+ id: string;
73
+ companyId: string;
74
+ storeId: string;
75
+ currency: "ILS";
76
+ amount: number;
77
+ organizationId: string;
78
+ createdAt: number;
79
+ source: "manual" | "delivery_note" | "ledger_payment" | "order_reversal";
80
+ sign: "+" | "-";
81
+ kind: "accrual" | "settlement" | "adjustment";
82
+ dedupKey: string;
83
+ billingAccountId?: string | null | undefined;
84
+ causedByEventId?: string | undefined;
85
+ document?: {
86
+ type: "invoice" | "delivery_note";
87
+ id: string;
88
+ number?: string | undefined;
89
+ } | undefined;
90
+ reference?: {
91
+ type: "order" | "manual" | "transaction";
92
+ id: string;
93
+ } | undefined;
94
+ }>;
95
+ export type TOrganizationBalanceEntry = z.infer<typeof OrganizationBalanceEntrySchema>;
96
+ export declare const OrganizationBalanceRollupSchema: z.ZodObject<{
97
+ /** = doc id */
98
+ organizationId: z.ZodString;
99
+ /** Σ(+) − Σ(−), clamped ≥ 0; integer agorot. Non-zero only when totalAccrued > totalSettled. */
100
+ owed: z.ZodNumber;
101
+ /**
102
+ * Overpayment credit: max(0, totalSettled − totalAccrued); integer agorot, ≥ 0.
103
+ * Non-zero only when org has paid MORE than it has accrued.
104
+ * Visibility only — not client-spendable. At most one of {owed, credit} is non-zero.
105
+ */
106
+ credit: z.ZodNumber;
107
+ /** Lifetime Σ(+); integer agorot */
108
+ totalAccrued: z.ZodNumber;
109
+ /** Lifetime Σ(−); integer agorot */
110
+ totalSettled: z.ZodNumber;
111
+ currency: z.ZodLiteral<"ILS">;
112
+ /** Epoch millis */
113
+ updatedAt: z.ZodNumber;
114
+ companyId: z.ZodString;
115
+ storeId: z.ZodString;
116
+ }, "strip", z.ZodTypeAny, {
117
+ companyId: string;
118
+ storeId: string;
119
+ currency: "ILS";
120
+ organizationId: string;
121
+ updatedAt: number;
122
+ owed: number;
123
+ credit: number;
124
+ totalAccrued: number;
125
+ totalSettled: number;
126
+ }, {
127
+ companyId: string;
128
+ storeId: string;
129
+ currency: "ILS";
130
+ organizationId: string;
131
+ updatedAt: number;
132
+ owed: number;
133
+ credit: number;
134
+ totalAccrued: number;
135
+ totalSettled: number;
136
+ }>;
137
+ export type TOrganizationBalanceRollup = z.infer<typeof OrganizationBalanceRollupSchema>;
138
+ //# sourceMappingURL=OrganizationBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrganizationBalance.d.ts","sourceRoot":"","sources":["../../../lib/entities/OrganizationBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,8BAA8B;IAC1C,mCAAmC;;;IAGnC,+EAA+E;;;IAG/E,8DAA8D;;;;IAI9D,4CAA4C;;;;;;;;;;;;;;IAQ5C,kEAAkE;;;;;;;;;;;IAOlE,0CAA0C;;IAE1C,2DAA2D;;IAE3D,2CAA2C;;IAE3C,iDAAiD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIhD,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAMvF,eAAO,MAAM,+BAA+B;IAC3C,eAAe;;IAEf,gGAAgG;;IAEhG;;;;OAIG;;IAEH,oCAAoC;;IAEpC,oCAAoC;;;IAGpC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAIlB,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { z } from "zod";
2
+ // ---------------------------------------------------------------------------
3
+ // Append-only AR entry ledger document
4
+ // ---------------------------------------------------------------------------
5
+ export const OrganizationBalanceEntrySchema = z.object({
6
+ /** = deterministic dedup doc id */
7
+ id: z.string().min(1),
8
+ organizationId: z.string().min(1),
9
+ /** "+" increases owed (accrual), "-" decreases owed (settlement/adjustment) */
10
+ sign: z.enum(["+", "-"]),
11
+ kind: z.enum(["accrual", "settlement", "adjustment"]),
12
+ /** Integer agorot, always positive; sign carries direction */
13
+ amount: z.number().int().positive(),
14
+ currency: z.literal("ILS"),
15
+ source: z.enum(["delivery_note", "ledger_payment", "manual", "order_reversal"]),
16
+ /** Present for document-sourced accruals */
17
+ document: z
18
+ .object({
19
+ type: z.enum(["delivery_note", "invoice"]),
20
+ id: z.string().min(1),
21
+ number: z.string().optional(),
22
+ })
23
+ .optional(),
24
+ /** Order id (accrual), ledger txId (settlement), or manual ref */
25
+ reference: z
26
+ .object({
27
+ type: z.enum(["order", "transaction", "manual"]),
28
+ id: z.string().min(1),
29
+ })
30
+ .optional(),
31
+ /** Optional sub-grouping within an org */
32
+ billingAccountId: z.string().nullable().optional(),
33
+ /** Deterministic dedup key; doc id is derived from this */
34
+ dedupKey: z.string().min(1),
35
+ /** Event id when source is event-driven */
36
+ causedByEventId: z.string().optional(),
37
+ /** Epoch millis — used for date-range queries */
38
+ createdAt: z.number().int().positive(),
39
+ companyId: z.string().min(1),
40
+ storeId: z.string().min(1),
41
+ });
42
+ // ---------------------------------------------------------------------------
43
+ // Per-org rollup cache (O(1) balance reads)
44
+ // ---------------------------------------------------------------------------
45
+ export const OrganizationBalanceRollupSchema = z.object({
46
+ /** = doc id */
47
+ organizationId: z.string().min(1),
48
+ /** Σ(+) − Σ(−), clamped ≥ 0; integer agorot. Non-zero only when totalAccrued > totalSettled. */
49
+ owed: z.number().int(),
50
+ /**
51
+ * Overpayment credit: max(0, totalSettled − totalAccrued); integer agorot, ≥ 0.
52
+ * Non-zero only when org has paid MORE than it has accrued.
53
+ * Visibility only — not client-spendable. At most one of {owed, credit} is non-zero.
54
+ */
55
+ credit: z.number().int(),
56
+ /** Lifetime Σ(+); integer agorot */
57
+ totalAccrued: z.number().int(),
58
+ /** Lifetime Σ(−); integer agorot */
59
+ totalSettled: z.number().int(),
60
+ currency: z.literal("ILS"),
61
+ /** Epoch millis */
62
+ updatedAt: z.number().int().positive(),
63
+ companyId: z.string().min(1),
64
+ storeId: z.string().min(1),
65
+ });
@@ -13,8 +13,10 @@ export * from "./Discount";
13
13
  export * from "./Organization";
14
14
  export * from "./OrganizationGroup";
15
15
  export * from "./DeliveryNote";
16
+ export * from "./Invoice";
16
17
  export * from "./Payment";
17
18
  export * from "./Supplier";
18
19
  export * from "./SupplierInvoice";
19
20
  export * from "./Budget";
21
+ export * from "./OrganizationBalance";
20
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC"}
@@ -13,7 +13,9 @@ export * from "./Discount";
13
13
  export * from "./Organization";
14
14
  export * from "./OrganizationGroup";
15
15
  export * from "./DeliveryNote";
16
+ export * from "./Invoice";
16
17
  export * from "./Payment";
17
18
  export * from "./Supplier";
18
19
  export * from "./SupplierInvoice";
19
20
  export * from "./Budget";
21
+ export * from "./OrganizationBalance";
@@ -28,6 +28,8 @@ export declare const storeCollections: {
28
28
  readonly transactions: "transactions";
29
29
  readonly paymentLinks: "paymentLinks";
30
30
  readonly duplicateChargeAlerts: "duplicateChargeAlerts";
31
+ readonly organizationBalance: "organizationBalance";
32
+ readonly organizationBalanceRollup: "organizationBalanceRollup";
31
33
  };
32
34
  export declare const FirestoreApi: {
33
35
  systemCollections: {
@@ -60,6 +62,8 @@ export declare const FirestoreApi: {
60
62
  readonly transactions: "transactions";
61
63
  readonly paymentLinks: "paymentLinks";
62
64
  readonly duplicateChargeAlerts: "duplicateChargeAlerts";
65
+ readonly organizationBalance: "organizationBalance";
66
+ readonly organizationBalanceRollup: "organizationBalanceRollup";
63
67
  };
64
68
  getPath: ({ companyId, storeId, collectionName, id, }: {
65
69
  companyId: string;
@@ -110,6 +114,8 @@ export declare const FirebaseAPI: {
110
114
  readonly transactions: "transactions";
111
115
  readonly paymentLinks: "paymentLinks";
112
116
  readonly duplicateChargeAlerts: "duplicateChargeAlerts";
117
+ readonly organizationBalance: "organizationBalance";
118
+ readonly organizationBalanceRollup: "organizationBalanceRollup";
113
119
  };
114
120
  getPath: ({ companyId, storeId, collectionName, id, }: {
115
121
  companyId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DASrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;KACZ;wFAUE;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,iBAAiB,EAAE,MAAM,OAAO,gBAAgB,CAAC;QACjD,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;KACf;iCAI4B,MAAM,OAAO,gBAAgB;oCAIzC,MAAM,OAAO,gBAAgB,MACzC,MAAM,qBACS,MAAM,OAAO,gBAAgB;CAIjD,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAtCpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;4FAUE;YACF,SAAS,EAAE,MAAM,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AAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;4FAUE;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,iBAAiB,EAAE,MAAM,OAAO,gBAAgB,CAAC;YACjD,EAAE,EAAE,MAAM,CAAC;YACX,KAAK,CAAC,EAAE,MAAM,CAAC;SACf;qCAI4B,MAAM,OAAO,gBAAgB;wCAIzC,MAAM,OAAO,gBAAgB,MACzC,MAAM,qBACS,MAAM,OAAO,gBAAgB;;CAQjD,CAAC"}
@@ -28,6 +28,8 @@ export const storeCollections = {
28
28
  transactions: "transactions",
29
29
  paymentLinks: "paymentLinks",
30
30
  duplicateChargeAlerts: "duplicateChargeAlerts",
31
+ organizationBalance: "organizationBalance",
32
+ organizationBalanceRollup: "organizationBalanceRollup",
31
33
  };
32
34
  export const FirestoreApi = {
33
35
  systemCollections,
package/dist/lib/index.js CHANGED
@@ -3,3 +3,4 @@ export * from "./utils";
3
3
  export { FirebaseAPI, storeCollections, systemCollections } from "./firebase-api";
4
4
  export * from "./utils/math/math";
5
5
  export * from "./utils/storeCalculator/storeCalculator";
6
+ //