@kanvas/openclaw-plugin 0.1.4 → 0.1.7

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.
@@ -154,7 +154,7 @@ export class CrmService {
154
154
  `;
155
155
  return this.client.query(query, {
156
156
  first: 1,
157
- where: [{ column: "ID", operator: "EQ", value: id }],
157
+ where: { column: "ID", operator: "EQ", value: id },
158
158
  });
159
159
  }
160
160
  async createLead(input) {
@@ -186,13 +186,22 @@ export class CrmService {
186
186
  async updateLead(id, input) {
187
187
  // Auto-fetch branch_id and people_id if not provided (the API requires them)
188
188
  if (!input.branch_id || !input.people_id) {
189
- const current = await this.getLeadCore(id);
189
+ const current = await this.getLead(id);
190
190
  const lead = current.data?.leads?.data?.[0];
191
- if (lead) {
192
- if (!input.branch_id)
193
- input.branch_id = lead.branch?.id;
194
- if (!input.people_id)
195
- input.people_id = lead.people?.id;
191
+ if (!lead) {
192
+ throw new Error(`Lead ${id} not found — cannot auto-fetch required fields`);
193
+ }
194
+ if (!input.branch_id) {
195
+ input.branch_id = lead.branch?.id;
196
+ if (!input.branch_id) {
197
+ throw new Error(`Lead ${id} has no branch_id — provide it explicitly`);
198
+ }
199
+ }
200
+ if (!input.people_id) {
201
+ input.people_id = lead.people?.id;
202
+ if (!input.people_id) {
203
+ throw new Error(`Lead ${id} has no people_id — provide it explicitly`);
204
+ }
196
205
  }
197
206
  }
198
207
  const mutation = `
@@ -213,24 +222,6 @@ export class CrmService {
213
222
  `;
214
223
  return this.client.query(mutation, { id, input });
215
224
  }
216
- /** Lightweight lead fetch for getting required fields (branch_id, people_id). */
217
- async getLeadCore(id) {
218
- const query = `
219
- query GetLeadCore($first: Int!, $where: QueryLeadsWhereWhereConditions) {
220
- leads(first: $first, where: $where) {
221
- data {
222
- id
223
- branch { id }
224
- people { id }
225
- }
226
- }
227
- }
228
- `;
229
- return this.client.query(query, {
230
- first: 1,
231
- where: [{ column: "ID", operator: "EQ", value: id }],
232
- });
233
- }
234
225
  async changeLeadOwner(input) {
235
226
  return this.updateLead(String(input.leadId), {
236
227
  branch_id: input.branch_id,
@@ -466,7 +457,7 @@ export class CrmService {
466
457
  }
467
458
  `, {
468
459
  first: 1,
469
- where: [{ column: "ID", operator: "EQ", value: leadId }],
460
+ where: { column: "ID", operator: "EQ", value: leadId },
470
461
  });
471
462
  return response.data?.leads?.data?.[0]?.channels?.[0]?.slug ?? null;
472
463
  }
@@ -764,11 +755,20 @@ export class CrmService {
764
755
  city
765
756
  state
766
757
  zip
767
- country
768
758
  }
769
759
  organizations { name }
770
- custom_fields { name value }
771
- tags { id name }
760
+ custom_fields(first: 50) {
761
+ data {
762
+ name
763
+ value
764
+ }
765
+ }
766
+ tags(first: 50) {
767
+ data {
768
+ id
769
+ name
770
+ }
771
+ }
772
772
  updated_at
773
773
  }
774
774
  }
@@ -48,7 +48,7 @@ export class InventoryService {
48
48
  `;
49
49
  return this.client.query(query, {
50
50
  first: 1,
51
- where: [{ column: "ID", operator: "EQ", value: id }],
51
+ where: { column: "ID", operator: "EQ", value: id },
52
52
  });
53
53
  }
54
54
  async listVariants(first = 25, where) {
@@ -51,7 +51,7 @@ export class OrdersService {
51
51
  `;
52
52
  return this.client.query(query, {
53
53
  first: 1,
54
- where: [{ column: "ID", operator: "EQ", value: id }],
54
+ where: { column: "ID", operator: "EQ", value: id },
55
55
  });
56
56
  }
57
57
  }
package/dist/index.js CHANGED
@@ -191,7 +191,7 @@ ALWAYS schedule follow-ups in Kanvas so the human team can see them — NEVER st
191
191
  - Leads live in pipelines with stages. Always check \`kanvas_list_pipelines\` to get valid stage IDs before creating leads.
192
192
  - Messages use \`message_verb\` to define their type (e.g. "comment", "note", "sms"). New verbs are auto-created.
193
193
  - The \`message\` field in social messages accepts arbitrary JSON — use it to store any structured data.
194
- - Filtering uses \`where: [{ column, operator, value }]\` format. Common operators: "EQ", "LIKE", "IN".
194
+ - Filtering uses \`where: { column, operator, value }\` format. Common operators: "EQ", "LIKE", "IN".
195
195
  - **Follow-ups and reminders MUST go in Kanvas** (events or messages), not local memory. The human team needs to see them in the dashboard.
196
196
  - When updating a lead, you don't need to provide branch_id or people_id — they are auto-fetched.
197
197
  - To add contacts to a person, call \`kanvas_list_contact_types\` first, then pass the contacts array to \`kanvas_update_people\`.
package/package.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "name": "@kanvas/openclaw-plugin",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "Connects agents to Kanvas — your company's nervous system for CRM, inventory, orders, and messaging.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/bakaphp/kanvas-openclaw-plugin"
9
9
  },
10
- "keywords": ["openclaw", "kanvas", "crm", "plugin", "ai-agent"],
10
+ "keywords": [
11
+ "openclaw",
12
+ "kanvas",
13
+ "crm",
14
+ "plugin",
15
+ "ai-agent"
16
+ ],
11
17
  "type": "module",
12
18
  "openclaw": {
13
19
  "id": "kanvas",