@myapihq/sdk 1.3.1 → 1.3.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/dist/hq.d.ts +32 -0
- package/dist/hq.js +5 -0
- package/package.json +1 -1
- package/src/hq.ts +43 -0
package/dist/hq.d.ts
CHANGED
|
@@ -132,3 +132,35 @@ export declare function setupPayment(apiKey: string): Promise<{
|
|
|
132
132
|
export declare function topUp(apiKey: string, amountDollars: number): Promise<{
|
|
133
133
|
new_balance_display: string;
|
|
134
134
|
}>;
|
|
135
|
+
export type DoctorSeverity = 'ok' | 'warn' | 'crit';
|
|
136
|
+
export interface DoctorEntityRef {
|
|
137
|
+
slot: string;
|
|
138
|
+
id: string;
|
|
139
|
+
name?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface DoctorIssue {
|
|
142
|
+
id: string;
|
|
143
|
+
severity: DoctorSeverity;
|
|
144
|
+
scope: string;
|
|
145
|
+
entity?: DoctorEntityRef;
|
|
146
|
+
category?: string;
|
|
147
|
+
message: string;
|
|
148
|
+
hint?: string;
|
|
149
|
+
}
|
|
150
|
+
export interface DoctorSection {
|
|
151
|
+
name: string;
|
|
152
|
+
summary: string;
|
|
153
|
+
issues: DoctorIssue[];
|
|
154
|
+
}
|
|
155
|
+
export interface DoctorReport {
|
|
156
|
+
org_id: string;
|
|
157
|
+
generated_at: string;
|
|
158
|
+
cache_ttl_seconds?: number;
|
|
159
|
+
sections: DoctorSection[];
|
|
160
|
+
totals: {
|
|
161
|
+
ok: number;
|
|
162
|
+
warn: number;
|
|
163
|
+
crit: number;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export declare function getDoctor(apiKey: string, orgId: string): Promise<DoctorReport>;
|
package/dist/hq.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.getBillingHistory = getBillingHistory;
|
|
|
25
25
|
exports.getBillingUsage = getBillingUsage;
|
|
26
26
|
exports.setupPayment = setupPayment;
|
|
27
27
|
exports.topUp = topUp;
|
|
28
|
+
exports.getDoctor = getDoctor;
|
|
28
29
|
const client_1 = require("./client");
|
|
29
30
|
const config_1 = require("./config");
|
|
30
31
|
exports.EXPOSES = [
|
|
@@ -52,6 +53,7 @@ exports.EXPOSES = [
|
|
|
52
53
|
'GET /hq/billing/usage',
|
|
53
54
|
'POST /hq/billing/setup-payment',
|
|
54
55
|
'POST /hq/billing/topup',
|
|
56
|
+
'GET /hq/orgs/{org_id}/doctor',
|
|
55
57
|
];
|
|
56
58
|
// The closed grantable-slot vocabulary. Mirrors `iam.GrantableSlots` in the
|
|
57
59
|
// backend — keep in sync. Used to validate `--grant` client-side before the
|
|
@@ -153,3 +155,6 @@ async function setupPayment(apiKey) {
|
|
|
153
155
|
async function topUp(apiKey, amountDollars) {
|
|
154
156
|
return (0, client_1.request)('POST', `${config_1.HQ_BASE}/hq/billing/topup`, apiKey, { amount_dollars: amountDollars });
|
|
155
157
|
}
|
|
158
|
+
async function getDoctor(apiKey, orgId) {
|
|
159
|
+
return (0, client_1.request)('GET', `${config_1.HQ_BASE}/hq/orgs/${encodeURIComponent(orgId)}/doctor`, apiKey);
|
|
160
|
+
}
|
package/package.json
CHANGED
package/src/hq.ts
CHANGED
|
@@ -27,6 +27,7 @@ export const EXPOSES: Exposes = [
|
|
|
27
27
|
'GET /hq/billing/usage',
|
|
28
28
|
'POST /hq/billing/setup-payment',
|
|
29
29
|
'POST /hq/billing/topup',
|
|
30
|
+
'GET /hq/orgs/{org_id}/doctor',
|
|
30
31
|
];
|
|
31
32
|
|
|
32
33
|
export interface Org {
|
|
@@ -264,3 +265,45 @@ export async function setupPayment(apiKey: string): Promise<{ url: string }> {
|
|
|
264
265
|
export async function topUp(apiKey: string, amountDollars: number): Promise<{ new_balance_display: string }> {
|
|
265
266
|
return request('POST', `${BASE_URL}/hq/billing/topup`, apiKey, { amount_dollars: amountDollars });
|
|
266
267
|
}
|
|
268
|
+
|
|
269
|
+
// ── Org doctor ─────────────────────────────────────────────────────────
|
|
270
|
+
// Aggregated consistency report across slots. The endpoint resolves the
|
|
271
|
+
// reported org from the API key's binding, so the `{org_id}` path param
|
|
272
|
+
// is currently positional/cosmetic (pass your default — the response will
|
|
273
|
+
// indicate which org was actually scored under `report.org_id`).
|
|
274
|
+
|
|
275
|
+
export type DoctorSeverity = 'ok' | 'warn' | 'crit';
|
|
276
|
+
|
|
277
|
+
export interface DoctorEntityRef {
|
|
278
|
+
slot: string; // 'funnel' | 'webhook' | 'workflow' | 'container' | 'domain' | …
|
|
279
|
+
id: string;
|
|
280
|
+
name?: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface DoctorIssue {
|
|
284
|
+
id: string; // stable across runs, dedupable
|
|
285
|
+
severity: DoctorSeverity;
|
|
286
|
+
scope: string; // logical scope, e.g. 'funnel/<slug>'
|
|
287
|
+
entity?: DoctorEntityRef;
|
|
288
|
+
category?: string; // 'reference_integrity' | 'orphan' | 'activity' | 'security' | 'billing' | 'network'
|
|
289
|
+
message: string;
|
|
290
|
+
hint?: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface DoctorSection {
|
|
294
|
+
name: string;
|
|
295
|
+
summary: string;
|
|
296
|
+
issues: DoctorIssue[];
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface DoctorReport {
|
|
300
|
+
org_id: string;
|
|
301
|
+
generated_at: string; // RFC3339
|
|
302
|
+
cache_ttl_seconds?: number;
|
|
303
|
+
sections: DoctorSection[];
|
|
304
|
+
totals: { ok: number; warn: number; crit: number };
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export async function getDoctor(apiKey: string, orgId: string): Promise<DoctorReport> {
|
|
308
|
+
return request('GET', `${BASE_URL}/hq/orgs/${encodeURIComponent(orgId)}/doctor`, apiKey);
|
|
309
|
+
}
|