@voyantjs/crm 0.81.5 → 0.81.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-people.d.ts","sourceRoot":"","sources":["../../src/service/accounts-people.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accounts-people.d.ts","sourceRoot":"","sources":["../../src/service/accounts-people.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAIvB,KAAK,eAAe,EAIpB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAA;AAuC7B,eAAO,MAAM,qBAAqB;mBACX,kBAAkB,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAkDvC,kBAAkB,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAO/B,kBAAkB,QAAQ,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgB3C,kBAAkB,MAAM,MAAM,QAAQ,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkBvD,kBAAkB,MAAM,MAAM;;;2BAO/C,kBAAkB,cACV,cAAc,GAAG,QAAQ,YAC3B,MAAM;;;;;;;;;;;;;;4BAUZ,kBAAkB,cACV,cAAc,GAAG,QAAQ,YAC3B,MAAM,QACV,uBAAuB;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAS3D,kBAAkB,YACZ,MAAM,QACV,8BAA8B;;;;;;;;;;;;kCAwBhC,kBAAkB,MAClB,MAAM,QACJ,8BAA8B;;;;;;;;;;;;kCAuBF,kBAAkB,MAAM,MAAM;;;;;;;;;;;;+BAQjC,kBAAkB,MAAM,MAAM,WAAW,MAAM;;;;;;;+BAS/C,kBAAkB,MAAM,MAAM;;;;;;;2BAMzD,kBAAkB,YACZ,MAAM,SACT,sBAAsB;;;;;;;;;;;4BAmBzB,kBAAkB,YACZ,MAAM,QACV,2BAA2B;;;;;;;;;;;qBAwBlB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAIX,kBAAkB,QAAQ,kBAAkB;;;;;;;;sBAK5C,kBAAkB,aAAa,MAAM;;;wBAQnC,kBAAkB;wBAiClB,kBAAkB,WAAW,MAAM;;;;;;;iBAuBtC,MAAM;mBAAS,MAAM;;;;CA4B7C,CAAA"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import { identityContactPoints } from "@voyantjs/identity/schema";
|
|
1
2
|
import { identityService } from "@voyantjs/identity/service";
|
|
2
|
-
import { and, asc, desc, eq, gte, ilike, lte, or, sql } from "drizzle-orm";
|
|
3
|
+
import { and, asc, desc, eq, exists, gte, ilike, lte, or, sql } from "drizzle-orm";
|
|
3
4
|
import { communicationLog, organizationNotes, organizations, people, personNotes, personPaymentMethods, segments, } from "../schema.js";
|
|
4
5
|
import { deletePersonIdentity, hydratePeople, organizationEntityType, personBaseFields, personEntityType, syncPersonIdentity, } from "./accounts-shared.js";
|
|
5
6
|
import { paginate } from "./helpers.js";
|
|
7
|
+
function buildPersonSearchCondition(db, search) {
|
|
8
|
+
const term = `%${search}%`;
|
|
9
|
+
const digits = search.replace(/\D/g, "");
|
|
10
|
+
const contactPointConditions = [
|
|
11
|
+
ilike(identityContactPoints.value, term),
|
|
12
|
+
ilike(identityContactPoints.normalizedValue, term),
|
|
13
|
+
];
|
|
14
|
+
if (digits) {
|
|
15
|
+
const digitsTerm = `%${digits}%`;
|
|
16
|
+
contactPointConditions.push(sql `regexp_replace(${identityContactPoints.value}, '[^0-9]+', '', 'g') ILIKE ${digitsTerm}`, sql `regexp_replace(coalesce(${identityContactPoints.normalizedValue}, ''), '[^0-9]+', '', 'g') ILIKE ${digitsTerm}`);
|
|
17
|
+
}
|
|
18
|
+
return or(ilike(people.firstName, term), ilike(people.lastName, term), ilike(people.jobTitle, term), exists(db
|
|
19
|
+
.select({ one: sql `1` })
|
|
20
|
+
.from(identityContactPoints)
|
|
21
|
+
.where(and(eq(identityContactPoints.entityType, personEntityType), eq(identityContactPoints.entityId, people.id), or(eq(identityContactPoints.kind, "email"), eq(identityContactPoints.kind, "phone")), or(...contactPointConditions)))));
|
|
22
|
+
}
|
|
6
23
|
export const peopleAccountsService = {
|
|
7
24
|
async listPeople(db, query) {
|
|
8
25
|
const conditions = [];
|
|
@@ -15,8 +32,9 @@ export const peopleAccountsService = {
|
|
|
15
32
|
if (query.status)
|
|
16
33
|
conditions.push(eq(people.status, query.status));
|
|
17
34
|
if (query.search) {
|
|
18
|
-
const
|
|
19
|
-
|
|
35
|
+
const searchCondition = buildPersonSearchCondition(db, query.search);
|
|
36
|
+
if (searchCondition)
|
|
37
|
+
conditions.push(searchCondition);
|
|
20
38
|
}
|
|
21
39
|
const where = conditions.length ? and(...conditions) : undefined;
|
|
22
40
|
const sortColumns = (() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/crm",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"drizzle-orm": "^0.45.2",
|
|
40
40
|
"hono": "^4.12.10",
|
|
41
41
|
"zod": "^4.3.6",
|
|
42
|
-
"@voyantjs/action-ledger": "0.81.
|
|
43
|
-
"@voyantjs/core": "0.81.
|
|
44
|
-
"@voyantjs/db": "0.81.
|
|
45
|
-
"@voyantjs/hono": "0.81.
|
|
46
|
-
"@voyantjs/identity": "0.81.
|
|
47
|
-
"@voyantjs/utils": "0.81.
|
|
42
|
+
"@voyantjs/action-ledger": "0.81.6",
|
|
43
|
+
"@voyantjs/core": "0.81.6",
|
|
44
|
+
"@voyantjs/db": "0.81.6",
|
|
45
|
+
"@voyantjs/hono": "0.81.6",
|
|
46
|
+
"@voyantjs/identity": "0.81.6",
|
|
47
|
+
"@voyantjs/utils": "0.81.6"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^6.0.2",
|