@jsdev_ninja/core 0.15.0 → 0.15.2
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/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.es.js +497 -530
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/Budget.d.ts +68 -59
- package/dist/lib/entities/Budget.d.ts.map +1 -1
- package/dist/lib/entities/Budget.js +47 -36
- package/dist/lib/entities/Cart.d.ts +2257 -10
- package/dist/lib/entities/Cart.d.ts.map +1 -1
- package/dist/lib/entities/Cart.js +16 -0
- package/dist/lib/entities/DeliveryNote.d.ts +0 -1
- package/dist/lib/entities/DeliveryNote.d.ts.map +1 -1
- package/dist/lib/entities/Discount/index.d.ts +0 -1
- package/dist/lib/entities/Discount/index.d.ts.map +1 -1
- package/dist/lib/entities/Discount/index.js +0 -1
- package/dist/lib/entities/Invoice.d.ts +0 -2
- package/dist/lib/entities/Invoice.d.ts.map +1 -1
- package/dist/lib/entities/Locale.d.ts +0 -10
- package/dist/lib/entities/Locale.d.ts.map +1 -1
- package/dist/lib/entities/Locale.js +0 -1
- package/dist/lib/entities/Order.d.ts +1138 -2
- package/dist/lib/entities/Order.d.ts.map +1 -1
- package/dist/lib/entities/Order.js +3 -0
- package/dist/lib/entities/SupplierInvoice.d.ts +6 -1
- package/dist/lib/entities/SupplierInvoice.d.ts.map +1 -1
- package/dist/lib/entities/SupplierInvoice.js +4 -0
- package/dist/lib/entities/index.d.ts +0 -1
- package/dist/lib/entities/index.d.ts.map +1 -1
- package/dist/lib/entities/index.js +0 -1
- package/dist/lib/firebase-api/index.d.ts +15 -0
- package/dist/lib/firebase-api/index.d.ts.map +1 -1
- package/dist/lib/firebase-api/index.js +5 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +58 -58
- package/dist/lib/entities/Chatbot/index.d.ts +0 -96
- package/dist/lib/entities/Chatbot/index.d.ts.map +0 -1
- package/dist/lib/entities/Chatbot/index.js +0 -37
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts +0 -2
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts.map +0 -1
- package/dist/lib/entities/Discount/__tests__/utils.test.js +0 -55
- package/dist/lib/entities/Discount/utils.d.ts +0 -29
- package/dist/lib/entities/Discount/utils.d.ts.map +0 -1
- package/dist/lib/entities/Discount/utils.js +0 -39
- package/dist/lib/firebase-api/app.d.ts +0 -2
- package/dist/lib/firebase-api/app.d.ts.map +0 -1
- package/dist/lib/firebase-api/app.js +0 -16
|
@@ -1,97 +1,106 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
3
|
-
export
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
orderId: z.ZodNullable<z.ZodString>;
|
|
10
|
-
orderTotal: z.ZodNullable<z.ZodNumber>;
|
|
11
|
-
deliveryNoteId: z.ZodNullable<z.ZodString>;
|
|
12
|
-
deliveryNoteNumber: z.ZodNullable<z.ZodString>;
|
|
2
|
+
export declare const BudgetRecordTypeSchema: z.ZodEnum<["debt_increase", "debt_reduction"]>;
|
|
3
|
+
export type TBudgetRecordType = z.infer<typeof BudgetRecordTypeSchema>;
|
|
4
|
+
export declare const BudgetRecordSchema: z.ZodObject<{
|
|
5
|
+
recordId: z.ZodString;
|
|
6
|
+
organizationId: z.ZodString;
|
|
7
|
+
customerId: z.ZodString;
|
|
8
|
+
customerName: z.ZodString;
|
|
13
9
|
billingAccountId: z.ZodNullable<z.ZodString>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
type: z.ZodEnum<["debt_increase", "debt_reduction"]>;
|
|
11
|
+
/** Integer agorot, always positive */
|
|
12
|
+
amount: z.ZodNumber;
|
|
13
|
+
currency: z.ZodLiteral<"ILS">;
|
|
14
|
+
/** orderId (debt_increase) | ledger transactionId (debt_reduction) */
|
|
15
|
+
relatedId: z.ZodString;
|
|
16
|
+
source: z.ZodEnum<["order", "ledger", "manual"]>;
|
|
17
|
+
/** event that caused this — trace + idempotency key; null for manual */
|
|
18
|
+
causedByEventId: z.ZodNullable<z.ZodString>;
|
|
19
|
+
/** epoch millis */
|
|
20
20
|
createdAt: z.ZodNumber;
|
|
21
|
-
|
|
21
|
+
/** Asia/Jerusalem date parts */
|
|
22
|
+
year: z.ZodNumber;
|
|
23
|
+
month: z.ZodNumber;
|
|
24
|
+
/** "2026-05" */
|
|
25
|
+
yearMonth: z.ZodString;
|
|
26
|
+
companyId: z.ZodString;
|
|
27
|
+
storeId: z.ZodString;
|
|
22
28
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
type: "
|
|
24
|
-
|
|
29
|
+
type: "debt_increase" | "debt_reduction";
|
|
30
|
+
companyId: string;
|
|
31
|
+
storeId: string;
|
|
32
|
+
currency: "ILS";
|
|
33
|
+
amount: number;
|
|
34
|
+
organizationId: string;
|
|
25
35
|
createdAt: number;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
orderId: string | null;
|
|
30
|
-
orderTotal: number | null;
|
|
31
|
-
deliveryNoteId: string | null;
|
|
32
|
-
deliveryNoteNumber: string | null;
|
|
36
|
+
recordId: string;
|
|
37
|
+
customerId: string;
|
|
38
|
+
customerName: string;
|
|
33
39
|
billingAccountId: string | null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
relatedId: string;
|
|
41
|
+
source: "order" | "ledger" | "manual";
|
|
42
|
+
causedByEventId: string | null;
|
|
43
|
+
year: number;
|
|
44
|
+
month: number;
|
|
45
|
+
yearMonth: string;
|
|
40
46
|
}, {
|
|
41
|
-
type: "
|
|
42
|
-
|
|
47
|
+
type: "debt_increase" | "debt_reduction";
|
|
48
|
+
companyId: string;
|
|
49
|
+
storeId: string;
|
|
50
|
+
currency: "ILS";
|
|
51
|
+
amount: number;
|
|
52
|
+
organizationId: string;
|
|
43
53
|
createdAt: number;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
orderId: string | null;
|
|
48
|
-
orderTotal: number | null;
|
|
49
|
-
deliveryNoteId: string | null;
|
|
50
|
-
deliveryNoteNumber: string | null;
|
|
54
|
+
recordId: string;
|
|
55
|
+
customerId: string;
|
|
56
|
+
customerName: string;
|
|
51
57
|
billingAccountId: string | null;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
relatedId: string;
|
|
59
|
+
source: "order" | "ledger" | "manual";
|
|
60
|
+
causedByEventId: string | null;
|
|
61
|
+
year: number;
|
|
62
|
+
month: number;
|
|
63
|
+
yearMonth: string;
|
|
58
64
|
}>;
|
|
59
|
-
export
|
|
60
|
-
|
|
65
|
+
export type TBudgetRecord = z.infer<typeof BudgetRecordSchema>;
|
|
66
|
+
export declare const OrganizationBudgetSchema: z.ZodObject<{
|
|
67
|
+
/** = doc id */
|
|
61
68
|
organizationId: z.ZodString;
|
|
62
69
|
organizationName: z.ZodString;
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
/** integer agorot — current outstanding debt */
|
|
71
|
+
totalCurrentDebt: z.ZodNumber;
|
|
72
|
+
/** lifetime sums (agorot) */
|
|
65
73
|
totalDebits: z.ZodNumber;
|
|
66
74
|
totalCredits: z.ZodNumber;
|
|
67
|
-
balance: z.ZodNumber;
|
|
68
75
|
currency: z.ZodLiteral<"ILS">;
|
|
76
|
+
/** epoch millis */
|
|
69
77
|
updatedAt: z.ZodNumber;
|
|
78
|
+
companyId: z.ZodString;
|
|
79
|
+
storeId: z.ZodString;
|
|
70
80
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
id: string;
|
|
72
81
|
companyId: string;
|
|
73
82
|
storeId: string;
|
|
74
83
|
currency: "ILS";
|
|
75
84
|
organizationId: string;
|
|
76
85
|
updatedAt: number;
|
|
77
86
|
organizationName: string;
|
|
87
|
+
totalCurrentDebt: number;
|
|
78
88
|
totalDebits: number;
|
|
79
89
|
totalCredits: number;
|
|
80
|
-
balance: number;
|
|
81
90
|
}, {
|
|
82
|
-
id: string;
|
|
83
91
|
companyId: string;
|
|
84
92
|
storeId: string;
|
|
85
93
|
currency: "ILS";
|
|
86
94
|
organizationId: string;
|
|
87
95
|
updatedAt: number;
|
|
88
96
|
organizationName: string;
|
|
97
|
+
totalCurrentDebt: number;
|
|
89
98
|
totalDebits: number;
|
|
90
99
|
totalCredits: number;
|
|
91
|
-
balance: number;
|
|
92
100
|
}>;
|
|
101
|
+
export type TOrganizationBudget = z.infer<typeof OrganizationBudgetSchema>;
|
|
102
|
+
export declare const BudgetTransactionTypeSchema: z.ZodEnum<["delivery_note", "payment_received", "credit_note", "debit_note", "order_created", "order_cancelled", "order_refunded"]>;
|
|
103
|
+
export declare const PaymentMethodSchema: z.ZodEnum<["check", "bank_transfer", "cash", "credit_card", "other"]>;
|
|
93
104
|
export type TBudgetTransactionType = z.infer<typeof BudgetTransactionTypeSchema>;
|
|
94
105
|
export type TPaymentMethod = z.infer<typeof PaymentMethodSchema>;
|
|
95
|
-
export type TBudgetTransaction = z.infer<typeof BudgetTransactionSchema>;
|
|
96
|
-
export type TBudgetAccount = z.infer<typeof BudgetAccountSchema>;
|
|
97
106
|
//# sourceMappingURL=Budget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Budget.d.ts","sourceRoot":"","sources":["../../../lib/entities/Budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"Budget.d.ts","sourceRoot":"","sources":["../../../lib/entities/Budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB,gDAA8C,CAAC;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEvE,eAAO,MAAM,kBAAkB;;;;;;;IAO9B,sCAAsC;;;IAGtC,sEAAsE;;;IAGtE,wEAAwE;;IAExE,mBAAmB;;IAEnB,gCAAgC;;;IAGhC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIf,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/D,eAAO,MAAM,wBAAwB;IACpC,eAAe;;;IAGf,gDAAgD;;IAEhD,6BAA6B;;;;IAI7B,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAIlB,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAM3E,eAAO,MAAM,2BAA2B,qIAQtC,CAAC;AAEH,eAAO,MAAM,mBAAmB,uEAAqE,CAAC;AAEtG,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACjF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,4 +1,51 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// New flat collections (target model — B0)
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
export const BudgetRecordTypeSchema = z.enum(["debt_increase", "debt_reduction"]);
|
|
6
|
+
export const BudgetRecordSchema = z.object({
|
|
7
|
+
recordId: z.string().min(1),
|
|
8
|
+
organizationId: z.string().min(1),
|
|
9
|
+
customerId: z.string(), // "system" when no acting user
|
|
10
|
+
customerName: z.string(),
|
|
11
|
+
billingAccountId: z.string().nullable(),
|
|
12
|
+
type: BudgetRecordTypeSchema,
|
|
13
|
+
/** Integer agorot, always positive */
|
|
14
|
+
amount: z.number().int().positive(),
|
|
15
|
+
currency: z.literal("ILS"),
|
|
16
|
+
/** orderId (debt_increase) | ledger transactionId (debt_reduction) */
|
|
17
|
+
relatedId: z.string().min(1),
|
|
18
|
+
source: z.enum(["order", "ledger", "manual"]),
|
|
19
|
+
/** event that caused this — trace + idempotency key; null for manual */
|
|
20
|
+
causedByEventId: z.string().nullable(),
|
|
21
|
+
/** epoch millis */
|
|
22
|
+
createdAt: z.number().int().positive(),
|
|
23
|
+
/** Asia/Jerusalem date parts */
|
|
24
|
+
year: z.number().int(),
|
|
25
|
+
month: z.number().int().min(1).max(12),
|
|
26
|
+
/** "2026-05" */
|
|
27
|
+
yearMonth: z.string(),
|
|
28
|
+
companyId: z.string().min(1),
|
|
29
|
+
storeId: z.string().min(1),
|
|
30
|
+
});
|
|
31
|
+
export const OrganizationBudgetSchema = z.object({
|
|
32
|
+
/** = doc id */
|
|
33
|
+
organizationId: z.string().min(1),
|
|
34
|
+
organizationName: z.string(),
|
|
35
|
+
/** integer agorot — current outstanding debt */
|
|
36
|
+
totalCurrentDebt: z.number().int(),
|
|
37
|
+
/** lifetime sums (agorot) */
|
|
38
|
+
totalDebits: z.number().int(),
|
|
39
|
+
totalCredits: z.number().int(),
|
|
40
|
+
currency: z.literal("ILS"),
|
|
41
|
+
/** epoch millis */
|
|
42
|
+
updatedAt: z.number().int().positive(),
|
|
43
|
+
companyId: z.string().min(1),
|
|
44
|
+
storeId: z.string().min(1),
|
|
45
|
+
});
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Legacy collections (kept for backward compatibility — data left inert)
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
2
49
|
export const BudgetTransactionTypeSchema = z.enum([
|
|
3
50
|
"delivery_note",
|
|
4
51
|
"payment_received",
|
|
@@ -9,39 +56,3 @@ export const BudgetTransactionTypeSchema = z.enum([
|
|
|
9
56
|
"order_refunded", // legacy
|
|
10
57
|
]);
|
|
11
58
|
export const PaymentMethodSchema = z.enum(["check", "bank_transfer", "cash", "credit_card", "other"]);
|
|
12
|
-
export const BudgetTransactionSchema = z.object({
|
|
13
|
-
id: z.string(),
|
|
14
|
-
type: BudgetTransactionTypeSchema,
|
|
15
|
-
// positive = debt added (delivery note / debit note), negative = debt reduced (payment / credit)
|
|
16
|
-
debt: z.number(),
|
|
17
|
-
runningBalance: z.number(),
|
|
18
|
-
// order reference
|
|
19
|
-
orderId: z.string().nullable(),
|
|
20
|
-
orderTotal: z.number().nullable(),
|
|
21
|
-
// delivery note reference (for delivery_note type)
|
|
22
|
-
deliveryNoteId: z.string().nullable(),
|
|
23
|
-
deliveryNoteNumber: z.string().nullable(),
|
|
24
|
-
// billing account snapshot (if order had one)
|
|
25
|
-
billingAccountId: z.string().nullable(),
|
|
26
|
-
billingAccountName: z.string().nullable(),
|
|
27
|
-
billingAccountNumber: z.string().nullable(),
|
|
28
|
-
// payment details (for payment_received type — entered by admin)
|
|
29
|
-
paymentReference: z.string().nullable(), // check number, bank transfer ref, etc.
|
|
30
|
-
paymentDate: z.number().nullable(), // timestamp
|
|
31
|
-
paymentMethod: PaymentMethodSchema.nullable(),
|
|
32
|
-
note: z.string().nullable(),
|
|
33
|
-
createdAt: z.number(),
|
|
34
|
-
createdBy: z.string(), // userId or "system"
|
|
35
|
-
});
|
|
36
|
-
export const BudgetAccountSchema = z.object({
|
|
37
|
-
id: z.string(), // organizationId
|
|
38
|
-
organizationId: z.string(),
|
|
39
|
-
organizationName: z.string(),
|
|
40
|
-
companyId: z.string(),
|
|
41
|
-
storeId: z.string(),
|
|
42
|
-
totalDebits: z.number(), // sum of delivery note amounts
|
|
43
|
-
totalCredits: z.number(), // sum of payments received
|
|
44
|
-
balance: z.number(), // totalDebits - totalCredits (positive = owes money)
|
|
45
|
-
currency: z.literal("ILS"),
|
|
46
|
-
updatedAt: z.number(),
|
|
47
|
-
});
|