iit-mcp-autotask 0.56.1 → 0.56.2
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/README.md
CHANGED
|
@@ -793,3 +793,7 @@ See [docs/architecture.md](docs/architecture.md) section 5 for intentional omiss
|
|
|
793
793
|
Authenticated `GET /configuration/autotask` returns versioned named zone choices filtered by the deployment host policy. `POST /configuration/autotask/resolve-zone` accepts `{ "username": "api-user@example.com" }`, calls the fixed Autotask ZoneInformation endpoint without credentials, and returns an allowed HTTPS zone origin/label. Discovery follows no redirects; errors return safe codes. Both routes use the normal Host/Origin, bearer and rate-limit guard. Health/readiness remain zero-wire. The zone catalogue follows the vendor REST zone table; custom zones still require existing host-policy approval.
|
|
794
794
|
|
|
795
795
|
For token rotation, two hashes may name the same principal only with identical complete token entries (profile, toolsets and run scope). Install both hashes, restart to load them, switch the client secret, verify and remove the old hash after an overlap. Different authorities under one principal still fail boot. Secrets are never part of discovery metadata.
|
|
796
|
+
|
|
797
|
+
### Complete time-entry note verification
|
|
798
|
+
|
|
799
|
+
`autotask_read {operation:"time_entries.get", args:[id], projection:"time_entry_verification_v1"}` returns one forced-fresh read snapshot: scalar time-entry fields and versioned SHA256/code-point/UTF-8-byte metadata for `summaryNotes` and `internalNotes`. It never returns note bodies or changes the normal free-text caps. Hashes cover exact raw UTF-8, without whitespace, wrapper or line-ending normalisation; null and unavailable fields are distinct. Each note is bounded at 1 MiB; unsupported, missing, oversized or malformed data is never proof of equality. Callers must check the contract, fresh flag and entry/resource identity before comparing. Existing credentials and read policy still apply.
|
package/dist/tools/meta.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { projectTimeEntryVerification } from './time-entry-verification.js';
|
|
1
2
|
/**
|
|
2
3
|
* tools/meta.ts — the discovery and generic-read core:
|
|
3
4
|
*
|
|
@@ -600,6 +601,15 @@ export function buildRead(ctx) {
|
|
|
600
601
|
if ((args.operation === undefined) === (args.items === undefined)) {
|
|
601
602
|
throw new InputInvalidError('read: pass exactly one of operation (with args) or items', 'operation');
|
|
602
603
|
}
|
|
604
|
+
if (args.projection !== undefined && args.projection !== 'default') {
|
|
605
|
+
if (args.operation !== 'time_entries.get' || args.items !== undefined || args.args.length !== 1 || !Number.isSafeInteger(args.args[0]) || args.args[0] <= 0) {
|
|
606
|
+
throw new InputInvalidError('verification projection requires one time_entries.get and one positive numeric id', 'projection');
|
|
607
|
+
}
|
|
608
|
+
const out = await readOneItem(ctx, args.operation, args.args, signal, { fresh: true });
|
|
609
|
+
if (out.aborted)
|
|
610
|
+
return abortedAnswer(ctx.correlationId);
|
|
611
|
+
return ok('Fresh time-entry verification snapshot; note bodies withheld.', projectTimeEntryVerification(out.result, args.args[0]));
|
|
612
|
+
}
|
|
603
613
|
if (args.operation !== undefined) {
|
|
604
614
|
const out = await readOneItem(ctx, args.operation, args.args, signal);
|
|
605
615
|
if (out.aborted)
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -204,6 +204,10 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
|
|
|
204
204
|
operation: string;
|
|
205
205
|
args: unknown[];
|
|
206
206
|
}>>>>, unknown>;
|
|
207
|
+
projection: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
|
|
208
|
+
default: "default";
|
|
209
|
+
time_entry_verification_v1: "time_entry_verification_v1";
|
|
210
|
+
}>>, unknown>;
|
|
207
211
|
}, z.core.$strip>, z.ZodTransform<{
|
|
208
212
|
args: unknown[];
|
|
209
213
|
operation?: string | undefined;
|
|
@@ -211,6 +215,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
|
|
|
211
215
|
operation: string;
|
|
212
216
|
args: unknown[];
|
|
213
217
|
}[] | undefined;
|
|
218
|
+
projection?: "default" | "time_entry_verification_v1" | undefined;
|
|
214
219
|
}, {
|
|
215
220
|
args: unknown[];
|
|
216
221
|
operation?: string | undefined;
|
|
@@ -218,6 +223,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
|
|
|
218
223
|
operation: string;
|
|
219
224
|
args: unknown[];
|
|
220
225
|
}[] | undefined;
|
|
226
|
+
projection?: "default" | "time_entry_verification_v1" | undefined;
|
|
221
227
|
}>>;
|
|
222
228
|
export declare const RESOLVE_INPUT: z.ZodObject<{
|
|
223
229
|
identifier: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -238,6 +238,7 @@ export const READ_INPUT = z.object({
|
|
|
238
238
|
operation: unset(OP_KEY.optional()).describe('Exact read key, e.g. tickets.get (autotask_catalog finds it).'),
|
|
239
239
|
args: unset(ARGS),
|
|
240
240
|
items: unset(z.array(READ_ITEM).min(1).max(READ_MAX_ITEMS).optional()).describe('Batch reads in one call, each { operation, args }; use instead of operation.'),
|
|
241
|
+
projection: unset(z.enum(['default', 'time_entry_verification_v1']).optional()).describe('default keeps the normal read. time_entry_verification_v1 is metadata-only, valid only for one time_entries.get with one numeric id; forced fresh. No note bodies.'),
|
|
241
242
|
}).transform(numericQueryBag);
|
|
242
243
|
export const RESOLVE_INPUT = z.object({
|
|
243
244
|
identifier: z.union([z.number().int().nonnegative(), z.string().min(1).max(200)]).describe('Numeric id, name, ticket number, serial or email. resources: numeric identifiers are looked up as Resource ids.'),
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Fresh, bounded verification metadata; note bodies never leave this projection. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { InputInvalidError } from './dispatch.js';
|
|
4
|
+
export const NOTE_VERIFICATION_MAX_BYTES = 1_048_576;
|
|
5
|
+
const SCALARS = ['id', 'resourceID', 'ticketID', 'taskID', 'roleID', 'billingCodeID', 'startDateTime', 'endDateTime', 'dateWorked', 'hoursWorked', 'isNonBillable'];
|
|
6
|
+
function fingerprint(value) {
|
|
7
|
+
if (value === null)
|
|
8
|
+
return { state: 'null' };
|
|
9
|
+
if (typeof value !== 'string')
|
|
10
|
+
return { state: 'unavailable', reason: 'missing_or_invalid' };
|
|
11
|
+
// A lone surrogate has no exact UTF-8 encoding; never hash its replacement character.
|
|
12
|
+
if (/[\uD800-\uDFFF]/u.test(value))
|
|
13
|
+
return { state: 'unavailable', reason: 'invalid_unicode' };
|
|
14
|
+
const byteLength = Buffer.byteLength(value, 'utf8');
|
|
15
|
+
if (byteLength > NOTE_VERIFICATION_MAX_BYTES)
|
|
16
|
+
return { state: 'unavailable', reason: 'too_large' };
|
|
17
|
+
return { state: 'complete', characters: [...value].length, bytes: byteLength, sha256: createHash('sha256').update(value, 'utf8').digest('hex') };
|
|
18
|
+
}
|
|
19
|
+
function validScalar(key, value) {
|
|
20
|
+
if (key === 'id' || key === 'resourceID')
|
|
21
|
+
return Number.isSafeInteger(value) && value > 0;
|
|
22
|
+
if (key.endsWith('ID'))
|
|
23
|
+
return value === null || (Number.isSafeInteger(value) && value > 0);
|
|
24
|
+
if (key === 'hoursWorked')
|
|
25
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
26
|
+
if (key === 'isNonBillable')
|
|
27
|
+
return typeof value === 'boolean';
|
|
28
|
+
if (typeof value !== 'string' || value.length > 40)
|
|
29
|
+
return false;
|
|
30
|
+
const date = /^\d{4}-\d{2}-\d{2}$/;
|
|
31
|
+
const datetime = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,7})?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
32
|
+
if (!datetime.test(value) && !(key === 'dateWorked' && date.test(value)))
|
|
33
|
+
return false;
|
|
34
|
+
const [year, month, day] = value.slice(0, 10).split('-').map(Number);
|
|
35
|
+
const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
36
|
+
const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
37
|
+
// Date.parse normalises impossible dates, so validate calendar and clock components explicitly.
|
|
38
|
+
if (year < 1 || month < 1 || month > 12 || day < 1 || day > days[month - 1])
|
|
39
|
+
return false;
|
|
40
|
+
if (value.length === 10)
|
|
41
|
+
return true;
|
|
42
|
+
const [hour, minute, second] = value.slice(11, 19).split(':').map(Number);
|
|
43
|
+
if (hour > 23 || minute > 59 || second > 59)
|
|
44
|
+
return false;
|
|
45
|
+
const offset = /[+-](\d{2}):(\d{2})$/.exec(value);
|
|
46
|
+
return offset === null || (Number(offset[1]) <= 23 && Number(offset[2]) <= 59);
|
|
47
|
+
}
|
|
48
|
+
export function projectTimeEntryVerification(result, entryId) {
|
|
49
|
+
const row = result;
|
|
50
|
+
if (row === null || typeof row !== 'object' || Array.isArray(row) || row.id !== entryId || !Number.isSafeInteger(row.resourceID) || row.resourceID <= 0) {
|
|
51
|
+
throw new InputInvalidError('time entry verification: the fresh record identity was missing or inconsistent', 'args[0]');
|
|
52
|
+
}
|
|
53
|
+
if (SCALARS.some((key) => !validScalar(key, row[key]))) {
|
|
54
|
+
throw new InputInvalidError('time entry verification: required scalar fields were missing or invalid', 'args[0]');
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
contract: 'time-entry-verification-v1', fresh: true,
|
|
58
|
+
entry: Object.fromEntries(SCALARS.filter((key) => key in row).map((key) => [key, row[key]])),
|
|
59
|
+
notes: { summaryNotes: fingerprint(row.summaryNotes), internalNotes: fingerprint(row.internalNotes) },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=time-entry-verification.js.map
|
package/package.json
CHANGED
package/server.json
CHANGED