@wirecat/cli-core 0.676.0 → 0.678.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/background/daily-archive-timer.d.ts +1 -1
  3. package/dist/background/report/render.d.ts +3 -1
  4. package/dist/background/report/render.js +2 -2
  5. package/dist/background/report/schema.d.ts +7 -4
  6. package/dist/background/report/schema.js +23 -7
  7. package/dist/background/report/templates/morning-digest.email.en.liquid +3 -2
  8. package/dist/background/report/templates/morning-digest.email.ru.liquid +3 -2
  9. package/dist/background/report/templates/morning-digest.telegram.en.liquid +3 -2
  10. package/dist/background/report/templates/morning-digest.telegram.ru.liquid +3 -2
  11. package/dist/background/report/templates/morning-digest.text.en.liquid +3 -2
  12. package/dist/background/report/templates/morning-digest.text.ru.liquid +3 -2
  13. package/dist/background/report/view.js +2 -0
  14. package/dist/background/schedules.js +21 -11
  15. package/dist/cli/command-runs.d.ts +2 -0
  16. package/dist/cli/command-runs.js +2 -0
  17. package/dist/cli/index.d.ts +1 -1
  18. package/dist/cli/index.js +1 -1
  19. package/dist/cli/list-query.d.ts +1 -1
  20. package/dist/cli/list-query.js +2 -2
  21. package/dist/cli/setup-command.js +5 -2
  22. package/dist/crm/cli/activities.d.ts +17 -0
  23. package/dist/crm/cli/activities.js +133 -0
  24. package/dist/crm/cli/changes.d.ts +23 -0
  25. package/dist/crm/cli/changes.js +255 -0
  26. package/dist/crm/cli/index.d.ts +1 -0
  27. package/dist/crm/cli/index.js +7 -4
  28. package/dist/crm/digest.d.ts +27 -0
  29. package/dist/crm/digest.js +166 -0
  30. package/dist/crm/stage-tasks.d.ts +1 -1
  31. package/dist/crm/stage-tasks.js +1 -1
  32. package/dist/crm/sync.d.ts +9 -0
  33. package/dist/crm/sync.js +27 -0
  34. package/dist/crm/testing/source.d.ts +5 -1
  35. package/dist/crm/testing/source.js +19 -0
  36. package/dist/crm/testing/sync-contract.d.ts +2 -0
  37. package/dist/crm/testing/sync-contract.js +56 -2
  38. package/dist/errors/reasons.js +1 -0
  39. package/dist/store/identity-links.d.ts +73 -0
  40. package/dist/store/identity-links.js +14 -0
  41. package/dist/store/index.d.ts +3 -1
  42. package/dist/store/index.js +2 -1
  43. package/dist/store/people.d.ts +23 -1
  44. package/dist/store/people.js +12 -1
  45. package/dist/store/sqlite/agent-links.d.ts +34 -0
  46. package/dist/store/sqlite/agent-links.js +184 -0
  47. package/dist/store/sqlite/crm-activities.d.ts +41 -1
  48. package/dist/store/sqlite/crm-activities.js +152 -14
  49. package/dist/store/sqlite/crm-changes.d.ts +84 -0
  50. package/dist/store/sqlite/crm-changes.js +199 -0
  51. package/dist/store/sqlite/crm.d.ts +2 -1
  52. package/dist/store/sqlite/crm.js +2 -0
  53. package/dist/store/sqlite/identity-proposals.d.ts +2 -0
  54. package/dist/store/sqlite/identity-proposals.js +2 -0
  55. package/dist/store/sqlite/person-match-scan.d.ts +29 -0
  56. package/dist/store/sqlite/person-match-scan.js +4 -4
  57. package/dist/store/sqlite/person-merges.d.ts +3 -0
  58. package/package.json +1 -1
@@ -47,7 +47,7 @@ export const PROPOSAL_SCORE = {
47
47
  * NEED-2600: a call's other side, kept as `phone:<number>`, is that number as the phone network gave it, as strong
48
48
  * as a messenger's; it joins only on a mobile number, since an office's landline is everyone's who works there.
49
49
  */
50
- const phonePairJoins = (phone, holders) => holders.some(({ provider }) => BARE_INTERNATIONAL_PROVIDERS.includes(provider)) ||
50
+ export const phonePairJoins = (phone, holders) => holders.some(({ provider }) => BARE_INTERNATIONAL_PROVIDERS.includes(provider)) ||
51
51
  (holders.some(({ externalId }) => externalId === `phone:${phone}`) && isMobilePhone(phone));
52
52
  /** NEED-2446, safe option until the owner rules: an address more than two people have is shared, so it proposes. */
53
53
  const addressGroupJoins = (people) => people <= 2;
@@ -60,7 +60,7 @@ const COMPANY = "EXISTS (SELECT 1 FROM organization_identities o WHERE o.identit
60
60
  * CRM's contact and its user may be one person, so they are two lists. A messenger keeps one account per number, so
61
61
  * two of its accounts on one number are a number that changed hands, not a company's line.
62
62
  */
63
- const sharedLine = (context, holders) => {
63
+ export const sharedLine = (context, holders) => {
64
64
  if (holders.some(({ company }) => company))
65
65
  return true;
66
66
  const seen = new Map();
@@ -136,7 +136,7 @@ const phonesOf = (row) => {
136
136
  catch { }
137
137
  return raws.filter((raw) => typeof raw === "string" && raw.trim() !== "");
138
138
  };
139
- const phoneHolders = (database) => {
139
+ export const phoneHolders = (database) => {
140
140
  const found = new Map();
141
141
  const countries = storePhoneCountries(database);
142
142
  for (const row of database
@@ -153,7 +153,7 @@ const addressOf = (value) => {
153
153
  return isEmailAddress(address) ? address : undefined;
154
154
  };
155
155
  /** A company's address is an `org-email` identity, never a person's, so it never joins people. */
156
- const emailHolders = (database) => {
156
+ export const emailHolders = (database) => {
157
157
  const found = new Map();
158
158
  for (const row of database
159
159
  .prepare(`SELECT i.id, i.provider, i.external_id, i.email, ${COMPANY} FROM identities i ` +
@@ -1,3 +1,4 @@
1
+ import type { AgentMerge } from "../identity-links.js";
1
2
  import type { IdentityRef, PersonRecord } from "../types.js";
2
3
  import type { StoreContext } from "./open.js";
3
4
  export interface PersonMerge {
@@ -11,6 +12,8 @@ export interface PersonMerge {
11
12
  method: string;
12
13
  by: string;
13
14
  at: string;
15
+ /** An agent's merge: which agent, in which run, why, and the evidence the store found. */
16
+ agent?: AgentMerge;
14
17
  }
15
18
  export declare const mergeId: (to: number | string, from: number | string) => string;
16
19
  /** The two uids a `merge:<to>-<from>` id names. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.676.0",
3
+ "version": "0.678.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",