@zimmerstack/connect 0.7.0 → 0.9.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/AGENTS.md +269 -15
- package/README.md +444 -18
- package/dist/cjs/client.d.ts +503 -13
- package/dist/cjs/client.js +743 -45
- package/dist/cjs/doctor.d.ts +86 -0
- package/dist/cjs/doctor.js +689 -0
- package/dist/cjs/errors.d.ts +6 -2
- package/dist/cjs/errors.js +7 -2
- package/dist/cjs/generated.d.ts +2831 -205
- package/dist/cjs/generated.js +220 -8
- package/dist/cjs/grid.d.ts +6 -1
- package/dist/cjs/grid.js +8 -0
- package/dist/cjs/index.d.ts +14 -5
- package/dist/cjs/index.js +41 -1
- package/dist/cjs/key.d.ts +39 -0
- package/dist/cjs/key.js +85 -0
- package/dist/cjs/money.d.ts +81 -0
- package/dist/cjs/money.js +172 -0
- package/dist/cjs/notices.d.ts +44 -0
- package/dist/cjs/notices.js +64 -0
- package/dist/cjs/shownOnce.d.ts +42 -0
- package/dist/cjs/shownOnce.js +83 -0
- package/dist/cjs/webhooks.d.ts +182 -3
- package/dist/cjs/webhooks.js +75 -1
- package/dist/esm/client.d.ts +503 -13
- package/dist/esm/client.js +741 -45
- package/dist/esm/doctor.d.ts +86 -0
- package/dist/esm/doctor.js +685 -0
- package/dist/esm/errors.d.ts +6 -2
- package/dist/esm/errors.js +7 -2
- package/dist/esm/generated.d.ts +2831 -205
- package/dist/esm/generated.js +219 -7
- package/dist/esm/grid.d.ts +6 -1
- package/dist/esm/grid.js +7 -0
- package/dist/esm/index.d.ts +14 -5
- package/dist/esm/index.js +8 -3
- package/dist/esm/key.d.ts +39 -0
- package/dist/esm/key.js +81 -0
- package/dist/esm/mcp/cli.js +88 -9
- package/dist/esm/mcp/reference.generated.js +4457 -969
- package/dist/esm/mcp/server.d.ts +14 -6
- package/dist/esm/mcp/server.js +451 -25
- package/dist/esm/money.d.ts +81 -0
- package/dist/esm/money.js +161 -0
- package/dist/esm/notices.d.ts +44 -0
- package/dist/esm/notices.js +56 -0
- package/dist/esm/shownOnce.d.ts +42 -0
- package/dist/esm/shownOnce.js +77 -0
- package/dist/esm/webhooks.d.ts +182 -3
- package/dist/esm/webhooks.js +69 -0
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type ZimmerStackOptions } from "./client.js";
|
|
2
|
+
/**
|
|
3
|
+
* The doctor: one look at an integration when something is wrong (`npx @zimmerstack/connect doctor`).
|
|
4
|
+
*
|
|
5
|
+
* It only READS. In order: is the key the right shape (checked offline, by its own checksum, before
|
|
6
|
+
* anything is sent) and does it answer; is something wrong on ZimmerStack's side (the open incidents
|
|
7
|
+
* that touch your hotels); which hotels and scopes it reaches, and for a hotel that is not live yet,
|
|
8
|
+
* which readiness checks have not passed; every budget and how full it is; the last day's refused
|
|
9
|
+
* requests, grouped by reason; whether the webhook endpoints are being answered, with their last
|
|
10
|
+
* failures; how far what you sent has travelled, and what the last nightly read found changed on the
|
|
11
|
+
* channel manager's side; and, when you name a night, that night's whole story. Each finding is one plain
|
|
12
|
+
* sentence and, where there is something to do, what to do. The key is never printed, returned or put in
|
|
13
|
+
* a message.
|
|
14
|
+
*
|
|
15
|
+
* `diagnose` is what the command runs; call it from your own health page or a deploy check if you like.
|
|
16
|
+
*/
|
|
17
|
+
export type DoctorCheck = "key" | "reach" | "status" | "hotels" | "limits" | "requests" | "webhooks" | "sync" | "night";
|
|
18
|
+
export interface DoctorFinding {
|
|
19
|
+
/** ok: as it should be · info: worth knowing, nothing to do now · attention: something to fix (the command exits 1) */
|
|
20
|
+
level: "ok" | "info" | "attention";
|
|
21
|
+
check: DoctorCheck;
|
|
22
|
+
/** What was found, in one sentence for a person. */
|
|
23
|
+
message: string;
|
|
24
|
+
/** What to do about it; absent when there is nothing to do. */
|
|
25
|
+
action?: string;
|
|
26
|
+
/** The hotel the finding is about, when it is about one. */
|
|
27
|
+
propertyId?: number;
|
|
28
|
+
}
|
|
29
|
+
/** One budget as the doctor read it. `percentUsed` is null when the API does not count it where this route can read it. */
|
|
30
|
+
export interface DoctorBudget {
|
|
31
|
+
propertyId: number | null;
|
|
32
|
+
scope: string;
|
|
33
|
+
per: string;
|
|
34
|
+
window: string;
|
|
35
|
+
quota: number;
|
|
36
|
+
unit: string;
|
|
37
|
+
used: number | null;
|
|
38
|
+
remaining: number | null;
|
|
39
|
+
resetSeconds: number | null;
|
|
40
|
+
percentUsed: number | null;
|
|
41
|
+
}
|
|
42
|
+
export interface DoctorReport {
|
|
43
|
+
/** false when at least one finding needs attention. */
|
|
44
|
+
ok: boolean;
|
|
45
|
+
checkedAt: string;
|
|
46
|
+
/** "test": a sandbox key. null when the key could not be read at all. */
|
|
47
|
+
mode: "live" | "test" | null;
|
|
48
|
+
keyKind: "hotel" | "company" | null;
|
|
49
|
+
/** The hotels that were looked at (a company key's first few, or the one named). */
|
|
50
|
+
hotels: Array<{
|
|
51
|
+
id: number;
|
|
52
|
+
name: string;
|
|
53
|
+
sandbox: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
findings: DoctorFinding[];
|
|
56
|
+
budgets: DoctorBudget[];
|
|
57
|
+
}
|
|
58
|
+
export interface DoctorOptions extends Pick<ZimmerStackOptions, "apiKey" | "fetch" | "baseUrl"> {
|
|
59
|
+
/** A company key: look at this hotel only. Without it the first `maxHotels` hotels are looked at. */
|
|
60
|
+
propertyId?: number;
|
|
61
|
+
/** How many of a company key's hotels to look at. Default 5. */
|
|
62
|
+
maxHotels?: number;
|
|
63
|
+
/**
|
|
64
|
+
* One night to explain (GET /explain): a room type's id and a date, optionally one rate plan. A company
|
|
65
|
+
* key that reaches more than one hotel names the hotel too (`propertyId`): a room type belongs to one.
|
|
66
|
+
*/
|
|
67
|
+
night?: {
|
|
68
|
+
roomTypeId: number;
|
|
69
|
+
date: string;
|
|
70
|
+
ratePlanId?: number;
|
|
71
|
+
};
|
|
72
|
+
signal?: AbortSignal;
|
|
73
|
+
/** The clock, for tests. */
|
|
74
|
+
now?: () => Date;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Run every check and return what was found. Reads only; never throws for something the API answered
|
|
78
|
+
* (that is a finding). `apiKey` defaults to the environment variable ZIMMERSTACK_CONNECT_KEY.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* const report = await diagnose();
|
|
82
|
+
* if (!report.ok) console.error(formatDoctorReport(report));
|
|
83
|
+
*/
|
|
84
|
+
export declare function diagnose(options?: DoctorOptions): Promise<DoctorReport>;
|
|
85
|
+
/** The report as text for a terminal: one section per check, each finding with what to do. Never contains the key. */
|
|
86
|
+
export declare function formatDoctorReport(report: DoctorReport): string;
|