@classytic/crm 1.1.1 → 1.2.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.
package/dist/index.js CHANGED
@@ -637,8 +637,9 @@ function buildLeadSchema(config) {
637
637
  [config.tenant.tenantField]: 1,
638
638
  email: 1
639
639
  }, {
640
+ name: "lead_email_unique_str",
640
641
  unique: true,
641
- partialFilterExpression: { email: { $type: "string" } }
642
+ partialFilterExpression: { email: { $gte: "" } }
642
643
  });
643
644
  schema.index({
644
645
  [config.tenant.tenantField]: 1,
@@ -921,8 +922,9 @@ function buildContactSchema(config) {
921
922
  [config.tenant.tenantField]: 1,
922
923
  "contact.email": 1
923
924
  }, {
925
+ name: "contact_email_unique_str",
924
926
  unique: true,
925
- partialFilterExpression: { "contact.email": { $type: "string" } }
927
+ partialFilterExpression: { "contact.email": { $gte: "" } }
926
928
  });
927
929
  schema.index({
928
930
  [config.tenant.tenantField]: 1,
@@ -1943,8 +1945,9 @@ function buildMessageSchema(config) {
1943
1945
  [config.tenant.tenantField]: 1,
1944
1946
  externalMessageId: 1
1945
1947
  }, {
1948
+ name: "message_external_id_unique_str",
1946
1949
  unique: true,
1947
- partialFilterExpression: { externalMessageId: { $type: "string" } }
1950
+ partialFilterExpression: { externalMessageId: { $gte: "" } }
1948
1951
  });
1949
1952
  schema.index({ sentAt: 1 }, {
1950
1953
  expireAfterSeconds: 31536e3,
@@ -4984,7 +4987,16 @@ var LeadService = class LeadService {
4984
4987
  contact: contactInfo,
4985
4988
  ...lead.jobTitle !== void 0 ? { jobTitle: lead.jobTitle } : {},
4986
4989
  ...account !== void 0 ? { accountId: String(account._id) } : {},
4987
- ...lead.ownerId !== void 0 ? { ownerId: lead.ownerId } : {}
4990
+ ...lead.ownerId !== void 0 ? { ownerId: lead.ownerId } : {},
4991
+ /**
4992
+ * Carry the lead's `metadata` onto the contact. Integration links live
4993
+ * there — a lead captured against a known customer records the id at
4994
+ * capture time — and conversion is where that association is USED, so
4995
+ * dropping it here severs the link at the one moment the contact comes
4996
+ * into existence. A downstream projection keyed on such a link then
4997
+ * finds nothing, for every converted lead, silently.
4998
+ */
4999
+ ...lead.metadata !== void 0 ? { metadata: lead.metadata } : {}
4988
5000
  }, ctx);
4989
5001
  const opportunityName = input.opportunityName ?? `${lead.companyName ?? lead.fullName} — ${lead.source ?? "New"}`;
4990
5002
  opportunity = await this.opportunities.openOpportunity({
package/package.json CHANGED
@@ -1,79 +1,82 @@
1
- {
2
- "name": "@classytic/crm",
3
- "version": "1.1.1",
4
- "description": "Engine-factory CRM package — leads, accounts, contacts, opportunities, pipelines, campaigns, subscriptions, activities, notes, email engagement. PACKAGE_RULES compliant; built on Mongoose + mongokit + arc primitives.",
5
- "author": "Classytic",
6
- "license": "SEE LICENSE IN LICENSE",
7
- "type": "module",
8
- "sideEffects": false,
9
- "engines": {
10
- "node": ">=22"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "default": "./dist/index.js"
19
- },
20
- "./events": {
21
- "types": "./dist/events.d.ts",
22
- "default": "./dist/events.js"
23
- },
24
- "./package.json": "./package.json"
25
- },
26
- "main": "./dist/index.js",
27
- "types": "./dist/index.d.ts",
28
- "files": [
29
- "dist",
30
- "scripts",
31
- "README.md",
32
- "CHANGELOG.md",
33
- "LICENSE"
34
- ],
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/classytic/crm.git"
38
- },
39
- "bugs": {
40
- "url": "https://github.com/classytic/crm/issues"
41
- },
42
- "homepage": "https://github.com/classytic/crm#readme",
43
- "scripts": {
44
- "build": "tsdown",
45
- "typecheck": "tsc --noEmit",
46
- "test": "vitest run --project unit --project integration",
47
- "test:unit": "vitest run --project unit",
48
- "test:integration": "vitest run --project integration",
49
- "test:e2e": "vitest run --project e2e",
50
- "test:all": "vitest run",
51
- "test:watch": "vitest --project unit --project integration",
52
- "drift:suppression": "node scripts/suppression-key-drift.mjs",
53
- "drift:email-keys": "node scripts/lead-contact-email-key-drift.mjs",
54
- "push": "classytic-push"
55
- },
56
- "peerDependencies": {
57
- "@classytic/contact": ">=0.1.0",
58
- "@classytic/mongokit": ">=3.33.0",
59
- "@classytic/primitives": ">=0.23.0",
60
- "@classytic/repo-core": ">=0.24.0",
61
- "mongoose": ">=9.4.1",
62
- "zod": ">=4.0.0"
63
- },
64
- "devDependencies": {
65
- "@classytic/contact": ">=0.1.0",
66
- "@classytic/dev-tools": "^0.2.0",
67
- "@classytic/mongokit": "^3.33.0",
68
- "@classytic/primitives": ">=0.23.0",
69
- "@classytic/repo-core": ">=0.24.0",
70
- "@types/node": "^25.5.0",
71
- "mongodb-memory-server": "^10.1.4",
72
- "mongoose": "^9.4.1",
73
- "publint": "^0.3.23",
74
- "tsdown": "^0.22.14",
75
- "typescript": "^5.8.2",
76
- "vitest": "^3.2.4",
77
- "zod": "^4.3.6"
78
- }
79
- }
1
+ {
2
+ "name": "@classytic/crm",
3
+ "version": "1.2.0",
4
+ "description": "Engine-factory CRM package — leads, accounts, contacts, opportunities, pipelines, campaigns, subscriptions, activities, notes, email engagement. PACKAGE_RULES compliant; built on Mongoose + mongokit + arc primitives.",
5
+ "author": "Classytic",
6
+ "license": "SEE LICENSE IN LICENSE",
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "engines": {
10
+ "node": ">=22"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "exports": {
16
+ ".": {
17
+ "@classytic/source": "./src/index.ts",
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./events": {
22
+ "@classytic/source": "./src/events/index.ts",
23
+ "types": "./dist/events.d.ts",
24
+ "default": "./dist/events.js"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "files": [
31
+ "dist",
32
+ "scripts",
33
+ "README.md",
34
+ "CHANGELOG.md",
35
+ "LICENSE"
36
+ ],
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/classytic/crm.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/classytic/crm/issues"
43
+ },
44
+ "homepage": "https://github.com/classytic/crm#readme",
45
+ "scripts": {
46
+ "build": "tsdown",
47
+ "typecheck": "tsc --noEmit",
48
+ "test": "vitest run --project unit --project integration",
49
+ "test:unit": "vitest run --project unit",
50
+ "test:integration": "vitest run --project integration",
51
+ "test:e2e": "vitest run --project e2e",
52
+ "test:all": "vitest run",
53
+ "test:watch": "vitest --project unit --project integration",
54
+ "drift:suppression": "node scripts/suppression-key-drift.mjs",
55
+ "drift:email-keys": "node scripts/lead-contact-email-key-drift.mjs",
56
+ "push": "classytic-push",
57
+ "prepublishOnly": "npm run typecheck && npm run build && npm test"
58
+ },
59
+ "peerDependencies": {
60
+ "@classytic/contact": ">=0.1.0",
61
+ "@classytic/mongokit": ">=3.41.0",
62
+ "@classytic/primitives": ">=0.32.0",
63
+ "@classytic/repo-core": ">=0.31.0",
64
+ "mongoose": ">=9.11.0",
65
+ "zod": ">=4.0.0"
66
+ },
67
+ "devDependencies": {
68
+ "@classytic/contact": ">=0.2.0",
69
+ "@classytic/dev-tools": "^0.2.1",
70
+ "@classytic/mongokit": "^3.43.0",
71
+ "@classytic/primitives": "^0.34.0",
72
+ "@classytic/repo-core": "^0.31.1",
73
+ "@types/node": "^26.6.5",
74
+ "mongodb-memory-server": "^11.3.0",
75
+ "mongoose": "^9.11.2",
76
+ "publint": "^0.3.25",
77
+ "tsdown": "^0.23.1",
78
+ "typescript": "^7.0.2",
79
+ "vitest": "^5.0.5",
80
+ "zod": "^4.6.7"
81
+ }
82
+ }