@myapihq/sdk 1.3.1 → 1.3.4

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 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "1.3.1",
4
+ "version": "1.3.4",
5
5
  "description": "TypeScript SDK for the MyAPI ecosystem",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
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,52 @@ 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
+ // Open string — do not exhaustively switch on it. Backend categories,
289
+ // per the OpenAPI schema: 'reference_integrity' | 'orphan' | 'activity' |
290
+ // 'security' | 'billing' | 'internal'. The backend may also emit
291
+ // slash-namespaced subcategories (e.g. 'security/spf', 'security/dmarc');
292
+ // if you branch on category, match the parent by splitting on the first
293
+ // '/'. The CLI's local augmentation adds one more category not in the
294
+ // schema: 'network' (the DNS + HTTP reachability probes).
295
+ category?: string;
296
+ message: string;
297
+ hint?: string;
298
+ }
299
+
300
+ export interface DoctorSection {
301
+ name: string;
302
+ summary: string;
303
+ issues: DoctorIssue[];
304
+ }
305
+
306
+ export interface DoctorReport {
307
+ org_id: string;
308
+ generated_at: string; // RFC3339
309
+ cache_ttl_seconds?: number;
310
+ sections: DoctorSection[];
311
+ totals: { ok: number; warn: number; crit: number };
312
+ }
313
+
314
+ export async function getDoctor(apiKey: string, orgId: string): Promise<DoctorReport> {
315
+ return request('GET', `${BASE_URL}/hq/orgs/${encodeURIComponent(orgId)}/doctor`, apiKey);
316
+ }