@odla-ai/crm 0.8.0 → 0.9.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/dist/chunk-7LH3WGSU.js +1279 -0
- package/dist/chunk-7LH3WGSU.js.map +1 -0
- package/dist/client-CMYE9fpt.d.ts +566 -0
- package/dist/gallery/index.d.ts +17 -0
- package/dist/gallery/index.js +1080 -0
- package/dist/gallery/index.js.map +1 -0
- package/dist/index.cjs +28 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/ui/index.d.ts +1 -565
- package/dist/ui/index.js +20 -1255
- package/dist/ui/index.js.map +1 -1
- package/package.json +6 -2
package/dist/index.d.cts
CHANGED
|
@@ -1159,8 +1159,8 @@ interface TypeSummary {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
/**
|
|
1161
1161
|
* Tile counts for one record type: total live records, per-stage counts,
|
|
1162
|
-
* and the open-task load.
|
|
1163
|
-
*
|
|
1162
|
+
* and the open-task load. A batch-capable database answers all S+2 indexed
|
|
1163
|
+
* counts through one Durable Object request.
|
|
1164
1164
|
*/
|
|
1165
1165
|
declare function typeSummary(deps: CrmDeps, type: string): Promise<TypeSummary>;
|
|
1166
1166
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1159,8 +1159,8 @@ interface TypeSummary {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
/**
|
|
1161
1161
|
* Tile counts for one record type: total live records, per-stage counts,
|
|
1162
|
-
* and the open-task load.
|
|
1163
|
-
*
|
|
1162
|
+
* and the open-task load. A batch-capable database answers all S+2 indexed
|
|
1163
|
+
* counts through one Durable Object request.
|
|
1164
1164
|
*/
|
|
1165
1165
|
declare function typeSummary(deps: CrmDeps, type: string): Promise<TypeSummary>;
|
|
1166
1166
|
|
package/dist/index.js
CHANGED
|
@@ -684,10 +684,14 @@ function resultAsWritten(result) {
|
|
|
684
684
|
|
|
685
685
|
// src/deps.ts
|
|
686
686
|
function readingAsWritten(db) {
|
|
687
|
+
const batch = db.aggregateBatch;
|
|
687
688
|
return {
|
|
688
689
|
query: async (query) => resultAsWritten(await db.query(query)),
|
|
689
690
|
transact: (ops, opts) => db.transact(ops, opts),
|
|
690
|
-
aggregate: (ns, spec, queryOpts) => db.aggregate(ns, spec, queryOpts)
|
|
691
|
+
aggregate: (ns, spec, queryOpts) => db.aggregate(ns, spec, queryOpts),
|
|
692
|
+
...batch ? {
|
|
693
|
+
aggregateBatch: (requests) => batch.call(db, requests)
|
|
694
|
+
} : {}
|
|
691
695
|
};
|
|
692
696
|
}
|
|
693
697
|
function resolveDeps(deps) {
|
|
@@ -1748,13 +1752,29 @@ async function typeSummary(deps, type) {
|
|
|
1748
1752
|
where: { and: [{ type }, { archived: false }, ...extra] }
|
|
1749
1753
|
});
|
|
1750
1754
|
const stageIds = (def.pipeline?.stages ?? []).map((s) => s.id);
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1755
|
+
const requests = [
|
|
1756
|
+
{ ns: CRM_NS.record, aggregate: { count: true }, opts: live([]) },
|
|
1757
|
+
{
|
|
1758
|
+
ns: CRM_NS.activity,
|
|
1759
|
+
aggregate: { count: true },
|
|
1760
|
+
opts: {
|
|
1761
|
+
where: {
|
|
1762
|
+
and: [{ kind: "task" }, { status: { $in: ["open", "waiting"] } }]
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
},
|
|
1766
|
+
...stageIds.map((stage) => ({
|
|
1767
|
+
ns: CRM_NS.record,
|
|
1768
|
+
aggregate: { count: true },
|
|
1769
|
+
opts: live([{ stage }])
|
|
1770
|
+
}))
|
|
1771
|
+
];
|
|
1772
|
+
const batch = db.aggregateBatch;
|
|
1773
|
+
const [total, openTasks, ...stageCounts] = batch ? await batch(requests) : await Promise.all(
|
|
1774
|
+
requests.map(
|
|
1775
|
+
(request) => db.aggregate(request.ns, request.aggregate, request.opts)
|
|
1776
|
+
)
|
|
1777
|
+
);
|
|
1758
1778
|
const stages = {};
|
|
1759
1779
|
stageIds.forEach((stage, i) => {
|
|
1760
1780
|
stages[stage] = stageCounts[i]?.count ?? 0;
|