@rubytech/create-maxy 1.0.435 → 1.0.437
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 +17 -0
- package/dist/uninstall.js +44 -26
- package/package.json +1 -1
- package/payload/maxy/server.js +295 -84
- package/payload/platform/neo4j/schema.cypher +6 -0
- package/payload/platform/plugins/admin/mcp/dist/index.js +379 -10
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/skills/onboarding/skill.md +1 -1
- package/payload/platform/plugins/admin/skills/plugin-management/skill.md +16 -58
- package/payload/platform/plugins/anthropic/PLUGIN.md +2 -2
- package/payload/platform/plugins/contacts/mcp/dist/index.js +34 -16
- package/payload/platform/plugins/contacts/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.d.ts +2 -2
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js +34 -9
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-delete.d.ts +2 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-delete.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-delete.js +13 -7
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-delete.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-list.d.ts +2 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-list.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-list.js +1 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-list.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.d.ts +2 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.js +10 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-lookup.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-update.d.ts +1 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-update.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-update.js +8 -4
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-update.js.map +1 -1
- package/payload/platform/plugins/docs/references/contacts-guide.md +7 -5
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.d.ts +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js +30 -4
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +31 -3
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.d.ts +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +30 -2
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
|
@@ -27,15 +27,11 @@ Built-in plugins under `$PLATFORM_ROOT/plugins/`:
|
|
|
27
27
|
|
|
28
28
|
## Premium Plugins
|
|
29
29
|
|
|
30
|
-
Premium plugins are purchased separately and delivered from a staging area to the active plugin directory.
|
|
31
|
-
|
|
32
|
-
### Validation
|
|
33
|
-
|
|
34
|
-
All premium plugin operations require name validation first. Plugin names must match `[a-z0-9-]` only — reject any name containing other characters (prevents path traversal). If the staging directory (`$PLATFORM_ROOT/../premium-plugins/`) does not exist, report that premium plugins will be available after the next platform update.
|
|
30
|
+
Premium plugins are purchased separately and delivered from a staging area to the active plugin directory. Two MCP tools handle all premium plugin operations deterministically — no filesystem commands are delegated to the agent.
|
|
35
31
|
|
|
36
32
|
### Browsing available premium plugins
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
Call `premium-list`. It returns structured data for every plugin in the staging area: name, type (standalone/bundle), description, purchase status, and delivery status (per sub-plugin for bundles). Present the results using `render-component` with the `card` type.
|
|
39
35
|
|
|
40
36
|
### Plugin info before purchase
|
|
41
37
|
|
|
@@ -45,65 +41,27 @@ When the user asks about a specific premium plugin (e.g., "tell me about the tea
|
|
|
45
41
|
|
|
46
42
|
When the user states they have purchased a premium plugin, validate the plugin name, then confirm the plugin exists in the staging directory. Read `account.json` via `account-manage`, add the plugin name to the `purchasedPlugins` array (if not already present), and write back via `Edit`. Then proceed to delivery.
|
|
47
43
|
|
|
48
|
-
### Delivering a premium plugin
|
|
49
|
-
|
|
50
|
-
Delivery copies plugin files from staging to the active plugin directory. This section applies to standalone plugins (those with a `PLUGIN.md` at the top level, not a `BUNDLE.md`):
|
|
51
|
-
|
|
52
|
-
1. Validate the plugin name matches `[a-z0-9-]`.
|
|
53
|
-
2. Confirm the plugin is in `purchasedPlugins` — if not, tell the user to record the purchase first.
|
|
54
|
-
3. Check whether `$PLATFORM_ROOT/plugins/{name}/` already exists — if so, the plugin is already delivered. Skip the copy (idempotent).
|
|
55
|
-
4. Copy via Bash: `cp -r $PLATFORM_ROOT/../premium-plugins/{name} $PLATFORM_ROOT/plugins/{name}`. Check the exit code — if the copy fails, report the error and do not proceed.
|
|
56
|
-
5. Verify the delivery: confirm `$PLATFORM_ROOT/plugins/{name}/PLUGIN.md` exists and its frontmatter parses correctly. Scan subdirectories to count skills, references, and agent files.
|
|
57
|
-
6. Add the plugin name to `enabledPlugins` in `account.json` (if not already present) via read-then-Edit.
|
|
58
|
-
7. If the plugin directory contains an `agents/` subdirectory, load the specialist management skill via `plugin-read` from `admin/skills/specialist-management/skill.md` and follow the premium plugin agent activation instructions.
|
|
59
|
-
8. If the plugin's `agents/` directory also contains subdirectories with a `template.json` file, these are public agent templates — follow the template discovery instructions below.
|
|
60
|
-
9. Confirm to the user with detail: "Delivered {name} plugin ({N} skills, {N} references, {N} agents). Active from next session."
|
|
61
|
-
|
|
62
|
-
### Delivering a premium bundle
|
|
63
|
-
|
|
64
|
-
A premium bundle is a staging directory that contains `BUNDLE.md` instead of `PLUGIN.md`. The `BUNDLE.md` frontmatter includes a `plugins` array listing the sub-plugin names. Each sub-plugin lives in the bundle's `plugins/` subdirectory and is a standalone plugin with its own `PLUGIN.md`.
|
|
65
|
-
|
|
66
|
-
Purchasing a bundle records the bundle name (e.g., `"real-agency"`) in `purchasedPlugins`. Delivery copies each sub-plugin individually:
|
|
67
|
-
|
|
68
|
-
1. Read `$PLATFORM_ROOT/../premium-plugins/{bundle}/BUNDLE.md`. Parse the `plugins` array from the frontmatter. If `BUNDLE.md` is missing or the `plugins` array is empty, report the error and stop.
|
|
69
|
-
2. Confirm the bundle name is in `purchasedPlugins` — if not, tell the user to record the purchase first.
|
|
70
|
-
3. Validate each sub-plugin name in the `plugins` array matches `[a-z0-9-]` — reject any name containing other characters (prevents path traversal).
|
|
71
|
-
4. For each sub-plugin name in the `plugins` array:
|
|
72
|
-
a. Check whether `$PLATFORM_ROOT/plugins/{sub-plugin}/` already exists — if so, skip the entire sub-plugin (do not copy, do not add to enabledPlugins). This preserves the user's enable/disable state for already-delivered sub-plugins.
|
|
73
|
-
b. Validate the source exists: `$PLATFORM_ROOT/../premium-plugins/{bundle}/plugins/{sub-plugin}/` must contain a `PLUGIN.md`.
|
|
74
|
-
c. Copy via Bash: `cp -r $PLATFORM_ROOT/../premium-plugins/{bundle}/plugins/{sub-plugin} $PLATFORM_ROOT/plugins/{sub-plugin}`.
|
|
75
|
-
d. Verify the delivery: confirm `PLUGIN.md` exists and parses correctly. Count skills.
|
|
76
|
-
5. After all sub-plugins are copied and verified, add all newly delivered sub-plugin names to `enabledPlugins` in a single `account.json` Edit operation (not already-existing ones — only the ones copied in step 4c).
|
|
77
|
-
6. If the bundle's staging directory contains an `agents/` subdirectory with template subdirectories (directories containing a `template.json`), these are public agent templates — follow the template discovery instructions below.
|
|
78
|
-
7. Report the result: "Delivered {bundle} bundle ({N} sub-plugins, {total} skills). Active from next session." List each sub-plugin by name and skill count.
|
|
79
|
-
|
|
80
|
-
Cherry-pick delivery is supported. When the user requests a specific sub-plugin from a bundle (e.g., "enable real-agency-sales"), deliver only that sub-plugin — follow steps 4a-4d for just the requested name, then step 5 for that single name. The bundle name must still be in `purchasedPlugins`. To find the parent bundle for a sub-plugin name, list all staging directories with `BUNDLE.md`, parse each `plugins` array, and find the bundle that contains the requested name.
|
|
81
|
-
|
|
82
|
-
When the user says "enable {bundle-name}" (e.g., "enable real-agency") and the name matches a bundle, deliver all sub-plugins. When they say "enable {sub-plugin-name}" (e.g., "enable real-agency-sales"), deliver just that one.
|
|
83
|
-
|
|
84
|
-
### Public agent template discovery
|
|
85
|
-
|
|
86
|
-
Premium plugins and bundles can include public agent templates in their `agents/` directory. Templates are subdirectories containing a `template.json` file alongside seed `IDENTITY.md` and `SOUL.md` files. They are distinct from specialist agent `.md` files — specialist files use the `{plugin-name}--{agent-name}.md` naming convention; templates are directories.
|
|
87
|
-
|
|
88
|
-
After delivery, scan the `agents/` directory for template subdirectories:
|
|
89
|
-
- For standalone plugins: `$PLATFORM_ROOT/plugins/{name}/agents/`
|
|
90
|
-
- For bundles: `$PLATFORM_ROOT/../premium-plugins/{bundle}/agents/` (templates remain in staging — they are not copied with sub-plugins)
|
|
44
|
+
### Delivering a premium plugin
|
|
91
45
|
|
|
92
|
-
|
|
46
|
+
Call `premium-deliver` with `pluginName` set to the plugin name. The tool handles everything:
|
|
93
47
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
48
|
+
- Validates the plugin name and checks purchase status
|
|
49
|
+
- Auto-detects standalone vs bundle (BUNDLE.md vs PLUGIN.md)
|
|
50
|
+
- For bundles: copies each sub-plugin from staging to `$PLATFORM_ROOT/plugins/`
|
|
51
|
+
- For standalone plugins: copies the single plugin directory
|
|
52
|
+
- Skips already-delivered sub-plugins (idempotent)
|
|
53
|
+
- Verifies each copy (PLUGIN.md exists and parses)
|
|
54
|
+
- Updates `enabledPlugins` in account.json (only newly delivered names)
|
|
55
|
+
- Scans for public agent templates
|
|
56
|
+
- Returns a structured result with per-sub-plugin status and available templates
|
|
97
57
|
|
|
98
|
-
If
|
|
58
|
+
Report the tool's result to the user. If templates are found, present them and ask whether the user wants to create any now. For template creation, load the public agent management skill via `plugin-read` from `admin/skills/public-agent-manager/skill.md` and follow the "Create from Template" instructions, passing the template directory path from the tool's result.
|
|
99
59
|
|
|
100
|
-
|
|
101
|
-
- If the user declines: proceed with the delivery confirmation. No templates are created.
|
|
102
|
-
- If the user asks to create templates later: they can request creation at any time by asking (e.g., "create the buyer enquiry agent from real-agency templates").
|
|
60
|
+
If the delivered plugin has specialist agents (files in `agents/` with the `{plugin-name}--{agent-name}.md` naming convention, distinct from template directories), load the specialist management skill and follow the premium plugin agent activation instructions.
|
|
103
61
|
|
|
104
62
|
### On-demand template listing
|
|
105
63
|
|
|
106
|
-
|
|
64
|
+
Call `premium-deliver` for the plugin — it re-scans templates without re-copying anything (idempotent). The `templates` array in the result contains each template's display name, description, suggested slug, and directory path. `premium-list` returns purchase and delivery status but does not scan templates.
|
|
107
65
|
|
|
108
66
|
### Disabling a premium plugin or bundle
|
|
109
67
|
|
|
@@ -9,7 +9,7 @@ The public agent runs on the Anthropic API. This plugin handles obtaining, stori
|
|
|
9
9
|
|
|
10
10
|
## When to activate
|
|
11
11
|
|
|
12
|
-
- Prerequisites check detects missing
|
|
12
|
+
- Prerequisites check detects missing Anthropic API key (via `api-key-verify` tool)
|
|
13
13
|
- User asks how to connect Claude, get an Anthropic key, or set up their AI
|
|
14
14
|
- BOOTSTRAP detects no working Anthropic API connection
|
|
15
15
|
- User sees an API authentication error
|
|
@@ -24,7 +24,7 @@ The public agent runs on the Anthropic API. This plugin handles obtaining, stori
|
|
|
24
24
|
|
|
25
25
|
| Task | When to use | Skill |
|
|
26
26
|
|------|-------------|-------|
|
|
27
|
-
| Obtain API key via browser |
|
|
27
|
+
| Obtain API key via browser | `api-key-verify` returns `missing` or user wants to rotate key | `skills/get-api-key/SKILL.md` |
|
|
28
28
|
|
|
29
29
|
## References
|
|
30
30
|
|
|
@@ -15,11 +15,11 @@ const accountId = process.env.ACCOUNT_ID;
|
|
|
15
15
|
if (!accountId) {
|
|
16
16
|
throw new Error("ACCOUNT_ID environment variable is required");
|
|
17
17
|
}
|
|
18
|
-
server.tool("contact-create", "Create a new contact (schema:Person) in the graph. Deduplicates by
|
|
18
|
+
server.tool("contact-create", "Create a new contact (schema:Person) in the graph. Requires at least one of email or telephone. Deduplicates by whichever identifier is provided — returns existing contact if email or phone already exists.", {
|
|
19
19
|
givenName: z.string().describe("First name"),
|
|
20
20
|
familyName: z.string().optional().describe("Last name"),
|
|
21
|
-
email: z.string().email().describe("Email address (
|
|
22
|
-
telephone: z.string().optional().describe("Phone number"),
|
|
21
|
+
email: z.string().email().optional().describe("Email address (identifier — at least one of email or telephone required)"),
|
|
22
|
+
telephone: z.string().min(1).max(30).optional().describe("Phone number (identifier — at least one of email or telephone required)"),
|
|
23
23
|
jobTitle: z.string().optional().describe("Job title"),
|
|
24
24
|
source: z
|
|
25
25
|
.string()
|
|
@@ -36,7 +36,7 @@ server.tool("contact-create", "Create a new contact (schema:Person) in the graph
|
|
|
36
36
|
content: [
|
|
37
37
|
{
|
|
38
38
|
type: "text",
|
|
39
|
-
text: `Contact already exists with
|
|
39
|
+
text: `Contact already exists with ${result.identifier} (ID: ${result.nodeId}). No duplicate created.`,
|
|
40
40
|
},
|
|
41
41
|
],
|
|
42
42
|
};
|
|
@@ -45,7 +45,7 @@ server.tool("contact-create", "Create a new contact (schema:Person) in the graph
|
|
|
45
45
|
content: [
|
|
46
46
|
{
|
|
47
47
|
type: "text",
|
|
48
|
-
text: `Contact created: ${params.givenName}
|
|
48
|
+
text: `Contact created: ${params.givenName} ${result.identifier} (ID: ${result.nodeId}, status: ${params.status ?? "waitlist"})`,
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
};
|
|
@@ -62,13 +62,14 @@ server.tool("contact-create", "Create a new contact (schema:Person) in the graph
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
server.tool("contact-lookup", "Search for contacts by email, name, or list recent contacts. Returns schema:Person nodes.", {
|
|
65
|
+
server.tool("contact-lookup", "Search for contacts by email, telephone, name, or list recent contacts. Returns schema:Person nodes.", {
|
|
66
66
|
email: z.string().optional().describe("Exact email match"),
|
|
67
|
+
telephone: z.string().optional().describe("Exact phone number match"),
|
|
67
68
|
name: z.string().optional().describe("Partial name search (first or last name)"),
|
|
68
69
|
limit: z.number().int().optional().describe("Max results (default 10)"),
|
|
69
|
-
}, async ({ email, name, limit }) => {
|
|
70
|
+
}, async ({ email, telephone, name, limit }) => {
|
|
70
71
|
try {
|
|
71
|
-
const results = await contactLookup({ email, name, accountId, limit });
|
|
72
|
+
const results = await contactLookup({ email, telephone, name, accountId, limit });
|
|
72
73
|
if (results.length === 0) {
|
|
73
74
|
return {
|
|
74
75
|
content: [
|
|
@@ -77,7 +78,14 @@ server.tool("contact-lookup", "Search for contacts by email, name, or list recen
|
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
const formatted = results
|
|
80
|
-
.map((c) =>
|
|
81
|
+
.map((c) => {
|
|
82
|
+
const identifierPart = c.email
|
|
83
|
+
? `<${c.email}>`
|
|
84
|
+
: c.telephone
|
|
85
|
+
? `<${c.telephone}>`
|
|
86
|
+
: "";
|
|
87
|
+
return `${c.givenName}${c.familyName ? ` ${c.familyName}` : ""} ${identifierPart} — ${c.status} (from ${c.source}, ${c.createdOn})`;
|
|
88
|
+
})
|
|
81
89
|
.join("\n");
|
|
82
90
|
return {
|
|
83
91
|
content: [{ type: "text", text: formatted }],
|
|
@@ -95,16 +103,18 @@ server.tool("contact-lookup", "Search for contacts by email, name, or list recen
|
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
});
|
|
98
|
-
server.tool("contact-update", "Update properties of an existing contact. Cannot change email or accountId.", {
|
|
106
|
+
server.tool("contact-update", "Update properties of an existing contact. Identify by nodeId, email, or telephone. Cannot change email or accountId.", {
|
|
99
107
|
email: z.string().optional().describe("Find contact by email"),
|
|
108
|
+
telephone: z.string().optional().describe("Find contact by phone number"),
|
|
100
109
|
nodeId: z.string().optional().describe("Find contact by node ID"),
|
|
101
110
|
updates: z
|
|
102
111
|
.record(z.string(), z.unknown())
|
|
103
112
|
.describe("Properties to update (e.g. status, telephone, jobTitle)"),
|
|
104
|
-
}, async ({ email, nodeId, updates }) => {
|
|
113
|
+
}, async ({ email, telephone, nodeId, updates }) => {
|
|
105
114
|
try {
|
|
106
115
|
const result = await contactUpdate({
|
|
107
116
|
email,
|
|
117
|
+
telephone,
|
|
108
118
|
nodeId,
|
|
109
119
|
updates: updates,
|
|
110
120
|
accountId,
|
|
@@ -156,7 +166,14 @@ server.tool("contact-list", "List contacts with optional filters. Returns summar
|
|
|
156
166
|
}
|
|
157
167
|
const header = `${result.total} total contacts${params.status ? ` with status '${params.status}'` : ""}:\n\n`;
|
|
158
168
|
const formatted = result.contacts
|
|
159
|
-
.map((c) =>
|
|
169
|
+
.map((c) => {
|
|
170
|
+
const identifierPart = c.email
|
|
171
|
+
? `<${c.email}>`
|
|
172
|
+
: c.telephone
|
|
173
|
+
? `<${c.telephone}>`
|
|
174
|
+
: "";
|
|
175
|
+
return `${c.givenName}${c.familyName ? ` ${c.familyName}` : ""} ${identifierPart} — ${c.status} (${c.source}, ${c.createdOn})`;
|
|
176
|
+
})
|
|
160
177
|
.join("\n");
|
|
161
178
|
return {
|
|
162
179
|
content: [{ type: "text", text: header + formatted }],
|
|
@@ -174,17 +191,18 @@ server.tool("contact-list", "List contacts with optional filters. Returns summar
|
|
|
174
191
|
};
|
|
175
192
|
}
|
|
176
193
|
});
|
|
177
|
-
server.tool("contact-delete", "Permanently delete a contact (Person node) and all its relationships from the graph. Identify
|
|
194
|
+
server.tool("contact-delete", "Permanently delete a contact (Person node) and all its relationships from the graph. Identify by email, telephone, or node ID. This is irreversible.", {
|
|
178
195
|
email: z.string().optional().describe("Find contact by email"),
|
|
196
|
+
telephone: z.string().optional().describe("Find contact by phone number"),
|
|
179
197
|
nodeId: z.string().optional().describe("Find contact by node ID"),
|
|
180
|
-
}, async ({ email, nodeId }) => {
|
|
198
|
+
}, async ({ email, telephone, nodeId }) => {
|
|
181
199
|
try {
|
|
182
|
-
const result = await contactDelete({ email, nodeId, accountId });
|
|
200
|
+
const result = await contactDelete({ email, telephone, nodeId, accountId });
|
|
183
201
|
return {
|
|
184
202
|
content: [
|
|
185
203
|
{
|
|
186
204
|
type: "text",
|
|
187
|
-
text: `Contact deleted: ${result.
|
|
205
|
+
text: `Contact deleted: ${result.identifier}`,
|
|
188
206
|
},
|
|
189
207
|
],
|
|
190
208
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,OAAO,CAA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,EAAE,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface ContactCreateParams {
|
|
2
2
|
givenName: string;
|
|
3
3
|
familyName?: string;
|
|
4
|
-
email
|
|
4
|
+
email?: string;
|
|
5
5
|
telephone?: string;
|
|
6
6
|
jobTitle?: string;
|
|
7
7
|
source: string;
|
|
@@ -10,7 +10,7 @@ interface ContactCreateParams {
|
|
|
10
10
|
}
|
|
11
11
|
interface ContactCreateResult {
|
|
12
12
|
nodeId: string;
|
|
13
|
-
|
|
13
|
+
identifier: string;
|
|
14
14
|
created: boolean;
|
|
15
15
|
alreadyExists: boolean;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-create.d.ts","sourceRoot":"","sources":["../../src/tools/contact-create.ts"],"names":[],"mappings":"AAqBA,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-create.d.ts","sourceRoot":"","sources":["../../src/tools/contact-create.ts"],"names":[],"mappings":"AAqBA,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CA+F9B"}
|
|
@@ -20,14 +20,34 @@ async function computeEmbedding(text) {
|
|
|
20
20
|
}
|
|
21
21
|
export async function contactCreate(params) {
|
|
22
22
|
const { givenName, familyName, email, telephone, jobTitle, source, status = "waitlist", accountId, } = params;
|
|
23
|
+
const normalizedEmail = email?.toLowerCase().trim();
|
|
24
|
+
const normalizedPhone = telephone?.trim();
|
|
25
|
+
if (!normalizedEmail && !normalizedPhone) {
|
|
26
|
+
throw new Error("At least one of email or telephone is required");
|
|
27
|
+
}
|
|
23
28
|
const session = getSession();
|
|
24
29
|
try {
|
|
25
|
-
//
|
|
26
|
-
const
|
|
30
|
+
// Dedup: check for existing contact by whichever identifiers are provided (OR logic)
|
|
31
|
+
const dedupConditions = [];
|
|
32
|
+
const dedupParams = { accountId };
|
|
33
|
+
if (normalizedEmail) {
|
|
34
|
+
dedupConditions.push("p.email = $email");
|
|
35
|
+
dedupParams.email = normalizedEmail;
|
|
36
|
+
}
|
|
37
|
+
if (normalizedPhone) {
|
|
38
|
+
dedupConditions.push("p.telephone = $telephone");
|
|
39
|
+
dedupParams.telephone = normalizedPhone;
|
|
40
|
+
}
|
|
41
|
+
const existing = await session.run(`MATCH (p:Person {accountId: $accountId})
|
|
42
|
+
WHERE ${dedupConditions.join(" OR ")}
|
|
43
|
+
RETURN elementId(p) AS nodeId, p.email AS email, p.telephone AS telephone`, dedupParams);
|
|
27
44
|
if (existing.records.length > 0) {
|
|
45
|
+
const matchedEmail = existing.records[0].get("email");
|
|
46
|
+
const matchedPhone = existing.records[0].get("telephone");
|
|
47
|
+
const matchedIdentifier = matchedEmail ?? matchedPhone ?? "unknown";
|
|
28
48
|
return {
|
|
29
49
|
nodeId: existing.records[0].get("nodeId"),
|
|
30
|
-
|
|
50
|
+
identifier: matchedIdentifier,
|
|
31
51
|
created: false,
|
|
32
52
|
alreadyExists: true,
|
|
33
53
|
};
|
|
@@ -35,28 +55,33 @@ export async function contactCreate(params) {
|
|
|
35
55
|
// Create new Person node (schema:Person)
|
|
36
56
|
const props = {
|
|
37
57
|
givenName,
|
|
38
|
-
email: email.toLowerCase(),
|
|
39
58
|
source,
|
|
40
59
|
status,
|
|
41
60
|
accountId,
|
|
42
61
|
createdOn: new Date().toISOString(),
|
|
43
62
|
};
|
|
63
|
+
if (normalizedEmail)
|
|
64
|
+
props.email = normalizedEmail;
|
|
65
|
+
if (normalizedPhone)
|
|
66
|
+
props.telephone = normalizedPhone;
|
|
44
67
|
if (familyName)
|
|
45
68
|
props.familyName = familyName;
|
|
46
|
-
if (telephone)
|
|
47
|
-
props.telephone = telephone;
|
|
48
69
|
if (jobTitle)
|
|
49
70
|
props.jobTitle = jobTitle;
|
|
50
|
-
// Compute embedding for vector search
|
|
51
|
-
const
|
|
71
|
+
// Compute embedding for vector search — use whichever identifier is available
|
|
72
|
+
const identifierText = normalizedEmail
|
|
73
|
+
? `<${normalizedEmail}>`
|
|
74
|
+
: normalizedPhone ?? "";
|
|
75
|
+
const textForEmbedding = `Person: ${givenName}${familyName ? ` ${familyName}` : ""} ${identifierText} source: ${source} status: ${status}`;
|
|
52
76
|
const embedding = await computeEmbedding(textForEmbedding);
|
|
53
77
|
if (embedding.length > 0) {
|
|
54
78
|
props.embedding = embedding;
|
|
55
79
|
}
|
|
56
80
|
const result = await session.run(`CREATE (p:Person $props) RETURN elementId(p) AS nodeId`, { props });
|
|
81
|
+
const primaryIdentifier = normalizedEmail ?? normalizedPhone ?? "unknown";
|
|
57
82
|
return {
|
|
58
83
|
nodeId: result.records[0].get("nodeId"),
|
|
59
|
-
|
|
84
|
+
identifier: primaryIdentifier,
|
|
60
85
|
created: true,
|
|
61
86
|
alreadyExists: false,
|
|
62
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-create.js","sourceRoot":"","sources":["../../src/tools/contact-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,wBAAwB,CAAC;AACtE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,kBAAkB,CAAC;AAElE,KAAK,UAAU,gBAAgB,CAAC,IAAY;IAC1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,UAAU,YAAY,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SAC1D,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA+B,CAAC;QAC9D,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAoBD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EACJ,SAAS,EACT,UAAU,EACV,KAAK,EACL,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,GAAG,UAAU,EACnB,SAAS,GACV,GAAG,MAAM,CAAC;IAEX,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,
|
|
1
|
+
{"version":3,"file":"contact-create.js","sourceRoot":"","sources":["../../src/tools/contact-create.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
2
|
nodeId?: string;
|
|
3
3
|
email?: string;
|
|
4
|
+
telephone?: string;
|
|
4
5
|
accountId?: string;
|
|
5
6
|
}
|
|
6
7
|
interface ContactDeleteResult {
|
|
7
8
|
deleted: boolean;
|
|
8
|
-
|
|
9
|
+
identifier: string;
|
|
9
10
|
}
|
|
10
11
|
export declare function contactDelete(params: ContactDeleteParams): Promise<ContactDeleteResult>;
|
|
11
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-delete.d.ts","sourceRoot":"","sources":["../../src/tools/contact-delete.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"contact-delete.d.ts","sourceRoot":"","sources":["../../src/tools/contact-delete.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CA8C9B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getSession } from "../lib/neo4j.js";
|
|
2
2
|
export async function contactDelete(params) {
|
|
3
|
-
const { nodeId, email, accountId } = params;
|
|
4
|
-
if (!nodeId && !email) {
|
|
5
|
-
throw new Error("Either nodeId or
|
|
3
|
+
const { nodeId, email, telephone, accountId } = params;
|
|
4
|
+
if (!nodeId && !email && !telephone) {
|
|
5
|
+
throw new Error("Either nodeId, email, or telephone must be provided");
|
|
6
6
|
}
|
|
7
7
|
const session = getSession();
|
|
8
8
|
try {
|
|
@@ -12,20 +12,26 @@ export async function contactDelete(params) {
|
|
|
12
12
|
matchClause = `MATCH (p:Person) WHERE elementId(p) = $nodeId AND p.accountId = $accountId`;
|
|
13
13
|
queryParams.nodeId = nodeId;
|
|
14
14
|
}
|
|
15
|
-
else {
|
|
15
|
+
else if (email) {
|
|
16
16
|
matchClause = `MATCH (p:Person {email: $email, accountId: $accountId})`;
|
|
17
17
|
queryParams.email = email.toLowerCase();
|
|
18
18
|
}
|
|
19
|
+
else {
|
|
20
|
+
matchClause = `MATCH (p:Person {telephone: $telephone, accountId: $accountId})`;
|
|
21
|
+
queryParams.telephone = telephone.trim();
|
|
22
|
+
}
|
|
19
23
|
const result = await session.run(`${matchClause}
|
|
20
|
-
WITH p, p.email AS deletedEmail
|
|
24
|
+
WITH p, p.email AS deletedEmail, p.telephone AS deletedPhone
|
|
21
25
|
DETACH DELETE p
|
|
22
|
-
RETURN deletedEmail`, queryParams);
|
|
26
|
+
RETURN deletedEmail, deletedPhone`, queryParams);
|
|
23
27
|
if (result.records.length === 0) {
|
|
24
28
|
throw new Error("Contact not found");
|
|
25
29
|
}
|
|
30
|
+
const deletedEmail = result.records[0].get("deletedEmail");
|
|
31
|
+
const deletedPhone = result.records[0].get("deletedPhone");
|
|
26
32
|
return {
|
|
27
33
|
deleted: true,
|
|
28
|
-
|
|
34
|
+
identifier: deletedEmail ?? deletedPhone ?? "unknown",
|
|
29
35
|
};
|
|
30
36
|
}
|
|
31
37
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-delete.js","sourceRoot":"","sources":["../../src/tools/contact-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-delete.js","sourceRoot":"","sources":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CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAkB,CAAC;QAE5E,OAAO;YACL,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,YAAY,IAAI,YAAY,IAAI,SAAS;SACtD,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-list.d.ts","sourceRoot":"","sources":["../../src/tools/contact-list.ts"],"names":[],"mappings":"AAGA,UAAU,iBAAiB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-list.d.ts","sourceRoot":"","sources":["../../src/tools/contact-list.ts"],"names":[],"mappings":"AAGA,UAAU,iBAAiB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC;IAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAmExD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-list.js","sourceRoot":"","sources":["../../src/tools/contact-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-list.js","sourceRoot":"","sources":["../../src/tools/contact-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqB7C,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAyB;IAEzB,MAAM,EACJ,MAAM,EACN,MAAM,EACN,KAAK,EACL,SAAS,EACT,KAAK,GAAG,EAAE,GACX,GAAG,MAAM,CAAC;IAEX,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAChD,MAAM,WAAW,GAA4B,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAEpF,IAAI,MAAM,EAAE,CAAC;YACX,UAAU,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACtC,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,UAAU,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACtC,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACV,UAAU,CAAC,IAAI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?: string;
|
|
3
4
|
name?: string;
|
|
4
5
|
accountId?: string;
|
|
5
6
|
limit?: number;
|
|
@@ -8,7 +9,7 @@ interface ContactRecord {
|
|
|
8
9
|
nodeId: string;
|
|
9
10
|
givenName: string;
|
|
10
11
|
familyName?: string;
|
|
11
|
-
email
|
|
12
|
+
email?: string;
|
|
12
13
|
telephone?: string;
|
|
13
14
|
jobTitle?: string;
|
|
14
15
|
source: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-lookup.d.ts","sourceRoot":"","sources":["../../src/tools/contact-lookup.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-lookup.d.ts","sourceRoot":"","sources":["../../src/tools/contact-lookup.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,aAAa,EAAE,CAAC,CA+D1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import neo4j from "neo4j-driver";
|
|
2
2
|
import { getSession } from "../lib/neo4j.js";
|
|
3
3
|
export async function contactLookup(params) {
|
|
4
|
-
const { email, name, accountId, limit = 10 } = params;
|
|
4
|
+
const { email, telephone, name, accountId, limit = 10 } = params;
|
|
5
5
|
const session = getSession();
|
|
6
6
|
try {
|
|
7
7
|
let query;
|
|
@@ -15,6 +15,15 @@ export async function contactLookup(params) {
|
|
|
15
15
|
`;
|
|
16
16
|
queryParams = { email: email.toLowerCase(), accountId, limit: neo4j.int(limit) };
|
|
17
17
|
}
|
|
18
|
+
else if (telephone) {
|
|
19
|
+
query = `
|
|
20
|
+
MATCH (p:Person {accountId: $accountId})
|
|
21
|
+
WHERE p.telephone = $telephone
|
|
22
|
+
RETURN p, elementId(p) AS nodeId
|
|
23
|
+
LIMIT $limit
|
|
24
|
+
`;
|
|
25
|
+
queryParams = { telephone: telephone.trim(), accountId, limit: neo4j.int(limit) };
|
|
26
|
+
}
|
|
18
27
|
else if (name) {
|
|
19
28
|
query = `
|
|
20
29
|
MATCH (p:Person {accountId: $accountId})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-lookup.js","sourceRoot":"","sources":["../../src/tools/contact-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-lookup.js","sourceRoot":"","sources":["../../src/tools/contact-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CA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C,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC;YACrC,OAAO;gBACL,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAW;gBACtC,SAAS,EAAE,CAAC,CAAC,SAAmB;gBAChC,UAAU,EAAE,CAAC,CAAC,UAAgC;gBAC9C,KAAK,EAAE,CAAC,CAAC,KAA2B;gBACpC,SAAS,EAAE,CAAC,CAAC,SAA+B;gBAC5C,QAAQ,EAAE,CAAC,CAAC,QAA8B;gBAC1C,MAAM,EAAE,CAAC,CAAC,MAAgB;gBAC1B,MAAM,EAAE,CAAC,CAAC,MAAgB;gBAC1B,SAAS,EAAE,CAAC,CAAC,SAAmB;aACjC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-update.d.ts","sourceRoot":"","sources":["../../src/tools/contact-update.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"contact-update.d.ts","sourceRoot":"","sources":["../../src/tools/contact-update.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CA+D9B"}
|