@wilnertech/halopsa-mcp-server 1.0.2 → 1.1.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/.env.example +18 -18
- package/LICENSE +21 -21
- package/README.md +252 -205
- package/dist/api/client.d.ts +7 -2
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +35 -8
- package/dist/api/client.js.map +1 -1
- package/dist/cache/memory-cache.d.ts +7 -0
- package/dist/cache/memory-cache.d.ts.map +1 -1
- package/dist/cache/memory-cache.js +7 -0
- package/dist/cache/memory-cache.js.map +1 -1
- package/dist/cache/prewarm.d.ts +3 -1
- package/dist/cache/prewarm.d.ts.map +1 -1
- package/dist/cache/prewarm.js +17 -1
- package/dist/cache/prewarm.js.map +1 -1
- package/dist/schemas/common.d.ts +30 -99
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +2 -2
- package/dist/schemas/common.js.map +1 -1
- package/dist/tools/assets.d.ts +69 -297
- package/dist/tools/assets.d.ts.map +1 -1
- package/dist/tools/batch-operations.d.ts +49 -81
- package/dist/tools/batch-operations.d.ts.map +1 -1
- package/dist/tools/batch-operations.js +62 -0
- package/dist/tools/batch-operations.js.map +1 -1
- package/dist/tools/clients.d.ts +24 -92
- package/dist/tools/clients.d.ts.map +1 -1
- package/dist/tools/reference-data.d.ts +44 -72
- package/dist/tools/reference-data.d.ts.map +1 -1
- package/dist/tools/reference-data.js +27 -0
- package/dist/tools/reference-data.js.map +1 -1
- package/dist/tools/registrations.d.ts +7 -1
- package/dist/tools/registrations.d.ts.map +1 -1
- package/dist/tools/registrations.js +43 -7
- package/dist/tools/registrations.js.map +1 -1
- package/dist/tools/registry.d.ts +12 -5
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +26 -2
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/sites.d.ts +19 -111
- package/dist/tools/sites.d.ts.map +1 -1
- package/dist/tools/ticket-actions.d.ts +41 -0
- package/dist/tools/ticket-actions.d.ts.map +1 -0
- package/dist/tools/ticket-actions.js +222 -0
- package/dist/tools/ticket-actions.js.map +1 -0
- package/dist/tools/ticket-custom-fields.d.ts +33 -0
- package/dist/tools/ticket-custom-fields.d.ts.map +1 -0
- package/dist/tools/ticket-custom-fields.js +155 -0
- package/dist/tools/ticket-custom-fields.js.map +1 -0
- package/dist/tools/ticket-reference-data.d.ts +88 -0
- package/dist/tools/ticket-reference-data.d.ts.map +1 -0
- package/dist/tools/ticket-reference-data.js +185 -0
- package/dist/tools/ticket-reference-data.js.map +1 -0
- package/dist/tools/tickets.d.ts +168 -0
- package/dist/tools/tickets.d.ts.map +1 -0
- package/dist/tools/tickets.js +572 -0
- package/dist/tools/tickets.js.map +1 -0
- package/dist/tools/users.d.ts +37 -193
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/types/tickets.d.ts +193 -0
- package/dist/types/tickets.d.ts.map +1 -0
- package/dist/types/tickets.js +14 -0
- package/dist/types/tickets.js.map +1 -0
- package/dist/utils/formatter.d.ts +15 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +52 -6
- package/dist/utils/formatter.js.map +1 -1
- package/package.json +68 -61
- package/dist/utils/zod-to-schema.d.ts +0 -29
- package/dist/utils/zod-to-schema.d.ts.map +0 -1
- package/dist/utils/zod-to-schema.js +0 -182
- package/dist/utils/zod-to-schema.js.map +0 -1
package/dist/tools/users.d.ts
CHANGED
|
@@ -21,78 +21,30 @@ export declare const ListUsersArgsSchema: z.ZodObject<{
|
|
|
21
21
|
includeactive: z.ZodOptional<z.ZodBoolean>;
|
|
22
22
|
includeinactive: z.ZodOptional<z.ZodBoolean>;
|
|
23
23
|
format_options: z.ZodOptional<z.ZodObject<{
|
|
24
|
-
format: z.ZodOptional<z.ZodEnum<
|
|
25
|
-
|
|
24
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
compact: "compact";
|
|
26
|
+
standard: "standard";
|
|
27
|
+
detailed: "detailed";
|
|
28
|
+
}>>;
|
|
29
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
30
|
omit_empty: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
fields?: string[] | undefined;
|
|
30
|
-
omit_empty?: boolean | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
33
|
-
fields?: string[] | undefined;
|
|
34
|
-
omit_empty?: boolean | undefined;
|
|
35
|
-
}>>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
client_id?: number | undefined;
|
|
38
|
-
count?: number | undefined;
|
|
39
|
-
page_no?: number | undefined;
|
|
40
|
-
site_id?: number | undefined;
|
|
41
|
-
search?: string | undefined;
|
|
42
|
-
includeactive?: boolean | undefined;
|
|
43
|
-
includeinactive?: boolean | undefined;
|
|
44
|
-
format_options?: {
|
|
45
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
46
|
-
fields?: string[] | undefined;
|
|
47
|
-
omit_empty?: boolean | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}, {
|
|
50
|
-
client_id?: number | undefined;
|
|
51
|
-
count?: number | undefined;
|
|
52
|
-
page_no?: number | undefined;
|
|
53
|
-
site_id?: number | undefined;
|
|
54
|
-
search?: string | undefined;
|
|
55
|
-
includeactive?: boolean | undefined;
|
|
56
|
-
includeinactive?: boolean | undefined;
|
|
57
|
-
format_options?: {
|
|
58
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
59
|
-
fields?: string[] | undefined;
|
|
60
|
-
omit_empty?: boolean | undefined;
|
|
61
|
-
} | undefined;
|
|
62
|
-
}>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
63
33
|
/**
|
|
64
34
|
* Get single user schema
|
|
65
35
|
*/
|
|
66
36
|
export declare const GetUserArgsSchema: z.ZodObject<{
|
|
67
37
|
user_id: z.ZodNumber;
|
|
68
38
|
format_options: z.ZodOptional<z.ZodObject<{
|
|
69
|
-
format: z.ZodOptional<z.ZodEnum<
|
|
70
|
-
|
|
39
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
compact: "compact";
|
|
41
|
+
standard: "standard";
|
|
42
|
+
detailed: "detailed";
|
|
43
|
+
}>>;
|
|
44
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
45
|
omit_empty: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
fields?: string[] | undefined;
|
|
75
|
-
omit_empty?: boolean | undefined;
|
|
76
|
-
}, {
|
|
77
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
78
|
-
fields?: string[] | undefined;
|
|
79
|
-
omit_empty?: boolean | undefined;
|
|
80
|
-
}>>;
|
|
81
|
-
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
user_id: number;
|
|
83
|
-
format_options?: {
|
|
84
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
85
|
-
fields?: string[] | undefined;
|
|
86
|
-
omit_empty?: boolean | undefined;
|
|
87
|
-
} | undefined;
|
|
88
|
-
}, {
|
|
89
|
-
user_id: number;
|
|
90
|
-
format_options?: {
|
|
91
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
92
|
-
fields?: string[] | undefined;
|
|
93
|
-
omit_empty?: boolean | undefined;
|
|
94
|
-
} | undefined;
|
|
95
|
-
}>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
96
48
|
/**
|
|
97
49
|
* Search users by email schema
|
|
98
50
|
*/
|
|
@@ -100,35 +52,15 @@ export declare const SearchUsersByEmailArgsSchema: z.ZodObject<{
|
|
|
100
52
|
email: z.ZodString;
|
|
101
53
|
client_id: z.ZodOptional<z.ZodNumber>;
|
|
102
54
|
format_options: z.ZodOptional<z.ZodObject<{
|
|
103
|
-
format: z.ZodOptional<z.ZodEnum<
|
|
104
|
-
|
|
55
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
compact: "compact";
|
|
57
|
+
standard: "standard";
|
|
58
|
+
detailed: "detailed";
|
|
59
|
+
}>>;
|
|
60
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
61
|
omit_empty: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
fields?: string[] | undefined;
|
|
109
|
-
omit_empty?: boolean | undefined;
|
|
110
|
-
}, {
|
|
111
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
112
|
-
fields?: string[] | undefined;
|
|
113
|
-
omit_empty?: boolean | undefined;
|
|
114
|
-
}>>;
|
|
115
|
-
}, "strip", z.ZodTypeAny, {
|
|
116
|
-
email: string;
|
|
117
|
-
client_id?: number | undefined;
|
|
118
|
-
format_options?: {
|
|
119
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
120
|
-
fields?: string[] | undefined;
|
|
121
|
-
omit_empty?: boolean | undefined;
|
|
122
|
-
} | undefined;
|
|
123
|
-
}, {
|
|
124
|
-
email: string;
|
|
125
|
-
client_id?: number | undefined;
|
|
126
|
-
format_options?: {
|
|
127
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
128
|
-
fields?: string[] | undefined;
|
|
129
|
-
omit_empty?: boolean | undefined;
|
|
130
|
-
} | undefined;
|
|
131
|
-
}>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
132
64
|
/**
|
|
133
65
|
* Create user schema
|
|
134
66
|
*/
|
|
@@ -143,38 +75,8 @@ export declare const CreateUserArgsSchema: z.ZodObject<{
|
|
|
143
75
|
user_customfields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
144
76
|
id: z.ZodNumber;
|
|
145
77
|
value: z.ZodString;
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
id: number;
|
|
149
|
-
}, {
|
|
150
|
-
value: string;
|
|
151
|
-
id: number;
|
|
152
|
-
}>, "many">>;
|
|
153
|
-
}, "strip", z.ZodTypeAny, {
|
|
154
|
-
client_id: number;
|
|
155
|
-
name: string;
|
|
156
|
-
inactive?: boolean | undefined;
|
|
157
|
-
emailaddress?: string | undefined;
|
|
158
|
-
site_id?: number | undefined;
|
|
159
|
-
username?: string | undefined;
|
|
160
|
-
phonenumber?: string | undefined;
|
|
161
|
-
user_customfields?: {
|
|
162
|
-
value: string;
|
|
163
|
-
id: number;
|
|
164
|
-
}[] | undefined;
|
|
165
|
-
}, {
|
|
166
|
-
client_id: number;
|
|
167
|
-
name: string;
|
|
168
|
-
inactive?: boolean | undefined;
|
|
169
|
-
emailaddress?: string | undefined;
|
|
170
|
-
site_id?: number | undefined;
|
|
171
|
-
username?: string | undefined;
|
|
172
|
-
phonenumber?: string | undefined;
|
|
173
|
-
user_customfields?: {
|
|
174
|
-
value: string;
|
|
175
|
-
id: number;
|
|
176
|
-
}[] | undefined;
|
|
177
|
-
}>;
|
|
78
|
+
}, z.core.$strip>>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
178
80
|
/**
|
|
179
81
|
* Update user schema
|
|
180
82
|
*/
|
|
@@ -189,38 +91,8 @@ export declare const UpdateUserArgsSchema: z.ZodObject<{
|
|
|
189
91
|
user_customfields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
190
92
|
id: z.ZodNumber;
|
|
191
93
|
value: z.ZodString;
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
id: number;
|
|
195
|
-
}, {
|
|
196
|
-
value: string;
|
|
197
|
-
id: number;
|
|
198
|
-
}>, "many">>;
|
|
199
|
-
}, "strip", z.ZodTypeAny, {
|
|
200
|
-
user_id: number;
|
|
201
|
-
name?: string | undefined;
|
|
202
|
-
inactive?: boolean | undefined;
|
|
203
|
-
emailaddress?: string | undefined;
|
|
204
|
-
site_id?: number | undefined;
|
|
205
|
-
username?: string | undefined;
|
|
206
|
-
phonenumber?: string | undefined;
|
|
207
|
-
user_customfields?: {
|
|
208
|
-
value: string;
|
|
209
|
-
id: number;
|
|
210
|
-
}[] | undefined;
|
|
211
|
-
}, {
|
|
212
|
-
user_id: number;
|
|
213
|
-
name?: string | undefined;
|
|
214
|
-
inactive?: boolean | undefined;
|
|
215
|
-
emailaddress?: string | undefined;
|
|
216
|
-
site_id?: number | undefined;
|
|
217
|
-
username?: string | undefined;
|
|
218
|
-
phonenumber?: string | undefined;
|
|
219
|
-
user_customfields?: {
|
|
220
|
-
value: string;
|
|
221
|
-
id: number;
|
|
222
|
-
}[] | undefined;
|
|
223
|
-
}>;
|
|
94
|
+
}, z.core.$strip>>>;
|
|
95
|
+
}, z.core.$strip>;
|
|
224
96
|
/**
|
|
225
97
|
* Find user match schema (deduplication)
|
|
226
98
|
*/
|
|
@@ -229,50 +101,22 @@ export declare const FindUserMatchArgsSchema: z.ZodObject<{
|
|
|
229
101
|
upn: z.ZodOptional<z.ZodString>;
|
|
230
102
|
username: z.ZodOptional<z.ZodString>;
|
|
231
103
|
client_id: z.ZodNumber;
|
|
232
|
-
},
|
|
233
|
-
client_id: number;
|
|
234
|
-
email?: string | undefined;
|
|
235
|
-
username?: string | undefined;
|
|
236
|
-
upn?: string | undefined;
|
|
237
|
-
}, {
|
|
238
|
-
client_id: number;
|
|
239
|
-
email?: string | undefined;
|
|
240
|
-
username?: string | undefined;
|
|
241
|
-
upn?: string | undefined;
|
|
242
|
-
}>;
|
|
104
|
+
}, z.core.$strip>;
|
|
243
105
|
/**
|
|
244
106
|
* Scan user duplicates schema
|
|
245
107
|
*/
|
|
246
108
|
export declare const ScanUserDuplicatesArgsSchema: z.ZodObject<{
|
|
247
109
|
client_id: z.ZodOptional<z.ZodNumber>;
|
|
248
110
|
format_options: z.ZodOptional<z.ZodObject<{
|
|
249
|
-
format: z.ZodOptional<z.ZodEnum<
|
|
250
|
-
|
|
111
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
112
|
+
compact: "compact";
|
|
113
|
+
standard: "standard";
|
|
114
|
+
detailed: "detailed";
|
|
115
|
+
}>>;
|
|
116
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
251
117
|
omit_empty: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
fields?: string[] | undefined;
|
|
255
|
-
omit_empty?: boolean | undefined;
|
|
256
|
-
}, {
|
|
257
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
258
|
-
fields?: string[] | undefined;
|
|
259
|
-
omit_empty?: boolean | undefined;
|
|
260
|
-
}>>;
|
|
261
|
-
}, "strip", z.ZodTypeAny, {
|
|
262
|
-
client_id?: number | undefined;
|
|
263
|
-
format_options?: {
|
|
264
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
265
|
-
fields?: string[] | undefined;
|
|
266
|
-
omit_empty?: boolean | undefined;
|
|
267
|
-
} | undefined;
|
|
268
|
-
}, {
|
|
269
|
-
client_id?: number | undefined;
|
|
270
|
-
format_options?: {
|
|
271
|
-
format?: "compact" | "standard" | "detailed" | undefined;
|
|
272
|
-
fields?: string[] | undefined;
|
|
273
|
-
omit_empty?: boolean | undefined;
|
|
274
|
-
} | undefined;
|
|
275
|
-
}>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
276
120
|
/**
|
|
277
121
|
* List users with optional filtering and token optimization
|
|
278
122
|
* Uses 1-minute cache TTL (billing-critical data)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAavD;;GAEG;AACH,eAAO,MAAM,m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AAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC,CAoCjB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC,CAiDjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAC5C,OAAO,CAAC,MAAM,CAAC,CAqFjB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,GACjD,OAAO,CAAC,MAAM,CAAC,CAiHjB;AAMD,eAAO,MAAM,aAAa,EAAE,iBAK3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,iBAKzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAKpC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAK5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAK5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAK/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAKpC,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for HaloPSA ticket-domain objects.
|
|
3
|
+
*
|
|
4
|
+
* Shapes here are derived from the Phase 0 probe results captured during
|
|
5
|
+
* the Tier 1 ticket-tools rollout. Optional fields are explicitly marked
|
|
6
|
+
* because Halo omits them from list responses and only populates them on
|
|
7
|
+
* /Tickets/{id}?includedetails=true.
|
|
8
|
+
*
|
|
9
|
+
* `source` is intentionally typed as `number` (not a string-literal union)
|
|
10
|
+
* because Halo's "API" enum value is a tenant-configurable integer that
|
|
11
|
+
* differs across installs — pinning it would make the type tenant-specific.
|
|
12
|
+
*/
|
|
13
|
+
import type { HaloPSACustomField } from './halopsa.js';
|
|
14
|
+
/**
|
|
15
|
+
* Ticket — a Halo work item (incident, request, change, etc.).
|
|
16
|
+
*
|
|
17
|
+
* `details_html` is the sanitized HTML body of the ticket and can be
|
|
18
|
+
* 50KB+. Consumers must NOT include it in compact responses.
|
|
19
|
+
*/
|
|
20
|
+
export interface HaloPSATicket {
|
|
21
|
+
id: number;
|
|
22
|
+
summary: string;
|
|
23
|
+
details_html?: string;
|
|
24
|
+
tickettype_id: number;
|
|
25
|
+
tickettype_name?: string;
|
|
26
|
+
status_id: number;
|
|
27
|
+
status_name?: string;
|
|
28
|
+
priority_id?: number;
|
|
29
|
+
priority_name?: string;
|
|
30
|
+
category_1?: string;
|
|
31
|
+
category_2?: string;
|
|
32
|
+
category_3?: string;
|
|
33
|
+
category_4?: string;
|
|
34
|
+
client_id: number;
|
|
35
|
+
client_name?: string;
|
|
36
|
+
site_id?: number;
|
|
37
|
+
site_name?: string;
|
|
38
|
+
user_id?: number;
|
|
39
|
+
user_name?: string;
|
|
40
|
+
agent_id?: number;
|
|
41
|
+
agent_name?: string;
|
|
42
|
+
team_id?: number;
|
|
43
|
+
team?: string;
|
|
44
|
+
source?: number;
|
|
45
|
+
dateoccurred?: string;
|
|
46
|
+
lastactiondate?: string;
|
|
47
|
+
deadlinedate?: string;
|
|
48
|
+
customfields?: HaloPSACustomField[];
|
|
49
|
+
sla?: HaloPSATicketSla;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* SLA snapshot embedded on a ticket detail response.
|
|
53
|
+
*/
|
|
54
|
+
export interface HaloPSATicketSla {
|
|
55
|
+
id?: number;
|
|
56
|
+
name?: string;
|
|
57
|
+
responseremaining?: number;
|
|
58
|
+
resolveremaining?: number;
|
|
59
|
+
isbreach?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Ticket Action — a journal entry on a ticket (note, email reply, status
|
|
63
|
+
* change, etc.). Created via POST /api/Actions with an array body.
|
|
64
|
+
*/
|
|
65
|
+
export interface HaloPSATicketAction {
|
|
66
|
+
id: number;
|
|
67
|
+
ticket_id: number;
|
|
68
|
+
who?: string;
|
|
69
|
+
who_agentid?: number;
|
|
70
|
+
who_userid?: number;
|
|
71
|
+
datetime: string;
|
|
72
|
+
outcome?: string;
|
|
73
|
+
outcome_id?: number;
|
|
74
|
+
note?: string;
|
|
75
|
+
note_html?: string;
|
|
76
|
+
email_reply?: boolean;
|
|
77
|
+
hiddenfromuser?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Ticket Type — reference data describing the kind of ticket
|
|
81
|
+
* (Incident, Service Request, Change, Project, etc.).
|
|
82
|
+
*/
|
|
83
|
+
export interface HaloPSATicketType {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
use?: string;
|
|
87
|
+
default_priority_id?: number;
|
|
88
|
+
default_status_id?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Ticket Status — workflow state. The `type` field discriminates state
|
|
92
|
+
* categories. Per the Tier 1 Phase 0 probe against the Wilner Tech
|
|
93
|
+
* tenant, `type` is a numeric enum (e.g., `0` = open, with closed states
|
|
94
|
+
* carrying a different value) and not a string. Older Halo docs describe
|
|
95
|
+
* it as a string discriminator (`'open' | 'closed' | ...`) — consumers
|
|
96
|
+
* accept both forms via `closeTicketTool`'s multi-strategy resolver.
|
|
97
|
+
*/
|
|
98
|
+
export interface HaloPSATicketStatus {
|
|
99
|
+
id: number;
|
|
100
|
+
name: string;
|
|
101
|
+
type?: string | number;
|
|
102
|
+
complete?: boolean;
|
|
103
|
+
is_closed?: boolean;
|
|
104
|
+
sequence?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Ticket Priority — raw shape returned by GET /Priority.
|
|
108
|
+
*
|
|
109
|
+
* Empirically verified (2026-05-11): `id` is a GUID string (per-SLA record
|
|
110
|
+
* identifier), NOT the integer used in Faults.priority_id. The integer field
|
|
111
|
+
* is `priorityid` (1-4). There are 12 records = 3 SLAs x 4 priority levels,
|
|
112
|
+
* so names like "Critical" appear three times — once per SLA assignment.
|
|
113
|
+
*/
|
|
114
|
+
export interface HaloPSATicketPriority {
|
|
115
|
+
/** GUID string — uniquely identifies this priority+SLA combination. */
|
|
116
|
+
id: string;
|
|
117
|
+
/** Integer 1-4 — the value that maps to Faults.priority_id on ticket creates. */
|
|
118
|
+
priorityid: number;
|
|
119
|
+
name: string;
|
|
120
|
+
slaid?: number;
|
|
121
|
+
fixtime?: number;
|
|
122
|
+
fixunits?: string;
|
|
123
|
+
responsetime?: number;
|
|
124
|
+
responseunits?: string;
|
|
125
|
+
colour?: string;
|
|
126
|
+
firstresponsetime?: number;
|
|
127
|
+
firstresponseunits?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Normalized priority shape returned by list_halopsa_ticket_priorities.
|
|
131
|
+
* The raw `id` GUID is renamed to `sla_priority_id` to avoid caller confusion;
|
|
132
|
+
* the integer `priorityid` is promoted to `id` (the value for Faults.priority_id).
|
|
133
|
+
*/
|
|
134
|
+
export interface HaloPSATicketPriorityNormalized {
|
|
135
|
+
/** Integer priority value — pass this as priority_id on ticket creates. */
|
|
136
|
+
id: number;
|
|
137
|
+
name: string;
|
|
138
|
+
/** GUID that uniquely identifies this priority+SLA combination. */
|
|
139
|
+
sla_priority_id: string;
|
|
140
|
+
slaid?: number;
|
|
141
|
+
fixtime?: number;
|
|
142
|
+
fixunits?: string;
|
|
143
|
+
responsetime?: number;
|
|
144
|
+
responseunits?: string;
|
|
145
|
+
colour?: string;
|
|
146
|
+
firstresponsetime?: number;
|
|
147
|
+
firstresponseunits?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Ticket Category — used for category_1..category_4 fields on tickets.
|
|
151
|
+
* Halo's `/Category` endpoint returns a flat list keyed by category level.
|
|
152
|
+
*/
|
|
153
|
+
export interface HaloPSATicketCategory {
|
|
154
|
+
id: number;
|
|
155
|
+
value: string;
|
|
156
|
+
type_id?: number;
|
|
157
|
+
parent_id?: number;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Wrapped list responses from Halo. Endpoints return either bare arrays
|
|
161
|
+
* or `{ <plural>: [...], record_count }` depending on the endpoint and
|
|
162
|
+
* tenant configuration — call sites must handle both shapes.
|
|
163
|
+
*/
|
|
164
|
+
export interface HaloPSATicketListResponse {
|
|
165
|
+
tickets: HaloPSATicket[];
|
|
166
|
+
record_count: number;
|
|
167
|
+
page_count?: number;
|
|
168
|
+
}
|
|
169
|
+
export interface HaloPSATicketActionListResponse {
|
|
170
|
+
actions: HaloPSATicketAction[];
|
|
171
|
+
record_count: number;
|
|
172
|
+
}
|
|
173
|
+
export interface HaloPSATicketTypeListResponse {
|
|
174
|
+
tickettypes: HaloPSATicketType[];
|
|
175
|
+
record_count: number;
|
|
176
|
+
}
|
|
177
|
+
export interface HaloPSATicketStatusListResponse {
|
|
178
|
+
statuses: HaloPSATicketStatus[];
|
|
179
|
+
record_count: number;
|
|
180
|
+
}
|
|
181
|
+
export interface HaloPSATicketPriorityListResponse {
|
|
182
|
+
priorities: HaloPSATicketPriority[];
|
|
183
|
+
record_count: number;
|
|
184
|
+
}
|
|
185
|
+
export interface HaloPSATicketPriorityNormalizedListResponse {
|
|
186
|
+
priorities: HaloPSATicketPriorityNormalized[];
|
|
187
|
+
record_count: number;
|
|
188
|
+
}
|
|
189
|
+
export interface HaloPSATicketCategoryListResponse {
|
|
190
|
+
categories: HaloPSATicketCategory[];
|
|
191
|
+
record_count: number;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=tickets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tickets.d.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AAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,2CAA2C;IAC1D,UAAU,EAAE,+BAA+B,EAAE,CAAC;IAC9C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for HaloPSA ticket-domain objects.
|
|
3
|
+
*
|
|
4
|
+
* Shapes here are derived from the Phase 0 probe results captured during
|
|
5
|
+
* the Tier 1 ticket-tools rollout. Optional fields are explicitly marked
|
|
6
|
+
* because Halo omits them from list responses and only populates them on
|
|
7
|
+
* /Tickets/{id}?includedetails=true.
|
|
8
|
+
*
|
|
9
|
+
* `source` is intentionally typed as `number` (not a string-literal union)
|
|
10
|
+
* because Halo's "API" enum value is a tenant-configurable integer that
|
|
11
|
+
* differs across installs — pinning it would make the type tenant-specific.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=tickets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tickets.js","sourceRoot":"","sources":["../../src/types/tickets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -8,7 +8,21 @@ export interface FormatOptions {
|
|
|
8
8
|
omit_empty?: boolean;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Recursively walk `payload` (objects + arrays) and replace the VALUE of any
|
|
12
|
+
* key matching CREDENTIAL_KEY_RE with the string '[REDACTED]'.
|
|
13
|
+
*
|
|
14
|
+
* The function is IMMUTABLE — it deep-clones before mutating so the original
|
|
15
|
+
* object passed by the caller is never modified.
|
|
16
|
+
*/
|
|
17
|
+
export declare function scrubCredentials(payload: unknown): unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Format a response object based on options.
|
|
20
|
+
*
|
|
21
|
+
* Credential scrubbing: `scrubCredentials()` is applied to `data` BEFORE
|
|
22
|
+
* serialization so that fields like `new_password`, `api_key`, `secret`,
|
|
23
|
+
* `token`, and `client_secret` are replaced with '[REDACTED]' in every tool
|
|
24
|
+
* response automatically. The response signature is unchanged (string).
|
|
25
|
+
*
|
|
12
26
|
* @param data - The data to format (single object or array)
|
|
13
27
|
* @param options - Formatting options
|
|
14
28
|
* @param meta - Optional metadata (pagination, counts)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAeD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAoB1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EACb,OAAO,GAAE,aAAkB,EAC3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CA6CR"}
|
package/dist/utils/formatter.js
CHANGED
|
@@ -3,7 +3,51 @@
|
|
|
3
3
|
* Provides compact, standard, and detailed output modes for HaloPSA responses
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Regex that matches credential-bearing key names (case-insensitive).
|
|
7
|
+
*
|
|
8
|
+
* Covered patterns:
|
|
9
|
+
* password, new_password
|
|
10
|
+
* api_key, apikey, api-key
|
|
11
|
+
* secret
|
|
12
|
+
* token, access_token
|
|
13
|
+
* client_secret
|
|
14
|
+
*/
|
|
15
|
+
const CREDENTIAL_KEY_RE = /^(new_)?password$|api[_-]?key$|secret$|(access_)?token$|client_secret$/i;
|
|
16
|
+
/**
|
|
17
|
+
* Recursively walk `payload` (objects + arrays) and replace the VALUE of any
|
|
18
|
+
* key matching CREDENTIAL_KEY_RE with the string '[REDACTED]'.
|
|
19
|
+
*
|
|
20
|
+
* The function is IMMUTABLE — it deep-clones before mutating so the original
|
|
21
|
+
* object passed by the caller is never modified.
|
|
22
|
+
*/
|
|
23
|
+
export function scrubCredentials(payload) {
|
|
24
|
+
if (Array.isArray(payload)) {
|
|
25
|
+
return payload.map((item) => scrubCredentials(item));
|
|
26
|
+
}
|
|
27
|
+
if (payload !== null && typeof payload === 'object') {
|
|
28
|
+
const source = payload;
|
|
29
|
+
const result = {};
|
|
30
|
+
for (const key of Object.keys(source)) {
|
|
31
|
+
if (CREDENTIAL_KEY_RE.test(key)) {
|
|
32
|
+
result[key] = '[REDACTED]';
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
result[key] = scrubCredentials(source[key]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
// Primitives (string, number, boolean, null, undefined) — return as-is
|
|
41
|
+
return payload;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Format a response object based on options.
|
|
45
|
+
*
|
|
46
|
+
* Credential scrubbing: `scrubCredentials()` is applied to `data` BEFORE
|
|
47
|
+
* serialization so that fields like `new_password`, `api_key`, `secret`,
|
|
48
|
+
* `token`, and `client_secret` are replaced with '[REDACTED]' in every tool
|
|
49
|
+
* response automatically. The response signature is unchanged (string).
|
|
50
|
+
*
|
|
7
51
|
* @param data - The data to format (single object or array)
|
|
8
52
|
* @param options - Formatting options
|
|
9
53
|
* @param meta - Optional metadata (pagination, counts)
|
|
@@ -11,20 +55,22 @@
|
|
|
11
55
|
*/
|
|
12
56
|
export function formatResponse(data, options = {}, meta) {
|
|
13
57
|
const { format = 'standard', fields, omit_empty = false, } = options;
|
|
58
|
+
// Scrub credential fields before any further processing
|
|
59
|
+
const safeData = scrubCredentials(data);
|
|
14
60
|
// Process data
|
|
15
61
|
let processedData;
|
|
16
|
-
if (Array.isArray(
|
|
17
|
-
processedData =
|
|
62
|
+
if (Array.isArray(safeData)) {
|
|
63
|
+
processedData = safeData.map((item) => processItem(item, fields, omit_empty, format));
|
|
18
64
|
}
|
|
19
65
|
else {
|
|
20
|
-
processedData = processItem(
|
|
66
|
+
processedData = processItem(safeData, fields, omit_empty, format);
|
|
21
67
|
}
|
|
22
68
|
// Build result object
|
|
23
|
-
const result = Array.isArray(
|
|
69
|
+
const result = Array.isArray(safeData)
|
|
24
70
|
? { data: processedData }
|
|
25
71
|
: processedData;
|
|
26
72
|
// Add metadata if provided and data is array
|
|
27
|
-
if (meta && Array.isArray(
|
|
73
|
+
if (meta && Array.isArray(safeData)) {
|
|
28
74
|
result.meta = meta;
|
|
29
75
|
}
|
|
30
76
|
// Return with appropriate formatting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAa,EACb,UAAyB,EAAE,EAC3B,IAA8B;IAE9B,MAAM,EACJ,MAAM,GAAG,UAAU,EACnB,MAAM,EACN,UAAU,GAAG,KAAK,GACnB,GAAG,OAAO,CAAC;IAEZ,eAAe;IACf,IAAI,aAAsB,CAAC;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;;;;;GASG;AACH,MAAM,iBAAiB,GACrB,yEAAyE,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,OAAkC,CAAC;QAClD,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,uEAAuE;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