@pulses/quickbooks-mcp 1.0.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/client.d.ts +33 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +327 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +12 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +436 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/accounts.d.ts +140 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +115 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/bills.d.ts +386 -0
- package/dist/tools/bills.d.ts.map +1 -0
- package/dist/tools/bills.js +180 -0
- package/dist/tools/bills.js.map +1 -0
- package/dist/tools/company.d.ts +20 -0
- package/dist/tools/company.d.ts.map +1 -0
- package/dist/tools/company.js +37 -0
- package/dist/tools/company.js.map +1 -0
- package/dist/tools/customers.d.ts +218 -0
- package/dist/tools/customers.d.ts.map +1 -0
- package/dist/tools/customers.js +154 -0
- package/dist/tools/customers.js.map +1 -0
- package/dist/tools/employees.d.ts +182 -0
- package/dist/tools/employees.d.ts.map +1 -0
- package/dist/tools/employees.js +138 -0
- package/dist/tools/employees.js.map +1 -0
- package/dist/tools/estimates.d.ts +200 -0
- package/dist/tools/estimates.d.ts.map +1 -0
- package/dist/tools/estimates.js +131 -0
- package/dist/tools/estimates.js.map +1 -0
- package/dist/tools/invoices.d.ts +402 -0
- package/dist/tools/invoices.d.ts.map +1 -0
- package/dist/tools/invoices.js +203 -0
- package/dist/tools/invoices.js.map +1 -0
- package/dist/tools/items.d.ts +212 -0
- package/dist/tools/items.d.ts.map +1 -0
- package/dist/tools/items.js +153 -0
- package/dist/tools/items.js.map +1 -0
- package/dist/tools/journal-entries.d.ts +198 -0
- package/dist/tools/journal-entries.d.ts.map +1 -0
- package/dist/tools/journal-entries.js +135 -0
- package/dist/tools/journal-entries.js.map +1 -0
- package/dist/tools/payments.d.ts +174 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +120 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/purchases.d.ts +240 -0
- package/dist/tools/purchases.d.ts.map +1 -0
- package/dist/tools/purchases.js +149 -0
- package/dist/tools/purchases.js.map +1 -0
- package/dist/tools/query.d.ts +26 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +27 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/reports.d.ts +178 -0
- package/dist/tools/reports.d.ts.map +1 -0
- package/dist/tools/reports.js +117 -0
- package/dist/tools/reports.js.map +1 -0
- package/dist/tools/tax.d.ts +116 -0
- package/dist/tools/tax.d.ts.map +1 -0
- package/dist/tools/tax.js +112 -0
- package/dist/tools/tax.js.map +1 -0
- package/dist/tools/time-activities.d.ts +228 -0
- package/dist/tools/time-activities.d.ts.map +1 -0
- package/dist/tools/time-activities.js +164 -0
- package/dist/tools/time-activities.js.map +1 -0
- package/dist/tools/vendors.d.ts +212 -0
- package/dist/tools/vendors.d.ts.map +1 -0
- package/dist/tools/vendors.js +152 -0
- package/dist/tools/vendors.js.map +1 -0
- package/dist/types.d.ts +295 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { QBOClient } from "../client.js";
|
|
3
|
+
declare const ListEmployeesInputSchema: z.ZodObject<{
|
|
4
|
+
where: z.ZodOptional<z.ZodString>;
|
|
5
|
+
order_by: z.ZodOptional<z.ZodString>;
|
|
6
|
+
start_position: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
9
|
+
}, "strict", z.ZodTypeAny, {
|
|
10
|
+
response_format: "json" | "markdown";
|
|
11
|
+
where?: string | undefined;
|
|
12
|
+
order_by?: string | undefined;
|
|
13
|
+
start_position?: number | undefined;
|
|
14
|
+
max_results?: number | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
response_format?: "json" | "markdown" | undefined;
|
|
17
|
+
where?: string | undefined;
|
|
18
|
+
order_by?: string | undefined;
|
|
19
|
+
start_position?: number | undefined;
|
|
20
|
+
max_results?: number | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
declare const GetEmployeeInputSchema: z.ZodObject<{
|
|
23
|
+
employee_id: z.ZodString;
|
|
24
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
25
|
+
}, "strict", z.ZodTypeAny, {
|
|
26
|
+
response_format: "json" | "markdown";
|
|
27
|
+
employee_id: string;
|
|
28
|
+
}, {
|
|
29
|
+
employee_id: string;
|
|
30
|
+
response_format?: "json" | "markdown" | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
declare const CreateEmployeeInputSchema: z.ZodObject<{
|
|
33
|
+
given_name: z.ZodString;
|
|
34
|
+
family_name: z.ZodString;
|
|
35
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
36
|
+
email: z.ZodOptional<z.ZodString>;
|
|
37
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
38
|
+
hired_date: z.ZodOptional<z.ZodString>;
|
|
39
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
40
|
+
}, "strict", z.ZodTypeAny, {
|
|
41
|
+
response_format: "json" | "markdown";
|
|
42
|
+
given_name: string;
|
|
43
|
+
family_name: string;
|
|
44
|
+
display_name?: string | undefined;
|
|
45
|
+
email?: string | undefined;
|
|
46
|
+
phone?: string | undefined;
|
|
47
|
+
hired_date?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
given_name: string;
|
|
50
|
+
family_name: string;
|
|
51
|
+
response_format?: "json" | "markdown" | undefined;
|
|
52
|
+
display_name?: string | undefined;
|
|
53
|
+
email?: string | undefined;
|
|
54
|
+
phone?: string | undefined;
|
|
55
|
+
hired_date?: string | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
declare const UpdateEmployeeInputSchema: z.ZodObject<{
|
|
58
|
+
employee_id: z.ZodString;
|
|
59
|
+
sync_token: z.ZodString;
|
|
60
|
+
given_name: z.ZodOptional<z.ZodString>;
|
|
61
|
+
family_name: z.ZodOptional<z.ZodString>;
|
|
62
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
63
|
+
email: z.ZodOptional<z.ZodString>;
|
|
64
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
65
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
67
|
+
}, "strict", z.ZodTypeAny, {
|
|
68
|
+
response_format: "json" | "markdown";
|
|
69
|
+
sync_token: string;
|
|
70
|
+
employee_id: string;
|
|
71
|
+
display_name?: string | undefined;
|
|
72
|
+
given_name?: string | undefined;
|
|
73
|
+
family_name?: string | undefined;
|
|
74
|
+
email?: string | undefined;
|
|
75
|
+
phone?: string | undefined;
|
|
76
|
+
active?: boolean | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
sync_token: string;
|
|
79
|
+
employee_id: string;
|
|
80
|
+
response_format?: "json" | "markdown" | undefined;
|
|
81
|
+
display_name?: string | undefined;
|
|
82
|
+
given_name?: string | undefined;
|
|
83
|
+
family_name?: string | undefined;
|
|
84
|
+
email?: string | undefined;
|
|
85
|
+
phone?: string | undefined;
|
|
86
|
+
active?: boolean | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
export type ListEmployeesInput = z.infer<typeof ListEmployeesInputSchema>;
|
|
89
|
+
export type GetEmployeeInput = z.infer<typeof GetEmployeeInputSchema>;
|
|
90
|
+
export type CreateEmployeeInput = z.infer<typeof CreateEmployeeInputSchema>;
|
|
91
|
+
export type UpdateEmployeeInput = z.infer<typeof UpdateEmployeeInputSchema>;
|
|
92
|
+
export declare function qbo_list_employees(client: QBOClient, input: ListEmployeesInput): Promise<string>;
|
|
93
|
+
export declare function qbo_get_employee(client: QBOClient, input: GetEmployeeInput): Promise<string>;
|
|
94
|
+
export declare function qbo_create_employee(client: QBOClient, input: CreateEmployeeInput): Promise<string>;
|
|
95
|
+
export declare function qbo_update_employee(client: QBOClient, input: UpdateEmployeeInput): Promise<string>;
|
|
96
|
+
export declare const ListEmployeesInputSchemaExport: z.ZodObject<{
|
|
97
|
+
where: z.ZodOptional<z.ZodString>;
|
|
98
|
+
order_by: z.ZodOptional<z.ZodString>;
|
|
99
|
+
start_position: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
102
|
+
}, "strict", z.ZodTypeAny, {
|
|
103
|
+
response_format: "json" | "markdown";
|
|
104
|
+
where?: string | undefined;
|
|
105
|
+
order_by?: string | undefined;
|
|
106
|
+
start_position?: number | undefined;
|
|
107
|
+
max_results?: number | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
response_format?: "json" | "markdown" | undefined;
|
|
110
|
+
where?: string | undefined;
|
|
111
|
+
order_by?: string | undefined;
|
|
112
|
+
start_position?: number | undefined;
|
|
113
|
+
max_results?: number | undefined;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const GetEmployeeInputSchemaExport: z.ZodObject<{
|
|
116
|
+
employee_id: z.ZodString;
|
|
117
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
118
|
+
}, "strict", z.ZodTypeAny, {
|
|
119
|
+
response_format: "json" | "markdown";
|
|
120
|
+
employee_id: string;
|
|
121
|
+
}, {
|
|
122
|
+
employee_id: string;
|
|
123
|
+
response_format?: "json" | "markdown" | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
export declare const CreateEmployeeInputSchemaExport: z.ZodObject<{
|
|
126
|
+
given_name: z.ZodString;
|
|
127
|
+
family_name: z.ZodString;
|
|
128
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
129
|
+
email: z.ZodOptional<z.ZodString>;
|
|
130
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
131
|
+
hired_date: z.ZodOptional<z.ZodString>;
|
|
132
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
133
|
+
}, "strict", z.ZodTypeAny, {
|
|
134
|
+
response_format: "json" | "markdown";
|
|
135
|
+
given_name: string;
|
|
136
|
+
family_name: string;
|
|
137
|
+
display_name?: string | undefined;
|
|
138
|
+
email?: string | undefined;
|
|
139
|
+
phone?: string | undefined;
|
|
140
|
+
hired_date?: string | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
given_name: string;
|
|
143
|
+
family_name: string;
|
|
144
|
+
response_format?: "json" | "markdown" | undefined;
|
|
145
|
+
display_name?: string | undefined;
|
|
146
|
+
email?: string | undefined;
|
|
147
|
+
phone?: string | undefined;
|
|
148
|
+
hired_date?: string | undefined;
|
|
149
|
+
}>;
|
|
150
|
+
export declare const UpdateEmployeeInputSchemaExport: z.ZodObject<{
|
|
151
|
+
employee_id: z.ZodString;
|
|
152
|
+
sync_token: z.ZodString;
|
|
153
|
+
given_name: z.ZodOptional<z.ZodString>;
|
|
154
|
+
family_name: z.ZodOptional<z.ZodString>;
|
|
155
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
156
|
+
email: z.ZodOptional<z.ZodString>;
|
|
157
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
158
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
160
|
+
}, "strict", z.ZodTypeAny, {
|
|
161
|
+
response_format: "json" | "markdown";
|
|
162
|
+
sync_token: string;
|
|
163
|
+
employee_id: string;
|
|
164
|
+
display_name?: string | undefined;
|
|
165
|
+
given_name?: string | undefined;
|
|
166
|
+
family_name?: string | undefined;
|
|
167
|
+
email?: string | undefined;
|
|
168
|
+
phone?: string | undefined;
|
|
169
|
+
active?: boolean | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
sync_token: string;
|
|
172
|
+
employee_id: string;
|
|
173
|
+
response_format?: "json" | "markdown" | undefined;
|
|
174
|
+
display_name?: string | undefined;
|
|
175
|
+
given_name?: string | undefined;
|
|
176
|
+
family_name?: string | undefined;
|
|
177
|
+
email?: string | undefined;
|
|
178
|
+
phone?: string | undefined;
|
|
179
|
+
active?: boolean | undefined;
|
|
180
|
+
}>;
|
|
181
|
+
export {};
|
|
182
|
+
//# sourceMappingURL=employees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employees.d.ts","sourceRoot":"","sources":["../../src/tools/employees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;EAMnB,CAAC;AAEZ,QAAA,MAAM,sBAAsB;;;;;;;;;EAGjB,CAAC;AAEZ,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAQpB,CAAC;AAEZ,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC;AAEZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAiB5E,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;EAA2B,CAAC;AACvE,eAAO,MAAM,4BAA4B;;;;;;;;;EAAyB,CAAC;AACnE,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AACzE,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const ListEmployeesInputSchema = z.object({
|
|
3
|
+
where: z.string().optional(),
|
|
4
|
+
order_by: z.string().optional(),
|
|
5
|
+
start_position: z.number().optional(),
|
|
6
|
+
max_results: z.number().optional(),
|
|
7
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
8
|
+
}).strict();
|
|
9
|
+
const GetEmployeeInputSchema = z.object({
|
|
10
|
+
employee_id: z.string().describe("The employee ID"),
|
|
11
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
12
|
+
}).strict();
|
|
13
|
+
const CreateEmployeeInputSchema = z.object({
|
|
14
|
+
given_name: z.string().describe("First name"),
|
|
15
|
+
family_name: z.string().describe("Last name"),
|
|
16
|
+
display_name: z.string().optional(),
|
|
17
|
+
email: z.string().optional(),
|
|
18
|
+
phone: z.string().optional(),
|
|
19
|
+
hired_date: z.string().optional().describe("Hire date (YYYY-MM-DD)"),
|
|
20
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
21
|
+
}).strict();
|
|
22
|
+
const UpdateEmployeeInputSchema = z.object({
|
|
23
|
+
employee_id: z.string(),
|
|
24
|
+
sync_token: z.string(),
|
|
25
|
+
given_name: z.string().optional(),
|
|
26
|
+
family_name: z.string().optional(),
|
|
27
|
+
display_name: z.string().optional(),
|
|
28
|
+
email: z.string().optional(),
|
|
29
|
+
phone: z.string().optional(),
|
|
30
|
+
active: z.boolean().optional().describe("Set to false to deactivate"),
|
|
31
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
32
|
+
}).strict();
|
|
33
|
+
function formatEmployee(e) {
|
|
34
|
+
let result = `## ${e.DisplayName || `${e.GivenName || ""} ${e.FamilyName || ""}`.trim() || "Unknown"}\n`;
|
|
35
|
+
if (e.Id)
|
|
36
|
+
result += `- **ID:** ${e.Id}\n`;
|
|
37
|
+
if (e.SyncToken)
|
|
38
|
+
result += `- **SyncToken:** ${e.SyncToken}\n`;
|
|
39
|
+
if (e.GivenName)
|
|
40
|
+
result += `- **First Name:** ${e.GivenName}\n`;
|
|
41
|
+
if (e.FamilyName)
|
|
42
|
+
result += `- **Last Name:** ${e.FamilyName}\n`;
|
|
43
|
+
if (e.PrimaryEmailAddr?.Address)
|
|
44
|
+
result += `- **Email:** ${e.PrimaryEmailAddr.Address}\n`;
|
|
45
|
+
if (e.PrimaryPhone?.FreeFormNumber)
|
|
46
|
+
result += `- **Phone:** ${e.PrimaryPhone.FreeFormNumber}\n`;
|
|
47
|
+
if (e.Active !== undefined)
|
|
48
|
+
result += `- **Active:** ${e.Active}\n`;
|
|
49
|
+
if (e.HiredDate)
|
|
50
|
+
result += `- **Hired:** ${e.HiredDate}\n`;
|
|
51
|
+
if (e.ReleasedDate)
|
|
52
|
+
result += `- **Released:** ${e.ReleasedDate}\n`;
|
|
53
|
+
if (e.MetaData?.CreateTime)
|
|
54
|
+
result += `- **Created:** ${e.MetaData.CreateTime}\n`;
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
export async function qbo_list_employees(client, input) {
|
|
58
|
+
let query = "SELECT * FROM Employee";
|
|
59
|
+
if (input.where)
|
|
60
|
+
query += ` WHERE ${input.where}`;
|
|
61
|
+
if (input.order_by)
|
|
62
|
+
query += ` ORDER BY ${input.order_by}`;
|
|
63
|
+
query += ` STARTPOSITION ${input.start_position || 1}`;
|
|
64
|
+
query += ` MAXRESULTS ${input.max_results || 100}`;
|
|
65
|
+
const response = await client.query(query);
|
|
66
|
+
const employees = response.QueryResponse.Employee || [];
|
|
67
|
+
if (input.response_format === "json") {
|
|
68
|
+
return JSON.stringify({ employees, total: response.QueryResponse.totalCount }, null, 2);
|
|
69
|
+
}
|
|
70
|
+
let result = `# Employees (${employees.length} results)\n\n`;
|
|
71
|
+
if (employees.length === 0) {
|
|
72
|
+
result += "No employees found.";
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
for (const e of employees) {
|
|
76
|
+
result += formatEmployee(e) + "\n";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
export async function qbo_get_employee(client, input) {
|
|
82
|
+
const response = await client.get(`/employee/${input.employee_id}`);
|
|
83
|
+
const e = response.Employee;
|
|
84
|
+
if (input.response_format === "json") {
|
|
85
|
+
return JSON.stringify(e, null, 2);
|
|
86
|
+
}
|
|
87
|
+
return `# Employee\n\n` + formatEmployee(e);
|
|
88
|
+
}
|
|
89
|
+
export async function qbo_create_employee(client, input) {
|
|
90
|
+
const body = {
|
|
91
|
+
GivenName: input.given_name,
|
|
92
|
+
FamilyName: input.family_name,
|
|
93
|
+
};
|
|
94
|
+
if (input.display_name)
|
|
95
|
+
body.DisplayName = input.display_name;
|
|
96
|
+
if (input.email)
|
|
97
|
+
body.PrimaryEmailAddr = { Address: input.email };
|
|
98
|
+
if (input.phone)
|
|
99
|
+
body.PrimaryPhone = { FreeFormNumber: input.phone };
|
|
100
|
+
if (input.hired_date)
|
|
101
|
+
body.HiredDate = input.hired_date;
|
|
102
|
+
const response = await client.post("/employee", body);
|
|
103
|
+
const e = response.Employee;
|
|
104
|
+
if (input.response_format === "json") {
|
|
105
|
+
return JSON.stringify(e, null, 2);
|
|
106
|
+
}
|
|
107
|
+
return `# Employee Created\n\n` + formatEmployee(e);
|
|
108
|
+
}
|
|
109
|
+
export async function qbo_update_employee(client, input) {
|
|
110
|
+
const body = {
|
|
111
|
+
Id: input.employee_id,
|
|
112
|
+
SyncToken: input.sync_token,
|
|
113
|
+
sparse: true,
|
|
114
|
+
};
|
|
115
|
+
if (input.given_name)
|
|
116
|
+
body.GivenName = input.given_name;
|
|
117
|
+
if (input.family_name)
|
|
118
|
+
body.FamilyName = input.family_name;
|
|
119
|
+
if (input.display_name)
|
|
120
|
+
body.DisplayName = input.display_name;
|
|
121
|
+
if (input.email)
|
|
122
|
+
body.PrimaryEmailAddr = { Address: input.email };
|
|
123
|
+
if (input.phone)
|
|
124
|
+
body.PrimaryPhone = { FreeFormNumber: input.phone };
|
|
125
|
+
if (input.active !== undefined)
|
|
126
|
+
body.Active = input.active;
|
|
127
|
+
const response = await client.post("/employee", body);
|
|
128
|
+
const e = response.Employee;
|
|
129
|
+
if (input.response_format === "json") {
|
|
130
|
+
return JSON.stringify(e, null, 2);
|
|
131
|
+
}
|
|
132
|
+
return `# Employee Updated\n\n` + formatEmployee(e);
|
|
133
|
+
}
|
|
134
|
+
export const ListEmployeesInputSchemaExport = ListEmployeesInputSchema;
|
|
135
|
+
export const GetEmployeeInputSchemaExport = GetEmployeeInputSchema;
|
|
136
|
+
export const CreateEmployeeInputSchemaExport = CreateEmployeeInputSchema;
|
|
137
|
+
export const UpdateEmployeeInputSchemaExport = UpdateEmployeeInputSchema;
|
|
138
|
+
//# sourceMappingURL=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AAI,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC;IAC3D,IAAI,KAAK,CAAC,YAAY;QAAE,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC;IAC9D,IAAI,KAAK,CAAC,KAAK;QAAE,IAAI,CAAC,gBAAgB,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAClE,IAAI,KAAK,CAAC,KAAK;QAAE,IAAI,CAAC,YAAY,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACrE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAE3D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAyB,WAAW,EAAE,IAAI,CAAC,CAAC;IAC9E,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAE5B,IAAI,KAAK,CAAC,eAAe,KAAK,MAAM,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,wBAAwB,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,wBAAwB,CAAC;AACvE,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AACnE,MAAM,CAAC,MAAM,+BAA+B,GAAG,yBAAyB,CAAC;AACzE,MAAM,CAAC,MAAM,+BAA+B,GAAG,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { QBOClient } from "../client.js";
|
|
3
|
+
declare const ListEstimatesInputSchema: z.ZodObject<{
|
|
4
|
+
where: z.ZodOptional<z.ZodString>;
|
|
5
|
+
order_by: z.ZodOptional<z.ZodString>;
|
|
6
|
+
start_position: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
9
|
+
}, "strict", z.ZodTypeAny, {
|
|
10
|
+
response_format: "json" | "markdown";
|
|
11
|
+
where?: string | undefined;
|
|
12
|
+
order_by?: string | undefined;
|
|
13
|
+
start_position?: number | undefined;
|
|
14
|
+
max_results?: number | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
response_format?: "json" | "markdown" | undefined;
|
|
17
|
+
where?: string | undefined;
|
|
18
|
+
order_by?: string | undefined;
|
|
19
|
+
start_position?: number | undefined;
|
|
20
|
+
max_results?: number | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
declare const GetEstimateInputSchema: z.ZodObject<{
|
|
23
|
+
estimate_id: z.ZodString;
|
|
24
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
25
|
+
}, "strict", z.ZodTypeAny, {
|
|
26
|
+
response_format: "json" | "markdown";
|
|
27
|
+
estimate_id: string;
|
|
28
|
+
}, {
|
|
29
|
+
estimate_id: string;
|
|
30
|
+
response_format?: "json" | "markdown" | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
declare const CreateEstimateInputSchema: z.ZodObject<{
|
|
33
|
+
customer_id: z.ZodString;
|
|
34
|
+
line_items: z.ZodArray<z.ZodObject<{
|
|
35
|
+
description: z.ZodOptional<z.ZodString>;
|
|
36
|
+
amount: z.ZodNumber;
|
|
37
|
+
item_id: z.ZodOptional<z.ZodString>;
|
|
38
|
+
qty: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
unit_price: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
amount: number;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
item_id?: string | undefined;
|
|
44
|
+
qty?: number | undefined;
|
|
45
|
+
unit_price?: number | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
amount: number;
|
|
48
|
+
description?: string | undefined;
|
|
49
|
+
item_id?: string | undefined;
|
|
50
|
+
qty?: number | undefined;
|
|
51
|
+
unit_price?: number | undefined;
|
|
52
|
+
}>, "many">;
|
|
53
|
+
txn_date: z.ZodOptional<z.ZodString>;
|
|
54
|
+
expiration_date: z.ZodOptional<z.ZodString>;
|
|
55
|
+
doc_number: z.ZodOptional<z.ZodString>;
|
|
56
|
+
bill_email: z.ZodOptional<z.ZodString>;
|
|
57
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
58
|
+
}, "strict", z.ZodTypeAny, {
|
|
59
|
+
response_format: "json" | "markdown";
|
|
60
|
+
customer_id: string;
|
|
61
|
+
line_items: {
|
|
62
|
+
amount: number;
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
item_id?: string | undefined;
|
|
65
|
+
qty?: number | undefined;
|
|
66
|
+
unit_price?: number | undefined;
|
|
67
|
+
}[];
|
|
68
|
+
txn_date?: string | undefined;
|
|
69
|
+
doc_number?: string | undefined;
|
|
70
|
+
bill_email?: string | undefined;
|
|
71
|
+
expiration_date?: string | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
customer_id: string;
|
|
74
|
+
line_items: {
|
|
75
|
+
amount: number;
|
|
76
|
+
description?: string | undefined;
|
|
77
|
+
item_id?: string | undefined;
|
|
78
|
+
qty?: number | undefined;
|
|
79
|
+
unit_price?: number | undefined;
|
|
80
|
+
}[];
|
|
81
|
+
response_format?: "json" | "markdown" | undefined;
|
|
82
|
+
txn_date?: string | undefined;
|
|
83
|
+
doc_number?: string | undefined;
|
|
84
|
+
bill_email?: string | undefined;
|
|
85
|
+
expiration_date?: string | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
declare const DeleteEstimateInputSchema: z.ZodObject<{
|
|
88
|
+
estimate_id: z.ZodString;
|
|
89
|
+
sync_token: z.ZodString;
|
|
90
|
+
}, "strict", z.ZodTypeAny, {
|
|
91
|
+
sync_token: string;
|
|
92
|
+
estimate_id: string;
|
|
93
|
+
}, {
|
|
94
|
+
sync_token: string;
|
|
95
|
+
estimate_id: string;
|
|
96
|
+
}>;
|
|
97
|
+
export type ListEstimatesInput = z.infer<typeof ListEstimatesInputSchema>;
|
|
98
|
+
export type GetEstimateInput = z.infer<typeof GetEstimateInputSchema>;
|
|
99
|
+
export type CreateEstimateInput = z.infer<typeof CreateEstimateInputSchema>;
|
|
100
|
+
export type DeleteEstimateInput = z.infer<typeof DeleteEstimateInputSchema>;
|
|
101
|
+
export declare function qbo_list_estimates(client: QBOClient, input: ListEstimatesInput): Promise<string>;
|
|
102
|
+
export declare function qbo_get_estimate(client: QBOClient, input: GetEstimateInput): Promise<string>;
|
|
103
|
+
export declare function qbo_create_estimate(client: QBOClient, input: CreateEstimateInput): Promise<string>;
|
|
104
|
+
export declare function qbo_delete_estimate(client: QBOClient, input: DeleteEstimateInput): Promise<string>;
|
|
105
|
+
export declare const ListEstimatesInputSchemaExport: z.ZodObject<{
|
|
106
|
+
where: z.ZodOptional<z.ZodString>;
|
|
107
|
+
order_by: z.ZodOptional<z.ZodString>;
|
|
108
|
+
start_position: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
111
|
+
}, "strict", z.ZodTypeAny, {
|
|
112
|
+
response_format: "json" | "markdown";
|
|
113
|
+
where?: string | undefined;
|
|
114
|
+
order_by?: string | undefined;
|
|
115
|
+
start_position?: number | undefined;
|
|
116
|
+
max_results?: number | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
response_format?: "json" | "markdown" | undefined;
|
|
119
|
+
where?: string | undefined;
|
|
120
|
+
order_by?: string | undefined;
|
|
121
|
+
start_position?: number | undefined;
|
|
122
|
+
max_results?: number | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
export declare const GetEstimateInputSchemaExport: z.ZodObject<{
|
|
125
|
+
estimate_id: z.ZodString;
|
|
126
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
127
|
+
}, "strict", z.ZodTypeAny, {
|
|
128
|
+
response_format: "json" | "markdown";
|
|
129
|
+
estimate_id: string;
|
|
130
|
+
}, {
|
|
131
|
+
estimate_id: string;
|
|
132
|
+
response_format?: "json" | "markdown" | undefined;
|
|
133
|
+
}>;
|
|
134
|
+
export declare const CreateEstimateInputSchemaExport: z.ZodObject<{
|
|
135
|
+
customer_id: z.ZodString;
|
|
136
|
+
line_items: z.ZodArray<z.ZodObject<{
|
|
137
|
+
description: z.ZodOptional<z.ZodString>;
|
|
138
|
+
amount: z.ZodNumber;
|
|
139
|
+
item_id: z.ZodOptional<z.ZodString>;
|
|
140
|
+
qty: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
unit_price: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
amount: number;
|
|
144
|
+
description?: string | undefined;
|
|
145
|
+
item_id?: string | undefined;
|
|
146
|
+
qty?: number | undefined;
|
|
147
|
+
unit_price?: number | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
amount: number;
|
|
150
|
+
description?: string | undefined;
|
|
151
|
+
item_id?: string | undefined;
|
|
152
|
+
qty?: number | undefined;
|
|
153
|
+
unit_price?: number | undefined;
|
|
154
|
+
}>, "many">;
|
|
155
|
+
txn_date: z.ZodOptional<z.ZodString>;
|
|
156
|
+
expiration_date: z.ZodOptional<z.ZodString>;
|
|
157
|
+
doc_number: z.ZodOptional<z.ZodString>;
|
|
158
|
+
bill_email: z.ZodOptional<z.ZodString>;
|
|
159
|
+
response_format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
|
|
160
|
+
}, "strict", z.ZodTypeAny, {
|
|
161
|
+
response_format: "json" | "markdown";
|
|
162
|
+
customer_id: string;
|
|
163
|
+
line_items: {
|
|
164
|
+
amount: number;
|
|
165
|
+
description?: string | undefined;
|
|
166
|
+
item_id?: string | undefined;
|
|
167
|
+
qty?: number | undefined;
|
|
168
|
+
unit_price?: number | undefined;
|
|
169
|
+
}[];
|
|
170
|
+
txn_date?: string | undefined;
|
|
171
|
+
doc_number?: string | undefined;
|
|
172
|
+
bill_email?: string | undefined;
|
|
173
|
+
expiration_date?: string | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
customer_id: string;
|
|
176
|
+
line_items: {
|
|
177
|
+
amount: number;
|
|
178
|
+
description?: string | undefined;
|
|
179
|
+
item_id?: string | undefined;
|
|
180
|
+
qty?: number | undefined;
|
|
181
|
+
unit_price?: number | undefined;
|
|
182
|
+
}[];
|
|
183
|
+
response_format?: "json" | "markdown" | undefined;
|
|
184
|
+
txn_date?: string | undefined;
|
|
185
|
+
doc_number?: string | undefined;
|
|
186
|
+
bill_email?: string | undefined;
|
|
187
|
+
expiration_date?: string | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
export declare const DeleteEstimateInputSchemaExport: z.ZodObject<{
|
|
190
|
+
estimate_id: z.ZodString;
|
|
191
|
+
sync_token: z.ZodString;
|
|
192
|
+
}, "strict", z.ZodTypeAny, {
|
|
193
|
+
sync_token: string;
|
|
194
|
+
estimate_id: string;
|
|
195
|
+
}, {
|
|
196
|
+
sync_token: string;
|
|
197
|
+
estimate_id: string;
|
|
198
|
+
}>;
|
|
199
|
+
export {};
|
|
200
|
+
//# sourceMappingURL=estimates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimates.d.ts","sourceRoot":"","sources":["../../src/tools/estimates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAWzC,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;EAMnB,CAAC;AAEZ,QAAA,MAAM,sBAAsB;;;;;;;;;EAGjB,CAAC;AAEZ,QAAA,MAAM,yBAAyB;;;;;;;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ineSchema = z.object({
|
|
3
|
+
description: z.string().optional(),
|
|
4
|
+
amount: z.number(),
|
|
5
|
+
item_id: z.string().optional(),
|
|
6
|
+
qty: z.number().optional(),
|
|
7
|
+
unit_price: z.number().optional(),
|
|
8
|
+
});
|
|
9
|
+
const ListEstimatesInputSchema = z.object({
|
|
10
|
+
where: z.string().optional(),
|
|
11
|
+
order_by: z.string().optional(),
|
|
12
|
+
start_position: z.number().optional(),
|
|
13
|
+
max_results: z.number().optional(),
|
|
14
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
15
|
+
}).strict();
|
|
16
|
+
const GetEstimateInputSchema = z.object({
|
|
17
|
+
estimate_id: z.string().describe("The estimate ID"),
|
|
18
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
19
|
+
}).strict();
|
|
20
|
+
const CreateEstimateInputSchema = z.object({
|
|
21
|
+
customer_id: z.string().describe("Customer reference ID"),
|
|
22
|
+
line_items: z.array(EstimateLineSchema).min(1),
|
|
23
|
+
txn_date: z.string().optional().describe("Transaction date (YYYY-MM-DD)"),
|
|
24
|
+
expiration_date: z.string().optional().describe("Expiration date (YYYY-MM-DD)"),
|
|
25
|
+
doc_number: z.string().optional(),
|
|
26
|
+
bill_email: z.string().optional(),
|
|
27
|
+
response_format: z.enum(["json", "markdown"]).default("markdown"),
|
|
28
|
+
}).strict();
|
|
29
|
+
const DeleteEstimateInputSchema = z.object({
|
|
30
|
+
estimate_id: z.string(),
|
|
31
|
+
sync_token: z.string(),
|
|
32
|
+
}).strict();
|
|
33
|
+
function formatEstimate(e) {
|
|
34
|
+
let result = `## Estimate ${e.DocNumber || e.Id || ""}\n`;
|
|
35
|
+
if (e.Id)
|
|
36
|
+
result += `- **ID:** ${e.Id}\n`;
|
|
37
|
+
if (e.SyncToken)
|
|
38
|
+
result += `- **SyncToken:** ${e.SyncToken}\n`;
|
|
39
|
+
if (e.CustomerRef)
|
|
40
|
+
result += `- **Customer:** ${e.CustomerRef.name || e.CustomerRef.value}\n`;
|
|
41
|
+
if (e.TxnDate)
|
|
42
|
+
result += `- **Date:** ${e.TxnDate}\n`;
|
|
43
|
+
if (e.ExpirationDate)
|
|
44
|
+
result += `- **Expires:** ${e.ExpirationDate}\n`;
|
|
45
|
+
if (e.TotalAmt !== undefined)
|
|
46
|
+
result += `- **Total:** $${e.TotalAmt}\n`;
|
|
47
|
+
if (e.TxnStatus)
|
|
48
|
+
result += `- **Status:** ${e.TxnStatus}\n`;
|
|
49
|
+
if (e.EmailStatus)
|
|
50
|
+
result += `- **Email Status:** ${e.EmailStatus}\n`;
|
|
51
|
+
if (e.MetaData?.CreateTime)
|
|
52
|
+
result += `- **Created:** ${e.MetaData.CreateTime}\n`;
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
export async function qbo_list_estimates(client, input) {
|
|
56
|
+
let query = "SELECT * FROM Estimate";
|
|
57
|
+
if (input.where)
|
|
58
|
+
query += ` WHERE ${input.where}`;
|
|
59
|
+
if (input.order_by)
|
|
60
|
+
query += ` ORDER BY ${input.order_by}`;
|
|
61
|
+
query += ` STARTPOSITION ${input.start_position || 1}`;
|
|
62
|
+
query += ` MAXRESULTS ${input.max_results || 100}`;
|
|
63
|
+
const response = await client.query(query);
|
|
64
|
+
const estimates = response.QueryResponse.Estimate || [];
|
|
65
|
+
if (input.response_format === "json") {
|
|
66
|
+
return JSON.stringify({ estimates, total: response.QueryResponse.totalCount }, null, 2);
|
|
67
|
+
}
|
|
68
|
+
let result = `# Estimates (${estimates.length} results)\n\n`;
|
|
69
|
+
if (estimates.length === 0) {
|
|
70
|
+
result += "No estimates found.";
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
for (const e of estimates) {
|
|
74
|
+
result += formatEstimate(e) + "\n";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
export async function qbo_get_estimate(client, input) {
|
|
80
|
+
const response = await client.get(`/estimate/${input.estimate_id}`);
|
|
81
|
+
const e = response.Estimate;
|
|
82
|
+
if (input.response_format === "json") {
|
|
83
|
+
return JSON.stringify(e, null, 2);
|
|
84
|
+
}
|
|
85
|
+
return `# Estimate\n\n` + formatEstimate(e);
|
|
86
|
+
}
|
|
87
|
+
export async function qbo_create_estimate(client, input) {
|
|
88
|
+
const body = {
|
|
89
|
+
CustomerRef: { value: input.customer_id },
|
|
90
|
+
Line: input.line_items.map(item => {
|
|
91
|
+
const line = {
|
|
92
|
+
Amount: item.amount,
|
|
93
|
+
DetailType: "SalesItemLineDetail",
|
|
94
|
+
};
|
|
95
|
+
if (item.description)
|
|
96
|
+
line.Description = item.description;
|
|
97
|
+
const detail = {};
|
|
98
|
+
if (item.item_id)
|
|
99
|
+
detail.ItemRef = { value: item.item_id };
|
|
100
|
+
if (item.qty !== undefined)
|
|
101
|
+
detail.Qty = item.qty;
|
|
102
|
+
if (item.unit_price !== undefined)
|
|
103
|
+
detail.UnitPrice = item.unit_price;
|
|
104
|
+
line.SalesItemLineDetail = detail;
|
|
105
|
+
return line;
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
if (input.txn_date)
|
|
109
|
+
body.TxnDate = input.txn_date;
|
|
110
|
+
if (input.expiration_date)
|
|
111
|
+
body.ExpirationDate = input.expiration_date;
|
|
112
|
+
if (input.doc_number)
|
|
113
|
+
body.DocNumber = input.doc_number;
|
|
114
|
+
if (input.bill_email)
|
|
115
|
+
body.BillEmail = { Address: input.bill_email };
|
|
116
|
+
const response = await client.post("/estimate", body);
|
|
117
|
+
const e = response.Estimate;
|
|
118
|
+
if (input.response_format === "json") {
|
|
119
|
+
return JSON.stringify(e, null, 2);
|
|
120
|
+
}
|
|
121
|
+
return `# Estimate Created\n\n` + formatEstimate(e);
|
|
122
|
+
}
|
|
123
|
+
export async function qbo_delete_estimate(client, input) {
|
|
124
|
+
await client.delete("estimate", input.estimate_id, input.sync_token);
|
|
125
|
+
return `Estimate ${input.estimate_id} deleted successfully.`;
|
|
126
|
+
}
|
|
127
|
+
export const ListEstimatesInputSchemaExport = ListEstimatesInputSchema;
|
|
128
|
+
export const GetEstimateInputSchemaExport = GetEstimateInputSchema;
|
|
129
|
+
export const CreateEstimateInputSchemaExport = CreateEstimateInputSchema;
|
|
130
|
+
export const DeleteEstimateInputSchemaExport = DeleteEstimateInputSchema;
|
|
131
|
+
//# sourceMappingURL=estimates.js.map
|