@digimuza/system-core 0.2.0-rc.2 → 0.3.0-rc.1
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/INTEGRATION.md +209 -3
- package/README.md +23 -0
- package/dist/ai/api.d.ts +120 -0
- package/dist/ai/api.d.ts.map +1 -0
- package/dist/ai/api.js +446 -0
- package/dist/ai/api.js.map +1 -0
- package/dist/ai/card.d.ts +27 -0
- package/dist/ai/card.d.ts.map +1 -0
- package/dist/ai/card.js +84 -0
- package/dist/ai/card.js.map +1 -0
- package/dist/ai/contract.d.ts +364 -0
- package/dist/ai/contract.d.ts.map +1 -0
- package/dist/ai/contract.js +101 -0
- package/dist/ai/contract.js.map +1 -0
- package/dist/ai/display.d.ts +20 -0
- package/dist/ai/display.d.ts.map +1 -0
- package/dist/ai/display.js +35 -0
- package/dist/ai/display.js.map +1 -0
- package/dist/ai/index.d.ts +7 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +10 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/manifest.d.ts +25 -0
- package/dist/ai/manifest.d.ts.map +1 -0
- package/dist/ai/manifest.js +15 -0
- package/dist/ai/manifest.js.map +1 -0
- package/dist/ai/runner.d.ts +71 -0
- package/dist/ai/runner.d.ts.map +1 -0
- package/dist/ai/runner.js +246 -0
- package/dist/ai/runner.js.map +1 -0
- package/dist/ai/tools.d.ts +42 -0
- package/dist/ai/tools.d.ts.map +1 -0
- package/dist/ai/tools.js +117 -0
- package/dist/ai/tools.js.map +1 -0
- package/dist/audit/csv.d.ts +31 -0
- package/dist/audit/csv.d.ts.map +1 -0
- package/dist/audit/csv.js +39 -0
- package/dist/audit/csv.js.map +1 -0
- package/dist/audit/index.d.ts +5 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/index.js +6 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/convex/functions.d.ts +39 -0
- package/dist/convex/functions.d.ts.map +1 -1
- package/dist/convex/functions.js +38 -6
- package/dist/convex/functions.js.map +1 -1
- package/dist/convex/index.d.ts +1 -1
- package/dist/convex/index.d.ts.map +1 -1
- package/dist/convex/index.js.map +1 -1
- package/dist/core/access.d.ts +14 -0
- package/dist/core/access.d.ts.map +1 -1
- package/dist/core/access.js +62 -0
- package/dist/core/access.js.map +1 -1
- package/dist/core/audit-module.d.ts +5 -0
- package/dist/core/audit-module.d.ts.map +1 -0
- package/dist/core/audit-module.js +25 -0
- package/dist/core/audit-module.js.map +1 -0
- package/dist/core/audit.d.ts +31 -0
- package/dist/core/audit.d.ts.map +1 -1
- package/dist/core/audit.js +46 -2
- package/dist/core/audit.js.map +1 -1
- package/dist/core/catalog.d.ts +41 -0
- package/dist/core/catalog.d.ts.map +1 -1
- package/dist/core/catalog.js +45 -0
- package/dist/core/catalog.js.map +1 -1
- package/dist/core/context.d.ts +8 -2
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +4 -1
- package/dist/core/context.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/notify.d.ts +37 -0
- package/dist/core/notify.d.ts.map +1 -0
- package/dist/core/notify.js +16 -0
- package/dist/core/notify.js.map +1 -0
- package/dist/core/roles.d.ts.map +1 -1
- package/dist/core/roles.js +5 -1
- package/dist/core/roles.js.map +1 -1
- package/dist/core/system-modules.d.ts +4 -0
- package/dist/core/system-modules.d.ts.map +1 -1
- package/dist/core/system-modules.js +11 -0
- package/dist/core/system-modules.js.map +1 -1
- package/dist/finance/ai-tools.d.ts +55 -0
- package/dist/finance/ai-tools.d.ts.map +1 -0
- package/dist/finance/ai-tools.js +65 -0
- package/dist/finance/ai-tools.js.map +1 -0
- package/dist/finance/index.d.ts +87 -1
- package/dist/finance/index.d.ts.map +1 -1
- package/dist/finance/index.js +92 -38
- package/dist/finance/index.js.map +1 -1
- package/dist/finance/search.d.ts +15 -0
- package/dist/finance/search.d.ts.map +1 -0
- package/dist/finance/search.js +51 -0
- package/dist/finance/search.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/index.d.ts +1 -1
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/notifications/api.d.ts +130 -0
- package/dist/notifications/api.d.ts.map +1 -0
- package/dist/notifications/api.js +384 -0
- package/dist/notifications/api.js.map +1 -0
- package/dist/notifications/contract.d.ts +132 -0
- package/dist/notifications/contract.d.ts.map +1 -0
- package/dist/notifications/contract.js +59 -0
- package/dist/notifications/contract.js.map +1 -0
- package/dist/notifications/index.d.ts +6 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +9 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/search/index.d.ts +95 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +151 -0
- package/dist/search/index.js.map +1 -0
- package/package.json +41 -2
- package/src/ai/api.ts +535 -0
- package/src/ai/card.ts +91 -0
- package/src/ai/contract.ts +245 -0
- package/src/ai/display.ts +38 -0
- package/src/ai/index.ts +9 -0
- package/src/ai/manifest.ts +16 -0
- package/src/ai/runner.ts +275 -0
- package/src/ai/tools.ts +128 -0
- package/src/audit/csv.ts +60 -0
- package/src/audit/index.ts +7 -0
- package/src/convex/functions.ts +54 -7
- package/src/convex/index.ts +1 -1
- package/src/core/access.ts +55 -1
- package/src/core/audit-module.ts +26 -0
- package/src/core/audit.ts +68 -2
- package/src/core/catalog.ts +63 -0
- package/src/core/context.ts +13 -2
- package/src/core/index.ts +2 -0
- package/src/core/notify.ts +52 -0
- package/src/core/roles.ts +5 -1
- package/src/core/system-modules.ts +12 -0
- package/src/finance/ai-tools.ts +68 -0
- package/src/finance/index.ts +119 -42
- package/src/finance/search.ts +58 -0
- package/src/index.ts +2 -0
- package/src/modules/index.ts +3 -0
- package/src/notifications/api.ts +477 -0
- package/src/notifications/contract.ts +142 -0
- package/src/notifications/index.ts +8 -0
- package/src/search/index.ts +198 -0
package/dist/finance/index.js
CHANGED
|
@@ -12,9 +12,21 @@
|
|
|
12
12
|
// role view) in the same transaction as the change and writes an audit event.
|
|
13
13
|
import { defineTable, mutationGeneric, queryGeneric } from "convex/server";
|
|
14
14
|
import { v } from "convex/values";
|
|
15
|
-
import { isFeatureEnabled, recordAudit, SystemError } from "../core/index.js";
|
|
15
|
+
import { defineNotificationType, isFeatureEnabled, notifyIfInstalled, recordAudit, SystemError } from "../core/index.js";
|
|
16
16
|
import { toConvexError } from "../convex/functions.js";
|
|
17
17
|
import { defineModule } from "../modules/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* Sent to holders of `finance:invoice:approve` (not the creator) when a draft is
|
|
20
|
+
* created. Params `{ number, customer, amountCents, currency }`; href
|
|
21
|
+
* `/app/finance?invoice=<number>`. Only when the app installed notifications.
|
|
22
|
+
*/
|
|
23
|
+
export const financeInvoiceAwaitingApproval = defineNotificationType({
|
|
24
|
+
id: "finance.invoice_awaiting_approval",
|
|
25
|
+
moduleId: "finance",
|
|
26
|
+
defaultChannels: { inApp: true, email: true },
|
|
27
|
+
description: "Nauja sąskaita laukia patvirtinimo",
|
|
28
|
+
params: ["number", "customer", "amountCents", "currency"],
|
|
29
|
+
});
|
|
18
30
|
export const finance = defineModule({
|
|
19
31
|
id: "finance",
|
|
20
32
|
kind: "business",
|
|
@@ -34,6 +46,7 @@ export const finance = defineModule({
|
|
|
34
46
|
},
|
|
35
47
|
],
|
|
36
48
|
featureFlags: [{ id: "finance:bulk-approve", description: "Tvirtinti kelias sąskaitas vienu veiksmu", default: false }],
|
|
49
|
+
notificationTypes: [financeInvoiceAwaitingApproval],
|
|
37
50
|
});
|
|
38
51
|
export const FinancePermissions = {
|
|
39
52
|
read: "finance:invoice:read",
|
|
@@ -55,8 +68,12 @@ export const financeTables = {
|
|
|
55
68
|
approvedAt: v.optional(v.number()),
|
|
56
69
|
})
|
|
57
70
|
.index("by_number", ["number"])
|
|
58
|
-
.index("by_status", ["status"])
|
|
71
|
+
.index("by_status", ["status"])
|
|
72
|
+
// Global search (`financeSearch`): full text over the customer name.
|
|
73
|
+
.searchIndex("search_customer", { searchField: "customer" }),
|
|
59
74
|
};
|
|
75
|
+
/** App link to one invoice (search hits, notifications). */
|
|
76
|
+
export const invoiceHref = (number) => `/app/finance?invoice=${encodeURIComponent(number)}`;
|
|
60
77
|
const view = (i) => ({
|
|
61
78
|
id: i._id,
|
|
62
79
|
number: i.number,
|
|
@@ -71,46 +88,82 @@ const actorId = (a) => (a.kind === "user" ? a.userId : a.apiKeyId);
|
|
|
71
88
|
const actorArgs = { apiKey: v.optional(v.string()), operationId: v.optional(v.string()) };
|
|
72
89
|
const opts = (a) => ({ apiKey: a.apiKey, operationId: a.operationId });
|
|
73
90
|
function fail(code, reason, operationId) {
|
|
74
|
-
throw
|
|
91
|
+
throw new SystemError(code, undefined, { reason, operationId });
|
|
92
|
+
}
|
|
93
|
+
/** Newest first, optionally by status. */
|
|
94
|
+
export async function listInvoiceViews(db, filter) {
|
|
95
|
+
const q = db.query("invoices");
|
|
96
|
+
const rows = filter.status
|
|
97
|
+
? await q.withIndex("by_status", (i) => i.eq("status", filter.status)).order("desc").take(filter.limit)
|
|
98
|
+
: await q.order("desc").take(filter.limit);
|
|
99
|
+
return rows.map(view);
|
|
100
|
+
}
|
|
101
|
+
export async function findInvoiceByNumber(db, number) {
|
|
102
|
+
const row = await db.query("invoices").withIndex("by_number", (i) => i.eq("number", number.trim())).unique();
|
|
103
|
+
return row ? view(row) : null;
|
|
104
|
+
}
|
|
105
|
+
/** Validates, enforces unique numbers (CONFLICT), inserts a draft and audits `finance.invoice.create`. */
|
|
106
|
+
export async function createInvoiceRecord(db, sys, actor, input) {
|
|
107
|
+
const number = input.number.trim();
|
|
108
|
+
const customer = input.customer.trim();
|
|
109
|
+
if (!number || !customer || !Number.isInteger(input.amountCents) || input.amountCents <= 0)
|
|
110
|
+
fail("VALIDATION", "invalid_invoice", sys.operationId);
|
|
111
|
+
const currency = (input.currency ?? "EUR").toUpperCase();
|
|
112
|
+
if (!/^[A-Z]{3}$/.test(currency))
|
|
113
|
+
fail("VALIDATION", "invalid_currency", sys.operationId);
|
|
114
|
+
const d = db;
|
|
115
|
+
const existing = await d.query("invoices").withIndex("by_number", (i) => i.eq("number", number)).unique();
|
|
116
|
+
if (existing)
|
|
117
|
+
fail("CONFLICT", "invoice_number_taken", sys.operationId);
|
|
118
|
+
const invoiceId = await d.insert("invoices", { number, customer, amountCents: input.amountCents, currency, status: "draft", createdBy: actorId(actor) });
|
|
119
|
+
await recordAudit(sys, actor, { action: "finance.invoice.create", targetType: "invoice", targetId: invoiceId, changes: { number } });
|
|
120
|
+
// The new draft awaits approval. No-op unless the app installed notifications.
|
|
121
|
+
await notifyIfInstalled(sys, {
|
|
122
|
+
to: { permission: "finance:invoice:approve" },
|
|
123
|
+
type: "finance.invoice_awaiting_approval",
|
|
124
|
+
params: { number, customer, amountCents: input.amountCents, currency },
|
|
125
|
+
href: invoiceHref(number),
|
|
126
|
+
actor,
|
|
127
|
+
});
|
|
128
|
+
return { invoiceId, number };
|
|
129
|
+
}
|
|
130
|
+
/** Approves a draft (NOT_FOUND if missing, CONFLICT unless draft) and audits `finance.invoice.approve`. */
|
|
131
|
+
export async function approveInvoiceRecord(db, sys, actor, invoiceId, changes) {
|
|
132
|
+
const d = db;
|
|
133
|
+
const invoice = await d.get("invoices", invoiceId);
|
|
134
|
+
// A missing invoice and one the caller may not see look the same.
|
|
135
|
+
if (!invoice)
|
|
136
|
+
fail("NOT_FOUND", "invoice_not_found", sys.operationId);
|
|
137
|
+
if (invoice.status !== "draft")
|
|
138
|
+
fail("CONFLICT", "invoice_not_draft", sys.operationId);
|
|
139
|
+
await d.patch("invoices", invoiceId, { status: "approved", approvedBy: actorId(actor), approvedAt: sys.now() });
|
|
140
|
+
await recordAudit(sys, actor, { action: "finance.invoice.approve", targetType: "invoice", targetId: invoiceId, ...(changes ? { changes } : {}) });
|
|
141
|
+
return { invoiceId: invoice._id, number: invoice.number, status: "approved" };
|
|
75
142
|
}
|
|
76
143
|
/** The module's Convex functions, bound to the app's system. Re-export them from `convex/finance.ts`. */
|
|
77
144
|
export function defineFinance(system) {
|
|
78
|
-
|
|
79
|
-
async function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
await db(ctx).patch("invoices", invoiceId, { status: "approved", approvedBy: by, approvedAt: Date.now() });
|
|
145
|
+
/** Runs an invoice operation, translating SystemError to ConvexError. */
|
|
146
|
+
async function guarded(operationId, fn) {
|
|
147
|
+
try {
|
|
148
|
+
return await fn();
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
throw toConvexError(e, operationId);
|
|
152
|
+
}
|
|
87
153
|
}
|
|
88
154
|
return {
|
|
89
155
|
listInvoices: queryGeneric({
|
|
90
156
|
args: { ...actorArgs, status: v.optional(v.union(v.literal("draft"), v.literal("approved"))) },
|
|
91
157
|
handler: async (ctx, a) => {
|
|
92
158
|
await system.requirePermission(ctx, FinancePermissions.read, opts(a));
|
|
93
|
-
|
|
94
|
-
const rows = a.status ? await q.withIndex("by_status", (i) => i.eq("status", a.status)).order("desc").take(100) : await q.order("desc").take(100);
|
|
95
|
-
return rows.map(view);
|
|
159
|
+
return listInvoiceViews(ctx.db, { status: a.status, limit: 100 });
|
|
96
160
|
},
|
|
97
161
|
}),
|
|
98
162
|
createInvoice: mutationGeneric({
|
|
99
163
|
args: { ...actorArgs, number: v.string(), customer: v.string(), amountCents: v.number(), currency: v.optional(v.string()) },
|
|
100
164
|
handler: async (ctx, a) => {
|
|
101
165
|
const { sys, actor } = await system.requirePermission(ctx, FinancePermissions.create, opts(a));
|
|
102
|
-
const
|
|
103
|
-
const customer = a.customer.trim();
|
|
104
|
-
if (!number || !customer || !Number.isInteger(a.amountCents) || a.amountCents <= 0)
|
|
105
|
-
fail("VALIDATION", "invalid_invoice", sys.operationId);
|
|
106
|
-
const currency = (a.currency ?? "EUR").toUpperCase();
|
|
107
|
-
if (!/^[A-Z]{3}$/.test(currency))
|
|
108
|
-
fail("VALIDATION", "invalid_currency", sys.operationId);
|
|
109
|
-
const existing = await db(ctx).query("invoices").withIndex("by_number", (i) => i.eq("number", number)).unique();
|
|
110
|
-
if (existing)
|
|
111
|
-
fail("CONFLICT", "invoice_number_taken", sys.operationId);
|
|
112
|
-
const invoiceId = await db(ctx).insert("invoices", { number, customer, amountCents: a.amountCents, currency, status: "draft", createdBy: actorId(actor) });
|
|
113
|
-
await recordAudit(sys, actor, { action: "finance.invoice.create", targetType: "invoice", targetId: invoiceId, changes: { number } });
|
|
166
|
+
const { invoiceId } = await guarded(sys.operationId, () => createInvoiceRecord(ctx.db, sys, actor, { number: a.number, customer: a.customer, amountCents: a.amountCents, currency: a.currency }));
|
|
114
167
|
return { invoiceId, operationId: sys.operationId };
|
|
115
168
|
},
|
|
116
169
|
}),
|
|
@@ -118,8 +171,7 @@ export function defineFinance(system) {
|
|
|
118
171
|
args: { ...actorArgs, invoiceId: v.id("invoices") },
|
|
119
172
|
handler: async (ctx, a) => {
|
|
120
173
|
const { sys, actor } = await system.requirePermission(ctx, FinancePermissions.approve, opts(a));
|
|
121
|
-
await
|
|
122
|
-
await recordAudit(sys, actor, { action: "finance.invoice.approve", targetType: "invoice", targetId: a.invoiceId });
|
|
174
|
+
await guarded(sys.operationId, () => approveInvoiceRecord(ctx.db, sys, actor, a.invoiceId));
|
|
123
175
|
return { operationId: sys.operationId };
|
|
124
176
|
},
|
|
125
177
|
}),
|
|
@@ -128,17 +180,19 @@ export function defineFinance(system) {
|
|
|
128
180
|
args: { ...actorArgs, invoiceIds: v.array(v.id("invoices")) },
|
|
129
181
|
handler: async (ctx, a) => {
|
|
130
182
|
const { sys, actor } = await system.requirePermission(ctx, FinancePermissions.approve, opts(a));
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
183
|
+
return guarded(sys.operationId, async () => {
|
|
184
|
+
if (!(await isFeatureEnabled(sys, FINANCE_BULK_APPROVE_FLAG)))
|
|
185
|
+
fail("FORBIDDEN", "flag_off", sys.operationId);
|
|
186
|
+
if (a.invoiceIds.length > FINANCE_BULK_LIMIT)
|
|
187
|
+
fail("VALIDATION", "too_many", sys.operationId);
|
|
188
|
+
for (const id of a.invoiceIds)
|
|
189
|
+
await approveInvoiceRecord(ctx.db, sys, actor, id, { bulk: true });
|
|
190
|
+
return { approved: a.invoiceIds.length, operationId: sys.operationId };
|
|
191
|
+
});
|
|
140
192
|
},
|
|
141
193
|
}),
|
|
142
194
|
};
|
|
143
195
|
}
|
|
196
|
+
export { financeTools, financeListInvoicesTool, financeCreateInvoiceTool, financeApproveInvoiceTool } from "./ai-tools.js";
|
|
197
|
+
export { financeSearch, searchInvoices } from "./search.js";
|
|
144
198
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/finance/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,iDAAiD;AACjD,EAAE;AACF,wBAAwB;AACxB,uEAAuE;AACvE,wBAAwB;AACxB,qEAAqE;AACrE,yBAAyB;AACzB,8GAA8G;AAC9G,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/finance/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;A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AAE,GAAG,CAAC,WAAW,EAAE,CAAA;gBACxE,CAAC,CAAC,CAAA;YACJ,CAAC;SACF,CAAC;KACH,CAAA;AACH,CAAC;AAID,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAC1H,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type SearchHit } from "../search/index.js";
|
|
2
|
+
import { type InvoiceDoc } from "./index.js";
|
|
3
|
+
/** Invoices whose number starts with the query (as typed, then upper-cased), then customers matching it. */
|
|
4
|
+
export declare function searchInvoices(db: unknown, query: string, limit: number): Promise<InvoiceDoc[]>;
|
|
5
|
+
export declare const financeSearch: {
|
|
6
|
+
readonly id: "finance.invoices";
|
|
7
|
+
readonly moduleId: "finance";
|
|
8
|
+
readonly label: "Sąskaitos";
|
|
9
|
+
readonly permission: "finance:invoice:read";
|
|
10
|
+
readonly search: ({ db }: import("../search/index.js").SearchContext, { query, limit }: {
|
|
11
|
+
query: string;
|
|
12
|
+
limit: number;
|
|
13
|
+
}) => Promise<SearchHit[]>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/finance/search.ts"],"names":[],"mappings":"AASA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAWzD,4GAA4G;AAC5G,wBAAsB,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAmBrG;AAED,eAAO,MAAM,aAAa;;;;;;;;UAKkB,OAAO,CAAC,SAAS,EAAE,CAAC;CAS9D,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Global search provider of the finance module (DIG-72). Install it with
|
|
2
|
+
//
|
|
3
|
+
// export const { search } = defineSearch(system, { providers: [financeSearch] }).functions
|
|
4
|
+
//
|
|
5
|
+
// Finds invoices by number (prefix, via the `by_number` index) and by customer
|
|
6
|
+
// (full text, via the `search_customer` search index). Read-only and bounded.
|
|
7
|
+
//
|
|
8
|
+
// Note: `./index.ts` re-exports this file, so only function declarations from it
|
|
9
|
+
// may be used here at module top level (no consts: circular import).
|
|
10
|
+
import { defineSearchProvider } from "../search/index.js";
|
|
11
|
+
import { invoiceHref } from "./index.js";
|
|
12
|
+
/** Invoices whose number starts with the query (as typed, then upper-cased), then customers matching it. */
|
|
13
|
+
export async function searchInvoices(db, query, limit) {
|
|
14
|
+
const d = db;
|
|
15
|
+
const out = new Map();
|
|
16
|
+
for (const prefix of new Set([query, query.toUpperCase()])) {
|
|
17
|
+
if (out.size >= limit)
|
|
18
|
+
break;
|
|
19
|
+
const rows = await d
|
|
20
|
+
.query("invoices")
|
|
21
|
+
.withIndex("by_number", (q) => q.gte("number", prefix).lt("number", `${prefix}`))
|
|
22
|
+
.take(limit);
|
|
23
|
+
for (const r of rows)
|
|
24
|
+
out.set(r._id, r);
|
|
25
|
+
}
|
|
26
|
+
if (out.size < limit) {
|
|
27
|
+
const rows = await d
|
|
28
|
+
.query("invoices")
|
|
29
|
+
.withSearchIndex("search_customer", (q) => q.search("customer", query))
|
|
30
|
+
.take(limit);
|
|
31
|
+
for (const r of rows)
|
|
32
|
+
if (!out.has(r._id))
|
|
33
|
+
out.set(r._id, r);
|
|
34
|
+
}
|
|
35
|
+
return [...out.values()].slice(0, limit);
|
|
36
|
+
}
|
|
37
|
+
export const financeSearch = defineSearchProvider({
|
|
38
|
+
id: "finance.invoices",
|
|
39
|
+
moduleId: "finance",
|
|
40
|
+
label: "Sąskaitos",
|
|
41
|
+
permission: "finance:invoice:read",
|
|
42
|
+
search: async ({ db }, { query, limit }) => (await searchInvoices(db, query, limit)).map((i) => ({
|
|
43
|
+
providerId: "finance.invoices",
|
|
44
|
+
id: i._id,
|
|
45
|
+
title: i.number,
|
|
46
|
+
subtitle: i.customer,
|
|
47
|
+
href: invoiceHref(i.number),
|
|
48
|
+
kind: "invoice",
|
|
49
|
+
})),
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/finance/search.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,6FAA6F;AAC7F,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,EAAE;AACF,iFAAiF;AACjF,qEAAqE;AACrE,OAAO,EAAE,oBAAoB,EAAkB,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAA;AAWzD,4GAA4G;AAC5G,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAW,EAAE,KAAa,EAAE,KAAa;IAC5E,MAAM,CAAC,GAAG,EAAqB,CAAA;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAsB,CAAA;IACzC,KAAK,MAAM,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;QAC3D,IAAI,GAAG,CAAC,IAAI,IAAI,KAAK;YAAE,MAAK;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC;aACjB,KAAK,CAAC,UAAU,CAAC;aACjB,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,MAAM,GAAG,CAAC,CAAC;aACjF,IAAI,CAAC,KAAK,CAAC,CAAA;QACd,KAAK,MAAM,CAAC,IAAI,IAA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B,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC;CACN,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export type { SessionSummary, ModuleState } from "./core/modules-service.js";
|
|
|
7
7
|
export type { PublicApiKey } from "./core/api-keys.js";
|
|
8
8
|
export type { PublicInvite } from "./core/invites.js";
|
|
9
9
|
export type { PublicUser, Profile } from "./core/users.js";
|
|
10
|
+
export { auditToCsv, csvCell, AUDIT_CSV_COLUMNS, type AuditCsvEvent, type AuditCsvOptions } from "./audit/csv.js";
|
|
11
|
+
export { auditModuleOf } from "./core/audit-module.js";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,KAAK,SAAS,EACd,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjF,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACtH,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5E,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,KAAK,SAAS,EACd,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjF,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACtH,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5E,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,6 @@ export { ERROR_CODES, SystemError, isSystemError, fromErrorData, toSystemError,
|
|
|
4
4
|
export { redact, redactString, REDACTED, isSensitiveKey } from "./core/redact.js";
|
|
5
5
|
export * from "./diagnostics/logging.js";
|
|
6
6
|
export * from "./diagnostics/tracing.js";
|
|
7
|
+
export { auditToCsv, csvCell, AUDIT_CSV_COLUMNS } from "./audit/csv.js";
|
|
8
|
+
export { auditModuleOf } from "./core/audit-module.js";
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,8DAA8D;AAC9D,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,GAGd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjF,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,8DAA8D;AAC9D,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,GAGd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjF,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AAMxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAA4C,MAAM,gBAAgB,CAAA;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA"}
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defineModule, manifestProblems, manifestSchema, CatalogError, MODULE_ID, PERMISSION_ID, SCOPED_ID, type ModuleManifest, type PermissionDefinition, type SubroleTemplate, type FeatureFlagDefinition, type PermissionOf, type Catalog, } from "../core/catalog.js";
|
|
1
|
+
export { defineModule, manifestProblems, manifestSchema, CatalogError, MODULE_ID, PERMISSION_ID, SCOPED_ID, type ModuleManifest, type PermissionDefinition, type SubroleTemplate, type FeatureFlagDefinition, defineNotificationType, NOTIFICATION_TYPE_ID, type NotificationTypeDefinition, type PermissionOf, type Catalog, } from "../core/catalog.js";
|
|
2
2
|
export { createSystem, type SystemOptions, type SystemDefinition } from "../core/context.js";
|
|
3
3
|
export { SYSTEM_MODULES, SYSTEM_ROLES, ADMIN_ROLE_ID, PROFILE_ROLE_ID, P as SystemPermissions } from "../core/system-modules.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,OAAO,GACb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,OAAO,GACb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAA"}
|
package/dist/modules/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Module authoring API.
|
|
2
|
-
export { defineModule, manifestProblems, manifestSchema, CatalogError, MODULE_ID, PERMISSION_ID, SCOPED_ID, } from "../core/catalog.js";
|
|
2
|
+
export { defineModule, manifestProblems, manifestSchema, CatalogError, MODULE_ID, PERMISSION_ID, SCOPED_ID, defineNotificationType, NOTIFICATION_TYPE_ID, } from "../core/catalog.js";
|
|
3
3
|
export { createSystem } from "../core/context.js";
|
|
4
4
|
export { SYSTEM_MODULES, SYSTEM_ROLES, ADMIN_ROLE_ID, PROFILE_ROLE_ID, P as SystemPermissions } from "../core/system-modules.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,SAAS,EAKT,sBAAsB,EACtB,oBAAoB,GAIrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,YAAY,EAA6C,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Catalog, NotificationTypeDefinition } from "../core/catalog.js";
|
|
2
|
+
import type { SystemContext } from "../core/context.js";
|
|
3
|
+
import type { Notifier, NotifyRequest } from "../core/notify.js";
|
|
4
|
+
import { type ConvexNotificationsHook, type ConvexSystem, type DbCtx } from "../convex/functions.js";
|
|
5
|
+
import { type DeliverNotificationEmail, type NotificationEmailJob as EmailJob, type NotificationPreferenceView, type NotificationView, type RenderNotificationEmail } from "./contract.js";
|
|
6
|
+
export interface NotificationsHookOptions {
|
|
7
|
+
/** Convex module path (relative to convex/) of the notifications functions. Default "notifications". */
|
|
8
|
+
functionsModule?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether emails can be sent at all. Set `false` when the app has no
|
|
11
|
+
* `deliverEmail`: rows then go straight to `skipped` without scheduling an action.
|
|
12
|
+
* Default true (the action marks `skipped` if an adapter is missing).
|
|
13
|
+
*/
|
|
14
|
+
email?: boolean;
|
|
15
|
+
/** App-local notification types on top of those declared in module manifests. */
|
|
16
|
+
types?: readonly NotificationTypeDefinition[];
|
|
17
|
+
/** Locale for users without a profile locale. Default "lt". */
|
|
18
|
+
defaultLocale?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Created by `notificationsHook`; pass it to `defineConvexSystem({ notifications })`. */
|
|
21
|
+
export declare class NotificationsInstall implements ConvexNotificationsHook {
|
|
22
|
+
readonly functionsModule: string;
|
|
23
|
+
readonly email: boolean;
|
|
24
|
+
readonly defaultLocale: string;
|
|
25
|
+
private readonly extraTypes;
|
|
26
|
+
private readonly cache;
|
|
27
|
+
constructor(options?: NotificationsHookOptions);
|
|
28
|
+
/** All notification types of the system: module manifests + `types`. Throws on unknown modules or collisions. */
|
|
29
|
+
typesOf(catalog: Catalog): ReadonlyMap<string, NotificationTypeDefinition>;
|
|
30
|
+
deliverRef(): import("convex/server").FunctionReference<"action", "public", any, any, string | undefined>;
|
|
31
|
+
bind(ctx: DbCtx, sys: SystemContext): Notifier;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The system hook that installs notifications:
|
|
35
|
+
*
|
|
36
|
+
* defineConvexSystem({ modules, notifications: notificationsHook() })
|
|
37
|
+
*
|
|
38
|
+
* Every mutation's SystemContext then carries a notifier, so core services
|
|
39
|
+
* (role assignment) and modules (finance) notify through `notifyIfInstalled`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function notificationsHook(options?: NotificationsHookOptions): NotificationsInstall;
|
|
42
|
+
/**
|
|
43
|
+
* Sends a notification from any mutation of a module:
|
|
44
|
+
*
|
|
45
|
+
* await notify(ctx, sys, { to: { permission: "crm:lead:assign" }, type: "crm.lead_assigned", params: { name }, href: "/app/crm", actor })
|
|
46
|
+
*
|
|
47
|
+
* `to.permission` → active users holding it now (via `decide`; module state and
|
|
48
|
+
* role view apply), without the acting user unless `includeActor`. At most
|
|
49
|
+
* NOTIFY_MAX_RECIPIENTS. Each recipient's preferences apply; emails are scheduled
|
|
50
|
+
* only for those with email on. Returns the count; 0 when notifications are not
|
|
51
|
+
* installed. Throws VALIDATION for an unknown type, bad params or href.
|
|
52
|
+
* (Core services and package modules use the swallowing `notifyIfInstalled`.)
|
|
53
|
+
*/
|
|
54
|
+
export declare function notify(ctx: {
|
|
55
|
+
db: unknown;
|
|
56
|
+
scheduler?: unknown;
|
|
57
|
+
}, sys: SystemContext, request: NotifyRequest): Promise<number>;
|
|
58
|
+
export interface NotificationsOptions {
|
|
59
|
+
/** Renders subject and text from type + params in the recipient's locale. */
|
|
60
|
+
renderEmail?: RenderNotificationEmail;
|
|
61
|
+
/** Sends the email. Without it (or without `renderEmail`) email stays `skipped`. */
|
|
62
|
+
deliverEmail?: DeliverNotificationEmail;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The notifications Convex functions, bound to the app's system (which must have
|
|
66
|
+
* `notifications: notificationsHook()`):
|
|
67
|
+
*
|
|
68
|
+
* // convex/notifications.ts
|
|
69
|
+
* export const { listNotifications, …, _deliverNotificationEmail, _claimNotificationEmail, _recordNotificationEmail } =
|
|
70
|
+
* defineNotifications(system, { renderEmail, deliverEmail }).functions
|
|
71
|
+
*/
|
|
72
|
+
export declare function defineNotifications(system: ConvexSystem, options?: NotificationsOptions): {
|
|
73
|
+
functions: {
|
|
74
|
+
listNotifications: import("convex/server").RegisteredQuery<"public", {
|
|
75
|
+
apiKey?: string | undefined;
|
|
76
|
+
cursor?: string | null | undefined;
|
|
77
|
+
limit?: number | undefined;
|
|
78
|
+
operationId?: string | undefined;
|
|
79
|
+
unreadOnly?: boolean | undefined;
|
|
80
|
+
}, Promise<{
|
|
81
|
+
items: NotificationView[];
|
|
82
|
+
cursor: string | null;
|
|
83
|
+
done: boolean;
|
|
84
|
+
}>>;
|
|
85
|
+
unreadNotificationCount: import("convex/server").RegisteredQuery<"public", {
|
|
86
|
+
apiKey?: string | undefined;
|
|
87
|
+
operationId?: string | undefined;
|
|
88
|
+
}, Promise<number>>;
|
|
89
|
+
markNotificationRead: import("convex/server").RegisteredMutation<"public", {
|
|
90
|
+
apiKey?: string | undefined;
|
|
91
|
+
notificationId: import("convex/values").GenericId<"notifications">;
|
|
92
|
+
operationId?: string | undefined;
|
|
93
|
+
}, Promise<{
|
|
94
|
+
read: boolean;
|
|
95
|
+
}>>;
|
|
96
|
+
markAllNotificationsRead: import("convex/server").RegisteredMutation<"public", {
|
|
97
|
+
apiKey?: string | undefined;
|
|
98
|
+
operationId?: string | undefined;
|
|
99
|
+
}, Promise<{
|
|
100
|
+
marked: number;
|
|
101
|
+
done: boolean;
|
|
102
|
+
}>>;
|
|
103
|
+
getNotificationPreferences: import("convex/server").RegisteredQuery<"public", {
|
|
104
|
+
apiKey?: string | undefined;
|
|
105
|
+
operationId?: string | undefined;
|
|
106
|
+
}, Promise<NotificationPreferenceView[]>>;
|
|
107
|
+
setNotificationPreference: import("convex/server").RegisteredMutation<"public", {
|
|
108
|
+
apiKey?: string | undefined;
|
|
109
|
+
email: boolean;
|
|
110
|
+
inApp: boolean;
|
|
111
|
+
operationId?: string | undefined;
|
|
112
|
+
type: string;
|
|
113
|
+
}, Promise<NotificationPreferenceView>>;
|
|
114
|
+
/** Scheduled by `notify` for each row with email `pending`. Never throws. */
|
|
115
|
+
_deliverNotificationEmail: import("convex/server").RegisteredAction<"internal", {
|
|
116
|
+
notificationId: import("convex/values").GenericId<"notifications">;
|
|
117
|
+
}, Promise<"failed" | "none" | "pending" | "sent" | "skipped">>;
|
|
118
|
+
/** → the email job, or null (and `skipped`) when there is nothing to send. */
|
|
119
|
+
_claimNotificationEmail: import("convex/server").RegisteredMutation<"internal", {
|
|
120
|
+
notificationId: import("convex/values").GenericId<"notifications">;
|
|
121
|
+
}, Promise<EmailJob | null>>;
|
|
122
|
+
_recordNotificationEmail: import("convex/server").RegisteredMutation<"internal", {
|
|
123
|
+
notificationId: import("convex/values").GenericId<"notifications">;
|
|
124
|
+
ok: boolean;
|
|
125
|
+
}, Promise<null>>;
|
|
126
|
+
};
|
|
127
|
+
types: ReadonlyMap<string, NotificationTypeDefinition>;
|
|
128
|
+
};
|
|
129
|
+
export type NotificationsSystem = ReturnType<typeof defineNotifications>;
|
|
130
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/notifications/api.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAsB,MAAM,mBAAmB,CAAA;AAEpF,OAAO,EAAiB,KAAK,uBAAuB,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnH,OAAO,EAML,KAAK,wBAAwB,EAE7B,KAAK,oBAAoB,IAAI,QAAQ,EAErC,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAA;AAoDtB,MAAM,WAAW,wBAAwB;IACvC,wGAAwG;IACxG,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;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