@terrantula/sdk 0.13.0 → 0.14.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/dist/{chunk-E3CKS754.mjs → chunk-46T35MSS.mjs} +365 -292
- package/dist/index.d.mts +153 -2
- package/dist/index.d.ts +153 -2
- package/dist/index.js +368 -295
- package/dist/index.mjs +1 -1
- package/dist/local.d.mts +136 -1
- package/dist/local.d.ts +136 -1
- package/dist/local.js +368 -295
- package/dist/local.mjs +1 -1
- package/dist/{projects-D-LiD32g.d.mts → projects-DmWHHY1a.d.mts} +6 -1
- package/dist/{projects-D-LiD32g.d.ts → projects-DmWHHY1a.d.ts} +6 -1
- package/package.json +1 -1
|
@@ -716,6 +716,18 @@ function createDeploymentTargetSetsClient(proj) {
|
|
|
716
716
|
param: { name: params.name }
|
|
717
717
|
})
|
|
718
718
|
)
|
|
719
|
+
),
|
|
720
|
+
listMembers: withSchema(
|
|
721
|
+
z5.object({
|
|
722
|
+
orgId: z5.string().describe("Organization slug"),
|
|
723
|
+
projectId: z5.string().describe("Project ID"),
|
|
724
|
+
name: z5.string().describe("Deployment target set name")
|
|
725
|
+
}),
|
|
726
|
+
(params) => call(
|
|
727
|
+
proj(params.orgId, params.projectId)["deployment-target-sets"][":name"]["members"].$get({
|
|
728
|
+
param: { name: params.name }
|
|
729
|
+
})
|
|
730
|
+
)
|
|
719
731
|
)
|
|
720
732
|
};
|
|
721
733
|
}
|
|
@@ -1163,13 +1175,73 @@ function createApplyClient(projEnv) {
|
|
|
1163
1175
|
);
|
|
1164
1176
|
}
|
|
1165
1177
|
|
|
1166
|
-
// src/
|
|
1178
|
+
// src/observations.ts
|
|
1167
1179
|
import { z as z10 } from "zod";
|
|
1180
|
+
import { ObservationImportPayloadSchema } from "@terrantula/types";
|
|
1181
|
+
async function rawRequest(baseUrl, hcOpts, path, init = {}) {
|
|
1182
|
+
const fetchImpl = hcOpts?.fetch ?? fetch;
|
|
1183
|
+
const rawHeaders = hcOpts?.headers;
|
|
1184
|
+
const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
|
|
1185
|
+
return fetchImpl(`${baseUrl}${path}`, {
|
|
1186
|
+
...init,
|
|
1187
|
+
headers: {
|
|
1188
|
+
...resolvedHeaders,
|
|
1189
|
+
...init.headers
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
async function callRaw(res) {
|
|
1194
|
+
if (!res.ok) {
|
|
1195
|
+
let message = fallbackMessage(res.status);
|
|
1196
|
+
try {
|
|
1197
|
+
const body = await res.json();
|
|
1198
|
+
if (body.error) message = body.error;
|
|
1199
|
+
} catch {
|
|
1200
|
+
}
|
|
1201
|
+
throw new TerrantulaError(res.status, { error: message });
|
|
1202
|
+
}
|
|
1203
|
+
return res.json();
|
|
1204
|
+
}
|
|
1205
|
+
function createObservationsClient(baseUrl, hcOpts) {
|
|
1206
|
+
return {
|
|
1207
|
+
/**
|
|
1208
|
+
* POST /{orgId}/{projectId}/envs/{envName}/import
|
|
1209
|
+
*
|
|
1210
|
+
* Persists a full observation snapshot (resources + dependency edges)
|
|
1211
|
+
* for a given environment. Requires `data:write` permission.
|
|
1212
|
+
*/
|
|
1213
|
+
importPayload: withSchema(
|
|
1214
|
+
ObservationImportPayloadSchema.extend({
|
|
1215
|
+
orgId: z10.string().describe("Organization slug"),
|
|
1216
|
+
projectId: z10.string().describe("Project ID"),
|
|
1217
|
+
envName: z10.string().describe("Environment name")
|
|
1218
|
+
}),
|
|
1219
|
+
async (params) => {
|
|
1220
|
+
const { orgId, projectId, envName, ...body } = params;
|
|
1221
|
+
return callRaw(
|
|
1222
|
+
await rawRequest(
|
|
1223
|
+
baseUrl,
|
|
1224
|
+
hcOpts,
|
|
1225
|
+
`/${orgId}/${projectId}/envs/${envName}/import`,
|
|
1226
|
+
{
|
|
1227
|
+
method: "POST",
|
|
1228
|
+
headers: { "Content-Type": "application/json" },
|
|
1229
|
+
body: JSON.stringify(body)
|
|
1230
|
+
}
|
|
1231
|
+
)
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
)
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// src/github.ts
|
|
1239
|
+
import { z as z11 } from "zod";
|
|
1168
1240
|
function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
1169
1241
|
return {
|
|
1170
1242
|
connect: withSchema(
|
|
1171
|
-
|
|
1172
|
-
projectId:
|
|
1243
|
+
z11.object({
|
|
1244
|
+
projectId: z11.string().describe("Project name")
|
|
1173
1245
|
}),
|
|
1174
1246
|
// why: the install-url route has a "GitHub App not configured" branch
|
|
1175
1247
|
// that returns a bare `new Response(...)` (see notConfiguredResponse in
|
|
@@ -1179,14 +1251,14 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1179
1251
|
),
|
|
1180
1252
|
installations: {
|
|
1181
1253
|
list: withSchema(
|
|
1182
|
-
|
|
1183
|
-
orgId:
|
|
1254
|
+
z11.object({
|
|
1255
|
+
orgId: z11.string().describe("Organization slug")
|
|
1184
1256
|
}),
|
|
1185
1257
|
(params) => call(cloud.github.installations.$get({ query: params }))
|
|
1186
1258
|
),
|
|
1187
1259
|
repos: withSchema(
|
|
1188
|
-
|
|
1189
|
-
installationId:
|
|
1260
|
+
z11.object({
|
|
1261
|
+
installationId: z11.string().describe("Installation row ID")
|
|
1190
1262
|
}),
|
|
1191
1263
|
(params) => call(
|
|
1192
1264
|
cloud.github.installations[":installationId"].repos.$get({
|
|
@@ -1195,8 +1267,8 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1195
1267
|
)
|
|
1196
1268
|
),
|
|
1197
1269
|
disconnect: withSchema(
|
|
1198
|
-
|
|
1199
|
-
installationId:
|
|
1270
|
+
z11.object({
|
|
1271
|
+
installationId: z11.string().describe("Installation row ID")
|
|
1200
1272
|
}),
|
|
1201
1273
|
(params) => call(
|
|
1202
1274
|
cloud.github.installations[":installationId"].$delete({
|
|
@@ -1205,9 +1277,9 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1205
1277
|
)
|
|
1206
1278
|
),
|
|
1207
1279
|
recover: withSchema(
|
|
1208
|
-
|
|
1209
|
-
orgId:
|
|
1210
|
-
installationId:
|
|
1280
|
+
z11.object({
|
|
1281
|
+
orgId: z11.string().describe("Organization slug"),
|
|
1282
|
+
installationId: z11.number().int().positive().describe("GitHub installation ID (from the GitHub install URL)")
|
|
1211
1283
|
}),
|
|
1212
1284
|
// why: same bare-Response inference break as `connect` (the route's
|
|
1213
1285
|
// not-configured branch returns `new Response(...)`), so the 200 body
|
|
@@ -1217,9 +1289,9 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1217
1289
|
},
|
|
1218
1290
|
projects: {
|
|
1219
1291
|
list: withSchema(
|
|
1220
|
-
|
|
1221
|
-
orgId:
|
|
1222
|
-
projectId:
|
|
1292
|
+
z11.object({
|
|
1293
|
+
orgId: z11.string().describe("Organization slug"),
|
|
1294
|
+
projectId: z11.string().describe("Project name")
|
|
1223
1295
|
}),
|
|
1224
1296
|
(params) => call(
|
|
1225
1297
|
cloud.orgs[":orgId"].projects[":projectId"]["github-repos"].$get({
|
|
@@ -1228,11 +1300,11 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1228
1300
|
)
|
|
1229
1301
|
),
|
|
1230
1302
|
linkRepo: withSchema(
|
|
1231
|
-
|
|
1232
|
-
orgId:
|
|
1233
|
-
projectId:
|
|
1234
|
-
installationId:
|
|
1235
|
-
repoFullName:
|
|
1303
|
+
z11.object({
|
|
1304
|
+
orgId: z11.string().describe("Organization slug"),
|
|
1305
|
+
projectId: z11.string().describe("Project name"),
|
|
1306
|
+
installationId: z11.string().describe("github_installations.id (UUID)"),
|
|
1307
|
+
repoFullName: z11.string().describe('GitHub repo "owner/name"')
|
|
1236
1308
|
}),
|
|
1237
1309
|
(params) => {
|
|
1238
1310
|
const { orgId, projectId, ...body } = params;
|
|
@@ -1245,10 +1317,10 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1245
1317
|
}
|
|
1246
1318
|
),
|
|
1247
1319
|
unlinkRepo: withSchema(
|
|
1248
|
-
|
|
1249
|
-
orgId:
|
|
1250
|
-
projectId:
|
|
1251
|
-
id:
|
|
1320
|
+
z11.object({
|
|
1321
|
+
orgId: z11.string().describe("Organization slug"),
|
|
1322
|
+
projectId: z11.string().describe("Project name"),
|
|
1323
|
+
id: z11.string().describe("project_github_repos.id (UUID) \u2014 returned by linkRepo")
|
|
1252
1324
|
}),
|
|
1253
1325
|
(params) => call(
|
|
1254
1326
|
cloud.orgs[":orgId"].projects[":projectId"]["github-repos"][":id"].$delete({
|
|
@@ -1261,23 +1333,23 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
|
|
|
1261
1333
|
}
|
|
1262
1334
|
|
|
1263
1335
|
// src/blueprints.ts
|
|
1264
|
-
import { z as
|
|
1265
|
-
var SpinInputSchema =
|
|
1266
|
-
orgId:
|
|
1267
|
-
blueprint:
|
|
1268
|
-
substrate:
|
|
1269
|
-
repo:
|
|
1270
|
-
prBase:
|
|
1271
|
-
githubToken:
|
|
1272
|
-
createRepo:
|
|
1273
|
-
createWorkspace:
|
|
1274
|
-
vars:
|
|
1336
|
+
import { z as z12 } from "zod";
|
|
1337
|
+
var SpinInputSchema = z12.object({
|
|
1338
|
+
orgId: z12.string().describe("Organization slug"),
|
|
1339
|
+
blueprint: z12.string().describe("First-party blueprint name (e.g. k8s-fleet)"),
|
|
1340
|
+
substrate: z12.enum(["bare-tf", "tfc", "atmos"]).optional(),
|
|
1341
|
+
repo: z12.string().optional().describe("owner/repo to open the spin PR into (omit when createRepo is set)"),
|
|
1342
|
+
prBase: z12.string().optional(),
|
|
1343
|
+
githubToken: z12.string().optional(),
|
|
1344
|
+
createRepo: z12.object({ name: z12.string(), private: z12.boolean().optional() }).optional().describe("Cloud opt-in: auto-create the target GitHub repo before spinning"),
|
|
1345
|
+
createWorkspace: z12.object({ organization: z12.string(), name: z12.string(), apiToken: z12.string(), apiBaseUrl: z12.string().optional() }).optional().describe("Cloud opt-in: auto-create the TFC workspace shell before spinning"),
|
|
1346
|
+
vars: z12.record(z12.string()).default({})
|
|
1275
1347
|
});
|
|
1276
1348
|
function createBlueprintsClient(cloud) {
|
|
1277
1349
|
return {
|
|
1278
1350
|
list: () => call(cloud.blueprints.$get()),
|
|
1279
1351
|
get: withSchema(
|
|
1280
|
-
|
|
1352
|
+
z12.object({ name: z12.string().describe("Blueprint name") }),
|
|
1281
1353
|
(params) => call(cloud.blueprints[":name"].$get({ param: params }))
|
|
1282
1354
|
),
|
|
1283
1355
|
spin: withSchema(SpinInputSchema, (params) => {
|
|
@@ -1288,7 +1360,7 @@ function createBlueprintsClient(cloud) {
|
|
|
1288
1360
|
}
|
|
1289
1361
|
|
|
1290
1362
|
// src/export.ts
|
|
1291
|
-
import { z as
|
|
1363
|
+
import { z as z13 } from "zod";
|
|
1292
1364
|
var SERVER_FIELDS = /* @__PURE__ */ new Set(["id", "projectId", "envId", "createdAt", "updatedAt"]);
|
|
1293
1365
|
function stripServerFields(row) {
|
|
1294
1366
|
const out = {};
|
|
@@ -1299,10 +1371,10 @@ function stripServerFields(row) {
|
|
|
1299
1371
|
}
|
|
1300
1372
|
function createExportCatalogFn(proj, projEnv) {
|
|
1301
1373
|
return withSchema(
|
|
1302
|
-
|
|
1303
|
-
orgId:
|
|
1304
|
-
projectId:
|
|
1305
|
-
envName:
|
|
1374
|
+
z13.object({
|
|
1375
|
+
orgId: z13.string().describe("Organization slug"),
|
|
1376
|
+
projectId: z13.string().describe("Project ID"),
|
|
1377
|
+
envName: z13.string().describe("Environment name to export secret declarations from")
|
|
1306
1378
|
}).describe("Export every catalog kind as a single apply-shaped payload"),
|
|
1307
1379
|
async (params) => {
|
|
1308
1380
|
const projClient = proj(params.orgId, params.projectId);
|
|
@@ -1352,15 +1424,15 @@ function createExportCatalogFn(proj, projEnv) {
|
|
|
1352
1424
|
}
|
|
1353
1425
|
|
|
1354
1426
|
// src/catalog-revisions.ts
|
|
1355
|
-
import { z as
|
|
1427
|
+
import { z as z14 } from "zod";
|
|
1356
1428
|
function createCatalogRevisionsClient(proj) {
|
|
1357
1429
|
return {
|
|
1358
1430
|
list: withSchema(
|
|
1359
|
-
|
|
1360
|
-
orgId:
|
|
1361
|
-
projectId:
|
|
1362
|
-
limit:
|
|
1363
|
-
before:
|
|
1431
|
+
z14.object({
|
|
1432
|
+
orgId: z14.string().describe("Organization slug"),
|
|
1433
|
+
projectId: z14.string().describe("Project ID"),
|
|
1434
|
+
limit: z14.coerce.number().int().min(1).max(200).optional().describe("Max revisions to return (1-200)"),
|
|
1435
|
+
before: z14.string().datetime().optional().describe("ISO timestamp; only revisions with appliedAt strictly before this are returned (keyset upper-bound)")
|
|
1364
1436
|
}),
|
|
1365
1437
|
(params) => {
|
|
1366
1438
|
const { orgId, projectId, ...query } = params;
|
|
@@ -1370,20 +1442,20 @@ function createCatalogRevisionsClient(proj) {
|
|
|
1370
1442
|
}
|
|
1371
1443
|
),
|
|
1372
1444
|
get: withSchema(
|
|
1373
|
-
|
|
1374
|
-
orgId:
|
|
1375
|
-
projectId:
|
|
1376
|
-
id:
|
|
1445
|
+
z14.object({
|
|
1446
|
+
orgId: z14.string().describe("Organization slug"),
|
|
1447
|
+
projectId: z14.string().describe("Project ID"),
|
|
1448
|
+
id: z14.string().uuid().describe("Revision ID")
|
|
1377
1449
|
}),
|
|
1378
1450
|
(params) => call(
|
|
1379
1451
|
proj(params.orgId, params.projectId)["catalog-revisions"][":id"].$get({ param: { id: params.id } })
|
|
1380
1452
|
)
|
|
1381
1453
|
),
|
|
1382
1454
|
snapshots: withSchema(
|
|
1383
|
-
|
|
1384
|
-
orgId:
|
|
1385
|
-
projectId:
|
|
1386
|
-
id:
|
|
1455
|
+
z14.object({
|
|
1456
|
+
orgId: z14.string().describe("Organization slug"),
|
|
1457
|
+
projectId: z14.string().describe("Project ID"),
|
|
1458
|
+
id: z14.string().uuid().describe("Revision ID to read snapshots for")
|
|
1387
1459
|
}),
|
|
1388
1460
|
(params) => call(
|
|
1389
1461
|
proj(params.orgId, params.projectId)["catalog-revisions"][":id"]["snapshots"].$get({
|
|
@@ -1397,12 +1469,12 @@ function createCatalogRevisionsClient(proj) {
|
|
|
1397
1469
|
* `force: true`, mirroring POST /apply.
|
|
1398
1470
|
*/
|
|
1399
1471
|
rollback: withSchema(
|
|
1400
|
-
|
|
1401
|
-
orgId:
|
|
1402
|
-
projectId:
|
|
1403
|
-
id:
|
|
1404
|
-
hunkId:
|
|
1405
|
-
force:
|
|
1472
|
+
z14.object({
|
|
1473
|
+
orgId: z14.string().describe("Organization slug"),
|
|
1474
|
+
projectId: z14.string().describe("Project ID"),
|
|
1475
|
+
id: z14.string().uuid().describe("Revision ID to roll back to"),
|
|
1476
|
+
hunkId: z14.string().uuid().optional().describe("Single-hunk filter"),
|
|
1477
|
+
force: z14.boolean().optional().describe("Required if the inverse diff is destructive")
|
|
1406
1478
|
}),
|
|
1407
1479
|
(params) => {
|
|
1408
1480
|
const { orgId, projectId, id, hunkId, force } = params;
|
|
@@ -1419,21 +1491,21 @@ function createCatalogRevisionsClient(proj) {
|
|
|
1419
1491
|
}
|
|
1420
1492
|
|
|
1421
1493
|
// src/audit-events.ts
|
|
1422
|
-
import { z as
|
|
1494
|
+
import { z as z15 } from "zod";
|
|
1423
1495
|
function createAuditEventsClient(proj) {
|
|
1424
1496
|
return {
|
|
1425
1497
|
list: withSchema(
|
|
1426
|
-
|
|
1427
|
-
orgId:
|
|
1428
|
-
projectId:
|
|
1429
|
-
envName:
|
|
1430
|
-
actorType:
|
|
1431
|
-
actorId:
|
|
1432
|
-
action:
|
|
1433
|
-
resourceKind:
|
|
1434
|
-
since:
|
|
1435
|
-
before:
|
|
1436
|
-
limit:
|
|
1498
|
+
z15.object({
|
|
1499
|
+
orgId: z15.string().describe("Organization slug"),
|
|
1500
|
+
projectId: z15.string().describe("Project name"),
|
|
1501
|
+
envName: z15.string().optional().describe("Filter to a single env"),
|
|
1502
|
+
actorType: z15.enum(["user", "token"]).optional().describe("Filter by actor type"),
|
|
1503
|
+
actorId: z15.string().optional().describe("Filter by actor (user.id or apikey.id)"),
|
|
1504
|
+
action: z15.string().optional().describe('Comma-separated actions (e.g. "create,delete")'),
|
|
1505
|
+
resourceKind: z15.string().optional().describe("Filter to one resource kind (Entity | Token | Member | \u2026)"),
|
|
1506
|
+
since: z15.string().datetime().optional().describe("ISO timestamp; only events strictly after this are returned"),
|
|
1507
|
+
before: z15.string().datetime().optional().describe("ISO timestamp; only events strictly before this are returned (keyset upper-bound)"),
|
|
1508
|
+
limit: z15.coerce.number().int().min(1).max(500).optional().describe("Max rows (1-500)")
|
|
1437
1509
|
}).describe("List audit events for a project \u2014 auditor-friendly read-only feed"),
|
|
1438
1510
|
(params) => {
|
|
1439
1511
|
const { orgId, projectId, ...query } = params;
|
|
@@ -1444,21 +1516,21 @@ function createAuditEventsClient(proj) {
|
|
|
1444
1516
|
}
|
|
1445
1517
|
|
|
1446
1518
|
// src/environments.ts
|
|
1447
|
-
import { z as
|
|
1519
|
+
import { z as z16 } from "zod";
|
|
1448
1520
|
function createEnvironmentsClient(proj) {
|
|
1449
1521
|
return {
|
|
1450
1522
|
list: withSchema(
|
|
1451
|
-
|
|
1452
|
-
orgId:
|
|
1453
|
-
projectId:
|
|
1523
|
+
z16.object({
|
|
1524
|
+
orgId: z16.string().describe("Organization slug"),
|
|
1525
|
+
projectId: z16.string().describe("Project name")
|
|
1454
1526
|
}),
|
|
1455
1527
|
(params) => call(proj(params.orgId, params.projectId)["environments"].$get())
|
|
1456
1528
|
),
|
|
1457
1529
|
create: withSchema(
|
|
1458
|
-
|
|
1459
|
-
orgId:
|
|
1460
|
-
projectId:
|
|
1461
|
-
name:
|
|
1530
|
+
z16.object({
|
|
1531
|
+
orgId: z16.string().describe("Organization slug"),
|
|
1532
|
+
projectId: z16.string().describe("Project name"),
|
|
1533
|
+
name: z16.string().min(1).max(31).regex(/^[a-z0-9][a-z0-9-]{0,30}$/).describe("Environment name (lowercase letters, digits, hyphens; max 31 chars)")
|
|
1462
1534
|
}),
|
|
1463
1535
|
(params) => {
|
|
1464
1536
|
const { orgId, projectId, name } = params;
|
|
@@ -1466,10 +1538,10 @@ function createEnvironmentsClient(proj) {
|
|
|
1466
1538
|
}
|
|
1467
1539
|
),
|
|
1468
1540
|
delete: withSchema(
|
|
1469
|
-
|
|
1470
|
-
orgId:
|
|
1471
|
-
projectId:
|
|
1472
|
-
name:
|
|
1541
|
+
z16.object({
|
|
1542
|
+
orgId: z16.string().describe("Organization slug"),
|
|
1543
|
+
projectId: z16.string().describe("Project name"),
|
|
1544
|
+
name: z16.string().describe("Environment name")
|
|
1473
1545
|
}),
|
|
1474
1546
|
(params) => call(
|
|
1475
1547
|
proj(params.orgId, params.projectId)["environments"][":envName"].$delete({
|
|
@@ -1481,20 +1553,20 @@ function createEnvironmentsClient(proj) {
|
|
|
1481
1553
|
}
|
|
1482
1554
|
|
|
1483
1555
|
// src/drift-events.ts
|
|
1484
|
-
import { z as
|
|
1556
|
+
import { z as z17 } from "zod";
|
|
1485
1557
|
function createDriftEventsClient(projEnv) {
|
|
1486
1558
|
return {
|
|
1487
1559
|
list: withSchema(
|
|
1488
|
-
|
|
1489
|
-
orgId:
|
|
1490
|
-
projectId:
|
|
1491
|
-
envName:
|
|
1492
|
-
status:
|
|
1493
|
-
kind:
|
|
1494
|
-
entityName:
|
|
1495
|
-
since:
|
|
1496
|
-
before:
|
|
1497
|
-
limit:
|
|
1560
|
+
z17.object({
|
|
1561
|
+
orgId: z17.string().describe("Organization slug"),
|
|
1562
|
+
projectId: z17.string().describe("Project name"),
|
|
1563
|
+
envName: z17.string().describe("Environment name"),
|
|
1564
|
+
status: z17.enum(["open", "accepted", "reapplied", "snoozed"]).optional(),
|
|
1565
|
+
kind: z17.string().optional().describe("Filter by entity type name"),
|
|
1566
|
+
entityName: z17.string().optional().describe("Filter by entity name"),
|
|
1567
|
+
since: z17.string().optional().describe("ISO timestamp lower bound on detectedAt"),
|
|
1568
|
+
before: z17.string().datetime().optional().describe("ISO timestamp upper bound on detectedAt (keyset cursor)"),
|
|
1569
|
+
limit: z17.coerce.number().int().min(1).max(500).optional()
|
|
1498
1570
|
}),
|
|
1499
1571
|
(params) => {
|
|
1500
1572
|
const { orgId, projectId, envName, ...query } = params;
|
|
@@ -1504,19 +1576,19 @@ function createDriftEventsClient(projEnv) {
|
|
|
1504
1576
|
}
|
|
1505
1577
|
),
|
|
1506
1578
|
count: withSchema(
|
|
1507
|
-
|
|
1508
|
-
orgId:
|
|
1509
|
-
projectId:
|
|
1510
|
-
envName:
|
|
1579
|
+
z17.object({
|
|
1580
|
+
orgId: z17.string().describe("Organization slug"),
|
|
1581
|
+
projectId: z17.string().describe("Project name"),
|
|
1582
|
+
envName: z17.string().describe("Environment name")
|
|
1511
1583
|
}),
|
|
1512
1584
|
(params) => call(projEnv(params.orgId, params.projectId, params.envName)["drift-events"].count.$get())
|
|
1513
1585
|
),
|
|
1514
1586
|
get: withSchema(
|
|
1515
|
-
|
|
1516
|
-
orgId:
|
|
1517
|
-
projectId:
|
|
1518
|
-
envName:
|
|
1519
|
-
id:
|
|
1587
|
+
z17.object({
|
|
1588
|
+
orgId: z17.string().describe("Organization slug"),
|
|
1589
|
+
projectId: z17.string().describe("Project name"),
|
|
1590
|
+
envName: z17.string().describe("Environment name"),
|
|
1591
|
+
id: z17.string().uuid()
|
|
1520
1592
|
}),
|
|
1521
1593
|
(params) => call(
|
|
1522
1594
|
projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].$get({
|
|
@@ -1525,11 +1597,11 @@ function createDriftEventsClient(projEnv) {
|
|
|
1525
1597
|
)
|
|
1526
1598
|
),
|
|
1527
1599
|
accept: withSchema(
|
|
1528
|
-
|
|
1529
|
-
orgId:
|
|
1530
|
-
projectId:
|
|
1531
|
-
envName:
|
|
1532
|
-
id:
|
|
1600
|
+
z17.object({
|
|
1601
|
+
orgId: z17.string().describe("Organization slug"),
|
|
1602
|
+
projectId: z17.string().describe("Project name"),
|
|
1603
|
+
envName: z17.string().describe("Environment name"),
|
|
1604
|
+
id: z17.string().uuid()
|
|
1533
1605
|
}),
|
|
1534
1606
|
(params) => call(
|
|
1535
1607
|
projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].accept.$post({
|
|
@@ -1538,11 +1610,11 @@ function createDriftEventsClient(projEnv) {
|
|
|
1538
1610
|
)
|
|
1539
1611
|
),
|
|
1540
1612
|
reapply: withSchema(
|
|
1541
|
-
|
|
1542
|
-
orgId:
|
|
1543
|
-
projectId:
|
|
1544
|
-
envName:
|
|
1545
|
-
id:
|
|
1613
|
+
z17.object({
|
|
1614
|
+
orgId: z17.string().describe("Organization slug"),
|
|
1615
|
+
projectId: z17.string().describe("Project name"),
|
|
1616
|
+
envName: z17.string().describe("Environment name"),
|
|
1617
|
+
id: z17.string().uuid()
|
|
1546
1618
|
}),
|
|
1547
1619
|
(params) => call(
|
|
1548
1620
|
projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].reapply.$post({
|
|
@@ -1551,12 +1623,12 @@ function createDriftEventsClient(projEnv) {
|
|
|
1551
1623
|
)
|
|
1552
1624
|
),
|
|
1553
1625
|
snooze: withSchema(
|
|
1554
|
-
|
|
1555
|
-
orgId:
|
|
1556
|
-
projectId:
|
|
1557
|
-
envName:
|
|
1558
|
-
id:
|
|
1559
|
-
untilSeconds:
|
|
1626
|
+
z17.object({
|
|
1627
|
+
orgId: z17.string().describe("Organization slug"),
|
|
1628
|
+
projectId: z17.string().describe("Project name"),
|
|
1629
|
+
envName: z17.string().describe("Environment name"),
|
|
1630
|
+
id: z17.string().uuid(),
|
|
1631
|
+
untilSeconds: z17.number().int().positive().optional()
|
|
1560
1632
|
}),
|
|
1561
1633
|
(params) => call(
|
|
1562
1634
|
projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].snooze.$post({
|
|
@@ -1569,21 +1641,21 @@ function createDriftEventsClient(projEnv) {
|
|
|
1569
1641
|
}
|
|
1570
1642
|
|
|
1571
1643
|
// src/conformance-findings.ts
|
|
1572
|
-
import { z as
|
|
1644
|
+
import { z as z18 } from "zod";
|
|
1573
1645
|
import { FindingStatusSchema, FindingSeveritySchema } from "@terrantula/types";
|
|
1574
1646
|
function createConformanceFindingsClient(projEnv) {
|
|
1575
1647
|
return {
|
|
1576
1648
|
list: withSchema(
|
|
1577
|
-
|
|
1578
|
-
orgId:
|
|
1579
|
-
projectId:
|
|
1580
|
-
envName:
|
|
1649
|
+
z18.object({
|
|
1650
|
+
orgId: z18.string().describe("Organization slug"),
|
|
1651
|
+
projectId: z18.string().describe("Project name"),
|
|
1652
|
+
envName: z18.string().describe("Environment name"),
|
|
1581
1653
|
status: FindingStatusSchema.optional(),
|
|
1582
1654
|
severity: FindingSeveritySchema.optional(),
|
|
1583
|
-
kind:
|
|
1584
|
-
findingKind:
|
|
1585
|
-
entityName:
|
|
1586
|
-
limit:
|
|
1655
|
+
kind: z18.string().optional().describe("Filter by entity type name"),
|
|
1656
|
+
findingKind: z18.string().optional().describe("Filter by finding kind (e.g. MISSING_REQUIRED_PROPERTY)"),
|
|
1657
|
+
entityName: z18.string().optional().describe("Filter by entity name"),
|
|
1658
|
+
limit: z18.coerce.number().int().min(1).max(500).optional()
|
|
1587
1659
|
}),
|
|
1588
1660
|
(params) => {
|
|
1589
1661
|
const { orgId, projectId, envName, ...query } = params;
|
|
@@ -1593,19 +1665,19 @@ function createConformanceFindingsClient(projEnv) {
|
|
|
1593
1665
|
}
|
|
1594
1666
|
),
|
|
1595
1667
|
count: withSchema(
|
|
1596
|
-
|
|
1597
|
-
orgId:
|
|
1598
|
-
projectId:
|
|
1599
|
-
envName:
|
|
1668
|
+
z18.object({
|
|
1669
|
+
orgId: z18.string().describe("Organization slug"),
|
|
1670
|
+
projectId: z18.string().describe("Project name"),
|
|
1671
|
+
envName: z18.string().describe("Environment name")
|
|
1600
1672
|
}),
|
|
1601
1673
|
(params) => call(projEnv(params.orgId, params.projectId, params.envName)["conformance-findings"].count.$get())
|
|
1602
1674
|
),
|
|
1603
1675
|
get: withSchema(
|
|
1604
|
-
|
|
1605
|
-
orgId:
|
|
1606
|
-
projectId:
|
|
1607
|
-
envName:
|
|
1608
|
-
id:
|
|
1676
|
+
z18.object({
|
|
1677
|
+
orgId: z18.string().describe("Organization slug"),
|
|
1678
|
+
projectId: z18.string().describe("Project name"),
|
|
1679
|
+
envName: z18.string().describe("Environment name"),
|
|
1680
|
+
id: z18.string().uuid()
|
|
1609
1681
|
}),
|
|
1610
1682
|
(params) => call(
|
|
1611
1683
|
projEnv(params.orgId, params.projectId, params.envName)["conformance-findings"][":id"].$get({
|
|
@@ -1617,15 +1689,15 @@ function createConformanceFindingsClient(projEnv) {
|
|
|
1617
1689
|
}
|
|
1618
1690
|
|
|
1619
1691
|
// src/stats.ts
|
|
1620
|
-
import { z as
|
|
1621
|
-
var WindowSchema =
|
|
1622
|
-
var BucketSchema =
|
|
1692
|
+
import { z as z19 } from "zod";
|
|
1693
|
+
var WindowSchema = z19.enum(["1h", "24h", "7d"]).optional().describe("Time window \u2014 default 24h");
|
|
1694
|
+
var BucketSchema = z19.enum(["1m", "5m", "1h", "1d"]).optional().describe("Bucket granularity \u2014 default 1h");
|
|
1623
1695
|
function createStatsClient(proj) {
|
|
1624
1696
|
return {
|
|
1625
1697
|
entitiesByState: withSchema(
|
|
1626
|
-
|
|
1627
|
-
orgId:
|
|
1628
|
-
projectId:
|
|
1698
|
+
z19.object({
|
|
1699
|
+
orgId: z19.string().describe("Organization slug"),
|
|
1700
|
+
projectId: z19.string().describe("Project name"),
|
|
1629
1701
|
window: WindowSchema,
|
|
1630
1702
|
bucket: BucketSchema
|
|
1631
1703
|
}),
|
|
@@ -1635,9 +1707,9 @@ function createStatsClient(proj) {
|
|
|
1635
1707
|
}
|
|
1636
1708
|
),
|
|
1637
1709
|
runsByType: withSchema(
|
|
1638
|
-
|
|
1639
|
-
orgId:
|
|
1640
|
-
projectId:
|
|
1710
|
+
z19.object({
|
|
1711
|
+
orgId: z19.string().describe("Organization slug"),
|
|
1712
|
+
projectId: z19.string().describe("Project name"),
|
|
1641
1713
|
window: WindowSchema
|
|
1642
1714
|
}),
|
|
1643
1715
|
(params) => {
|
|
@@ -1646,9 +1718,9 @@ function createStatsClient(proj) {
|
|
|
1646
1718
|
}
|
|
1647
1719
|
),
|
|
1648
1720
|
failingKinds: withSchema(
|
|
1649
|
-
|
|
1650
|
-
orgId:
|
|
1651
|
-
projectId:
|
|
1721
|
+
z19.object({
|
|
1722
|
+
orgId: z19.string().describe("Organization slug"),
|
|
1723
|
+
projectId: z19.string().describe("Project name"),
|
|
1652
1724
|
window: WindowSchema
|
|
1653
1725
|
}),
|
|
1654
1726
|
(params) => {
|
|
@@ -1657,10 +1729,10 @@ function createStatsClient(proj) {
|
|
|
1657
1729
|
}
|
|
1658
1730
|
),
|
|
1659
1731
|
driftDensity: withSchema(
|
|
1660
|
-
|
|
1661
|
-
orgId:
|
|
1662
|
-
projectId:
|
|
1663
|
-
dim:
|
|
1732
|
+
z19.object({
|
|
1733
|
+
orgId: z19.string().describe("Organization slug"),
|
|
1734
|
+
projectId: z19.string().describe("Project name"),
|
|
1735
|
+
dim: z19.string().optional().describe('Dimensions to bucket \u2014 e.g. "kind,cell"')
|
|
1664
1736
|
}),
|
|
1665
1737
|
(params) => {
|
|
1666
1738
|
const { orgId, projectId, ...query } = params;
|
|
@@ -1671,32 +1743,32 @@ function createStatsClient(proj) {
|
|
|
1671
1743
|
}
|
|
1672
1744
|
|
|
1673
1745
|
// src/graph-views.ts
|
|
1674
|
-
import { z as
|
|
1675
|
-
var PinnedPositionsSchema =
|
|
1676
|
-
var ViewSpecSchema =
|
|
1746
|
+
import { z as z20 } from "zod";
|
|
1747
|
+
var PinnedPositionsSchema = z20.record(z20.string(), z20.object({ x: z20.number(), y: z20.number() })).nullable();
|
|
1748
|
+
var ViewSpecSchema = z20.unknown().nullable();
|
|
1677
1749
|
function createGraphViewsClient(proj) {
|
|
1678
1750
|
return {
|
|
1679
1751
|
list: withSchema(
|
|
1680
|
-
|
|
1681
|
-
orgId:
|
|
1682
|
-
projectId:
|
|
1752
|
+
z20.object({
|
|
1753
|
+
orgId: z20.string().describe("Organization slug"),
|
|
1754
|
+
projectId: z20.string().describe("Project ID")
|
|
1683
1755
|
}),
|
|
1684
1756
|
(params) => call(proj(params.orgId, params.projectId)["graph-views"].$get())
|
|
1685
1757
|
),
|
|
1686
1758
|
get: withSchema(
|
|
1687
|
-
|
|
1688
|
-
orgId:
|
|
1689
|
-
projectId:
|
|
1690
|
-
id:
|
|
1759
|
+
z20.object({
|
|
1760
|
+
orgId: z20.string().describe("Organization slug"),
|
|
1761
|
+
projectId: z20.string().describe("Project ID"),
|
|
1762
|
+
id: z20.string().describe("View id")
|
|
1691
1763
|
}),
|
|
1692
1764
|
(params) => call(proj(params.orgId, params.projectId)["graph-views"][":id"].$get({ param: { id: params.id } }))
|
|
1693
1765
|
),
|
|
1694
1766
|
create: withSchema(
|
|
1695
|
-
|
|
1696
|
-
orgId:
|
|
1697
|
-
projectId:
|
|
1698
|
-
name:
|
|
1699
|
-
scope:
|
|
1767
|
+
z20.object({
|
|
1768
|
+
orgId: z20.string().describe("Organization slug"),
|
|
1769
|
+
projectId: z20.string().describe("Project ID"),
|
|
1770
|
+
name: z20.string().describe("View name"),
|
|
1771
|
+
scope: z20.enum(["user", "project"]).describe("Personal or project scope"),
|
|
1700
1772
|
pinnedPositions: PinnedPositionsSchema.optional().describe("Pinned node positions"),
|
|
1701
1773
|
viewSpec: ViewSpecSchema.optional().describe("ViewSpec JSON (opaque passthrough)")
|
|
1702
1774
|
}),
|
|
@@ -1706,11 +1778,11 @@ function createGraphViewsClient(proj) {
|
|
|
1706
1778
|
}
|
|
1707
1779
|
),
|
|
1708
1780
|
update: withSchema(
|
|
1709
|
-
|
|
1710
|
-
orgId:
|
|
1711
|
-
projectId:
|
|
1712
|
-
id:
|
|
1713
|
-
name:
|
|
1781
|
+
z20.object({
|
|
1782
|
+
orgId: z20.string().describe("Organization slug"),
|
|
1783
|
+
projectId: z20.string().describe("Project ID"),
|
|
1784
|
+
id: z20.string().describe("View id"),
|
|
1785
|
+
name: z20.string().optional().describe("New name"),
|
|
1714
1786
|
pinnedPositions: PinnedPositionsSchema.optional().describe("Replacement pinned positions"),
|
|
1715
1787
|
viewSpec: ViewSpecSchema.optional().describe("Replacement ViewSpec JSON (opaque passthrough)")
|
|
1716
1788
|
}),
|
|
@@ -1722,18 +1794,18 @@ function createGraphViewsClient(proj) {
|
|
|
1722
1794
|
}
|
|
1723
1795
|
),
|
|
1724
1796
|
delete: withSchema(
|
|
1725
|
-
|
|
1726
|
-
orgId:
|
|
1727
|
-
projectId:
|
|
1728
|
-
id:
|
|
1797
|
+
z20.object({
|
|
1798
|
+
orgId: z20.string().describe("Organization slug"),
|
|
1799
|
+
projectId: z20.string().describe("Project ID"),
|
|
1800
|
+
id: z20.string().describe("View id")
|
|
1729
1801
|
}),
|
|
1730
1802
|
(params) => call(proj(params.orgId, params.projectId)["graph-views"][":id"].$delete({ param: { id: params.id } }))
|
|
1731
1803
|
),
|
|
1732
1804
|
setDefault: withSchema(
|
|
1733
|
-
|
|
1734
|
-
orgId:
|
|
1735
|
-
projectId:
|
|
1736
|
-
id:
|
|
1805
|
+
z20.object({
|
|
1806
|
+
orgId: z20.string().describe("Organization slug"),
|
|
1807
|
+
projectId: z20.string().describe("Project ID"),
|
|
1808
|
+
id: z20.string().describe("View id")
|
|
1737
1809
|
}),
|
|
1738
1810
|
(params) => call(
|
|
1739
1811
|
proj(params.orgId, params.projectId)["graph-views"][":id"]["default"].$patch({
|
|
@@ -1745,15 +1817,15 @@ function createGraphViewsClient(proj) {
|
|
|
1745
1817
|
}
|
|
1746
1818
|
|
|
1747
1819
|
// src/notifications.ts
|
|
1748
|
-
import { z as
|
|
1820
|
+
import { z as z21 } from "zod";
|
|
1749
1821
|
import { hc as hc2 } from "hono/client";
|
|
1750
1822
|
function createNotificationsClient(baseUrl, hcOpts) {
|
|
1751
1823
|
const c = hc2(`${baseUrl}/notifications`, hcOpts);
|
|
1752
1824
|
return {
|
|
1753
1825
|
list: withSchema(
|
|
1754
|
-
|
|
1755
|
-
limit:
|
|
1756
|
-
unread:
|
|
1826
|
+
z21.object({
|
|
1827
|
+
limit: z21.coerce.number().int().min(1).max(100).optional(),
|
|
1828
|
+
unread: z21.boolean().optional()
|
|
1757
1829
|
}),
|
|
1758
1830
|
(params) => {
|
|
1759
1831
|
const query = {};
|
|
@@ -1763,19 +1835,19 @@ function createNotificationsClient(baseUrl, hcOpts) {
|
|
|
1763
1835
|
}
|
|
1764
1836
|
),
|
|
1765
1837
|
read: withSchema(
|
|
1766
|
-
|
|
1838
|
+
z21.object({ id: z21.string().uuid() }),
|
|
1767
1839
|
(params) => call(c[":id"].read.$post({ param: { id: params.id } }))
|
|
1768
1840
|
),
|
|
1769
1841
|
readAll: withSchema(
|
|
1770
|
-
|
|
1842
|
+
z21.object({}),
|
|
1771
1843
|
() => call(c["read-all"].$post())
|
|
1772
1844
|
)
|
|
1773
1845
|
};
|
|
1774
1846
|
}
|
|
1775
1847
|
|
|
1776
1848
|
// src/audit-export.ts
|
|
1777
|
-
import { z as
|
|
1778
|
-
async function
|
|
1849
|
+
import { z as z22 } from "zod";
|
|
1850
|
+
async function rawRequest2(baseUrl, hcOpts, path, init = {}) {
|
|
1779
1851
|
const fetchImpl = hcOpts?.fetch ?? fetch;
|
|
1780
1852
|
const rawHeaders = hcOpts?.headers;
|
|
1781
1853
|
const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
|
|
@@ -1787,7 +1859,7 @@ async function rawRequest(baseUrl, hcOpts, path, init = {}) {
|
|
|
1787
1859
|
}
|
|
1788
1860
|
});
|
|
1789
1861
|
}
|
|
1790
|
-
async function
|
|
1862
|
+
async function callRaw2(res) {
|
|
1791
1863
|
if (!res.ok) {
|
|
1792
1864
|
let message = fallbackMessage(res.status);
|
|
1793
1865
|
try {
|
|
@@ -1803,24 +1875,24 @@ function createAuditExportClient(baseUrl, hcOpts) {
|
|
|
1803
1875
|
return {
|
|
1804
1876
|
/** GET /orgs/:orgId/audit-export/config — returns current config or throws 404. */
|
|
1805
1877
|
getConfig: withSchema(
|
|
1806
|
-
|
|
1807
|
-
async (params) =>
|
|
1808
|
-
await
|
|
1878
|
+
z22.object({ orgId: z22.string().describe("Organization ID") }),
|
|
1879
|
+
async (params) => callRaw2(
|
|
1880
|
+
await rawRequest2(baseUrl, hcOpts, `/orgs/${params.orgId}/audit-export/config`)
|
|
1809
1881
|
)
|
|
1810
1882
|
),
|
|
1811
1883
|
/** POST /orgs/:orgId/audit-export/config — upsert the S3 export config. */
|
|
1812
1884
|
setConfig: withSchema(
|
|
1813
|
-
|
|
1814
|
-
orgId:
|
|
1815
|
-
bucket:
|
|
1816
|
-
region:
|
|
1817
|
-
roleArn:
|
|
1818
|
-
enabled:
|
|
1885
|
+
z22.object({
|
|
1886
|
+
orgId: z22.string().describe("Organization ID"),
|
|
1887
|
+
bucket: z22.string().describe("S3 bucket name"),
|
|
1888
|
+
region: z22.string().describe("AWS region"),
|
|
1889
|
+
roleArn: z22.string().describe("IAM role ARN for assume-role"),
|
|
1890
|
+
enabled: z22.boolean().optional().describe("Enable/disable export")
|
|
1819
1891
|
}),
|
|
1820
1892
|
async (params) => {
|
|
1821
1893
|
const { orgId, ...body } = params;
|
|
1822
|
-
return
|
|
1823
|
-
await
|
|
1894
|
+
return callRaw2(
|
|
1895
|
+
await rawRequest2(baseUrl, hcOpts, `/orgs/${orgId}/audit-export/config`, {
|
|
1824
1896
|
method: "POST",
|
|
1825
1897
|
headers: { "Content-Type": "application/json" },
|
|
1826
1898
|
body: JSON.stringify(body)
|
|
@@ -1830,16 +1902,16 @@ function createAuditExportClient(baseUrl, hcOpts) {
|
|
|
1830
1902
|
),
|
|
1831
1903
|
/** POST /orgs/:orgId/audit-export/test-connection — dry-run write+delete. */
|
|
1832
1904
|
testConnection: withSchema(
|
|
1833
|
-
|
|
1834
|
-
orgId:
|
|
1835
|
-
bucket:
|
|
1836
|
-
region:
|
|
1837
|
-
roleArn:
|
|
1905
|
+
z22.object({
|
|
1906
|
+
orgId: z22.string().describe("Organization ID"),
|
|
1907
|
+
bucket: z22.string().describe("S3 bucket name"),
|
|
1908
|
+
region: z22.string().describe("AWS region"),
|
|
1909
|
+
roleArn: z22.string().describe("IAM role ARN for assume-role")
|
|
1838
1910
|
}),
|
|
1839
1911
|
async (params) => {
|
|
1840
1912
|
const { orgId, ...body } = params;
|
|
1841
|
-
return
|
|
1842
|
-
await
|
|
1913
|
+
return callRaw2(
|
|
1914
|
+
await rawRequest2(baseUrl, hcOpts, `/orgs/${orgId}/audit-export/test-connection`, {
|
|
1843
1915
|
method: "POST",
|
|
1844
1916
|
headers: { "Content-Type": "application/json" },
|
|
1845
1917
|
body: JSON.stringify(body)
|
|
@@ -1849,14 +1921,14 @@ function createAuditExportClient(baseUrl, hcOpts) {
|
|
|
1849
1921
|
),
|
|
1850
1922
|
/** GET /orgs/:orgId/audit-export/runs — recent batch run history. */
|
|
1851
1923
|
listRuns: withSchema(
|
|
1852
|
-
|
|
1853
|
-
orgId:
|
|
1854
|
-
limit:
|
|
1924
|
+
z22.object({
|
|
1925
|
+
orgId: z22.string().describe("Organization ID"),
|
|
1926
|
+
limit: z22.number().optional().describe("Max results (default 20, max 100)")
|
|
1855
1927
|
}),
|
|
1856
1928
|
async (params) => {
|
|
1857
1929
|
const qs = params.limit ? `?limit=${params.limit}` : "";
|
|
1858
|
-
return
|
|
1859
|
-
await
|
|
1930
|
+
return callRaw2(
|
|
1931
|
+
await rawRequest2(
|
|
1860
1932
|
baseUrl,
|
|
1861
1933
|
hcOpts,
|
|
1862
1934
|
`/orgs/${params.orgId}/audit-export/runs${qs}`
|
|
@@ -1895,33 +1967,33 @@ function createUserPreferencesClient(baseUrl, hcOpts) {
|
|
|
1895
1967
|
}
|
|
1896
1968
|
|
|
1897
1969
|
// src/import-sources.ts
|
|
1898
|
-
import { z as
|
|
1899
|
-
var SourceKindEnum =
|
|
1900
|
-
var PolicyEnum =
|
|
1970
|
+
import { z as z23 } from "zod";
|
|
1971
|
+
var SourceKindEnum = z23.enum(["tf-state", "atmos-manifests"]);
|
|
1972
|
+
var PolicyEnum = z23.enum(["auto-update", "human-approval"]);
|
|
1901
1973
|
function createImportSourcesClient(proj) {
|
|
1902
1974
|
return {
|
|
1903
1975
|
list: withSchema(
|
|
1904
|
-
|
|
1905
|
-
orgId:
|
|
1906
|
-
projectId:
|
|
1976
|
+
z23.object({
|
|
1977
|
+
orgId: z23.string().describe("Organization slug"),
|
|
1978
|
+
projectId: z23.string().describe("Project ID")
|
|
1907
1979
|
}),
|
|
1908
1980
|
(params) => call(proj(params.orgId, params.projectId)["import-sources"].$get())
|
|
1909
1981
|
),
|
|
1910
1982
|
get: withSchema(
|
|
1911
|
-
|
|
1912
|
-
orgId:
|
|
1913
|
-
projectId:
|
|
1914
|
-
id:
|
|
1983
|
+
z23.object({
|
|
1984
|
+
orgId: z23.string().describe("Organization slug"),
|
|
1985
|
+
projectId: z23.string().describe("Project ID"),
|
|
1986
|
+
id: z23.string().uuid().describe("ImportSource ID")
|
|
1915
1987
|
}),
|
|
1916
1988
|
(params) => call(proj(params.orgId, params.projectId)["import-sources"][":id"].$get({ param: { id: params.id } }))
|
|
1917
1989
|
),
|
|
1918
1990
|
registerOrUpdate: withSchema(
|
|
1919
|
-
|
|
1920
|
-
orgId:
|
|
1921
|
-
projectId:
|
|
1922
|
-
envName:
|
|
1991
|
+
z23.object({
|
|
1992
|
+
orgId: z23.string().describe("Organization slug"),
|
|
1993
|
+
projectId: z23.string().describe("Project ID"),
|
|
1994
|
+
envName: z23.string().describe("Env name the source belongs to"),
|
|
1923
1995
|
sourceKind: SourceKindEnum,
|
|
1924
|
-
sourceUri:
|
|
1996
|
+
sourceUri: z23.string().describe("Stable URI identifying the source"),
|
|
1925
1997
|
reconciliationPolicy: PolicyEnum.optional()
|
|
1926
1998
|
}),
|
|
1927
1999
|
(params) => {
|
|
@@ -1930,13 +2002,13 @@ function createImportSourcesClient(proj) {
|
|
|
1930
2002
|
}
|
|
1931
2003
|
),
|
|
1932
2004
|
rescan: withSchema(
|
|
1933
|
-
|
|
1934
|
-
orgId:
|
|
1935
|
-
projectId:
|
|
1936
|
-
id:
|
|
1937
|
-
envName:
|
|
1938
|
-
items:
|
|
1939
|
-
deletions:
|
|
2005
|
+
z23.object({
|
|
2006
|
+
orgId: z23.string().describe("Organization slug"),
|
|
2007
|
+
projectId: z23.string().describe("Project ID"),
|
|
2008
|
+
id: z23.string().uuid(),
|
|
2009
|
+
envName: z23.string(),
|
|
2010
|
+
items: z23.array(z23.unknown()),
|
|
2011
|
+
deletions: z23.array(z23.object({ kind: z23.string(), name: z23.string() })).optional()
|
|
1940
2012
|
}),
|
|
1941
2013
|
(params) => {
|
|
1942
2014
|
const { orgId, projectId, id, ...body } = params;
|
|
@@ -1952,19 +2024,19 @@ function createImportSourcesClient(proj) {
|
|
|
1952
2024
|
}
|
|
1953
2025
|
),
|
|
1954
2026
|
drift: withSchema(
|
|
1955
|
-
|
|
1956
|
-
orgId:
|
|
1957
|
-
projectId:
|
|
1958
|
-
id:
|
|
2027
|
+
z23.object({
|
|
2028
|
+
orgId: z23.string().describe("Organization slug"),
|
|
2029
|
+
projectId: z23.string().describe("Project ID"),
|
|
2030
|
+
id: z23.string().uuid()
|
|
1959
2031
|
}),
|
|
1960
2032
|
(params) => call(proj(params.orgId, params.projectId)["import-sources"][":id"].drift.$get({ param: { id: params.id } }))
|
|
1961
2033
|
),
|
|
1962
2034
|
approveProposal: withSchema(
|
|
1963
|
-
|
|
1964
|
-
orgId:
|
|
1965
|
-
projectId:
|
|
1966
|
-
id:
|
|
1967
|
-
proposalId:
|
|
2035
|
+
z23.object({
|
|
2036
|
+
orgId: z23.string().describe("Organization slug"),
|
|
2037
|
+
projectId: z23.string().describe("Project ID"),
|
|
2038
|
+
id: z23.string().uuid(),
|
|
2039
|
+
proposalId: z23.string().uuid()
|
|
1968
2040
|
}),
|
|
1969
2041
|
(params) => call(
|
|
1970
2042
|
proj(params.orgId, params.projectId)["import-sources"][":id"]["drift-proposals"][":proposalId"].approve.$post({
|
|
@@ -1973,11 +2045,11 @@ function createImportSourcesClient(proj) {
|
|
|
1973
2045
|
)
|
|
1974
2046
|
),
|
|
1975
2047
|
rejectProposal: withSchema(
|
|
1976
|
-
|
|
1977
|
-
orgId:
|
|
1978
|
-
projectId:
|
|
1979
|
-
id:
|
|
1980
|
-
proposalId:
|
|
2048
|
+
z23.object({
|
|
2049
|
+
orgId: z23.string().describe("Organization slug"),
|
|
2050
|
+
projectId: z23.string().describe("Project ID"),
|
|
2051
|
+
id: z23.string().uuid(),
|
|
2052
|
+
proposalId: z23.string().uuid()
|
|
1981
2053
|
}),
|
|
1982
2054
|
(params) => call(
|
|
1983
2055
|
proj(params.orgId, params.projectId)["import-sources"][":id"]["drift-proposals"][":proposalId"].reject.$post({
|
|
@@ -1989,8 +2061,8 @@ function createImportSourcesClient(proj) {
|
|
|
1989
2061
|
}
|
|
1990
2062
|
|
|
1991
2063
|
// src/admin.ts
|
|
1992
|
-
import { z as
|
|
1993
|
-
async function
|
|
2064
|
+
import { z as z24 } from "zod";
|
|
2065
|
+
async function rawRequest3(baseUrl, hcOpts, path, init = {}) {
|
|
1994
2066
|
const fetchImpl = hcOpts?.fetch ?? fetch;
|
|
1995
2067
|
const rawHeaders = hcOpts?.headers;
|
|
1996
2068
|
const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
|
|
@@ -2002,7 +2074,7 @@ async function rawRequest2(baseUrl, hcOpts, path, init = {}) {
|
|
|
2002
2074
|
}
|
|
2003
2075
|
});
|
|
2004
2076
|
}
|
|
2005
|
-
async function
|
|
2077
|
+
async function callRaw3(res) {
|
|
2006
2078
|
if (!res.ok) {
|
|
2007
2079
|
let message = fallbackMessage(res.status);
|
|
2008
2080
|
try {
|
|
@@ -2022,14 +2094,14 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2022
2094
|
* List super-admin audit events with optional filters.
|
|
2023
2095
|
*/
|
|
2024
2096
|
list: withSchema(
|
|
2025
|
-
|
|
2026
|
-
actor:
|
|
2027
|
-
action:
|
|
2028
|
-
resourceKind:
|
|
2029
|
-
since:
|
|
2030
|
-
until:
|
|
2031
|
-
limit:
|
|
2032
|
-
offset:
|
|
2097
|
+
z24.object({
|
|
2098
|
+
actor: z24.string().optional().describe("Filter by actor user ID"),
|
|
2099
|
+
action: z24.string().optional().describe("Filter by action name"),
|
|
2100
|
+
resourceKind: z24.string().optional().describe("Filter by resource kind"),
|
|
2101
|
+
since: z24.string().optional().describe("ISO 8601 datetime lower bound"),
|
|
2102
|
+
until: z24.string().optional().describe("ISO 8601 datetime upper bound"),
|
|
2103
|
+
limit: z24.coerce.number().int().min(1).max(200).optional().describe("Max results (1-200)"),
|
|
2104
|
+
offset: z24.coerce.number().int().min(0).optional().describe("Pagination offset")
|
|
2033
2105
|
}),
|
|
2034
2106
|
async (params) => {
|
|
2035
2107
|
const qs = new URLSearchParams();
|
|
@@ -2041,8 +2113,8 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2041
2113
|
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
2042
2114
|
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
2043
2115
|
const search = qs.toString();
|
|
2044
|
-
return
|
|
2045
|
-
await
|
|
2116
|
+
return callRaw3(
|
|
2117
|
+
await rawRequest3(baseUrl, hcOpts, `/admin/audit${search ? `?${search}` : ""}`)
|
|
2046
2118
|
);
|
|
2047
2119
|
}
|
|
2048
2120
|
)
|
|
@@ -2053,9 +2125,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2053
2125
|
* List all organizations across tenants with member + project counts.
|
|
2054
2126
|
*/
|
|
2055
2127
|
list: withSchema(
|
|
2056
|
-
|
|
2057
|
-
async () =>
|
|
2058
|
-
await
|
|
2128
|
+
z24.object({}),
|
|
2129
|
+
async () => callRaw3(
|
|
2130
|
+
await rawRequest3(baseUrl, hcOpts, "/admin/orgs")
|
|
2059
2131
|
)
|
|
2060
2132
|
),
|
|
2061
2133
|
/**
|
|
@@ -2063,9 +2135,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2063
2135
|
* Detail view: org fields + member list + project list.
|
|
2064
2136
|
*/
|
|
2065
2137
|
get: withSchema(
|
|
2066
|
-
|
|
2067
|
-
async (params) =>
|
|
2068
|
-
await
|
|
2138
|
+
z24.object({ id: z24.string().describe("Organization ID") }),
|
|
2139
|
+
async (params) => callRaw3(
|
|
2140
|
+
await rawRequest3(baseUrl, hcOpts, `/admin/orgs/${params.id}`)
|
|
2069
2141
|
)
|
|
2070
2142
|
),
|
|
2071
2143
|
/**
|
|
@@ -2073,9 +2145,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2073
2145
|
* Set suspended_at = now(). Idempotent.
|
|
2074
2146
|
*/
|
|
2075
2147
|
suspend: withSchema(
|
|
2076
|
-
|
|
2077
|
-
async (params) =>
|
|
2078
|
-
await
|
|
2148
|
+
z24.object({ id: z24.string().describe("Organization ID") }),
|
|
2149
|
+
async (params) => callRaw3(
|
|
2150
|
+
await rawRequest3(baseUrl, hcOpts, `/admin/orgs/${params.id}/suspend`, {
|
|
2079
2151
|
method: "POST"
|
|
2080
2152
|
})
|
|
2081
2153
|
)
|
|
@@ -2085,9 +2157,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2085
2157
|
* Clear suspended_at.
|
|
2086
2158
|
*/
|
|
2087
2159
|
unsuspend: withSchema(
|
|
2088
|
-
|
|
2089
|
-
async (params) =>
|
|
2090
|
-
await
|
|
2160
|
+
z24.object({ id: z24.string().describe("Organization ID") }),
|
|
2161
|
+
async (params) => callRaw3(
|
|
2162
|
+
await rawRequest3(baseUrl, hcOpts, `/admin/orgs/${params.id}/unsuspend`, {
|
|
2091
2163
|
method: "POST"
|
|
2092
2164
|
})
|
|
2093
2165
|
)
|
|
@@ -2101,9 +2173,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2101
2173
|
* api tokens, and environments. Idempotent. Super-admin only.
|
|
2102
2174
|
*/
|
|
2103
2175
|
nuke: withSchema(
|
|
2104
|
-
|
|
2105
|
-
async (params) =>
|
|
2106
|
-
await
|
|
2176
|
+
z24.object({ projectId: z24.string().describe("Project ID to nuke") }),
|
|
2177
|
+
async (params) => callRaw3(
|
|
2178
|
+
await rawRequest3(
|
|
2107
2179
|
baseUrl,
|
|
2108
2180
|
hcOpts,
|
|
2109
2181
|
`/admin/projects/${encodeURIComponent(params.projectId)}/nuke`,
|
|
@@ -2119,9 +2191,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2119
2191
|
* all derived from single-table COUNT queries.
|
|
2120
2192
|
*/
|
|
2121
2193
|
overview: withSchema(
|
|
2122
|
-
|
|
2123
|
-
async () =>
|
|
2124
|
-
await
|
|
2194
|
+
z24.object({}),
|
|
2195
|
+
async () => callRaw3(
|
|
2196
|
+
await rawRequest3(baseUrl, hcOpts, "/admin/metrics/overview")
|
|
2125
2197
|
)
|
|
2126
2198
|
)
|
|
2127
2199
|
},
|
|
@@ -2134,9 +2206,9 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2134
2206
|
* Requires super-admin.
|
|
2135
2207
|
*/
|
|
2136
2208
|
list: withSchema(
|
|
2137
|
-
|
|
2138
|
-
async () =>
|
|
2139
|
-
await
|
|
2209
|
+
z24.object({}),
|
|
2210
|
+
async () => callRaw3(
|
|
2211
|
+
await rawRequest3(
|
|
2140
2212
|
baseUrl,
|
|
2141
2213
|
hcOpts,
|
|
2142
2214
|
"/admin/integrations/github-installations"
|
|
@@ -2149,15 +2221,15 @@ function createAdminClient(baseUrl, hcOpts) {
|
|
|
2149
2221
|
}
|
|
2150
2222
|
|
|
2151
2223
|
// src/resolve-source.ts
|
|
2152
|
-
import { z as
|
|
2224
|
+
import { z as z25 } from "zod";
|
|
2153
2225
|
function createResolveSourceFn(proj) {
|
|
2154
2226
|
return withSchema(
|
|
2155
|
-
|
|
2156
|
-
orgId:
|
|
2157
|
-
projectId:
|
|
2158
|
-
kind:
|
|
2159
|
-
ref:
|
|
2160
|
-
version:
|
|
2227
|
+
z25.object({
|
|
2228
|
+
orgId: z25.string().describe("Organization slug"),
|
|
2229
|
+
projectId: z25.string().describe("Project ID"),
|
|
2230
|
+
kind: z25.literal("registry").describe('Source kind \u2014 only "registry" is supported today'),
|
|
2231
|
+
ref: z25.string().regex(/^[^/]+\/[^/]+\/[^/]+$/, { message: "ref must be <namespace>/<name>/<provider>" }).describe("Terraform Registry module ref (<namespace>/<name>/<provider>)"),
|
|
2232
|
+
version: z25.string().optional().describe("Module version semver \u2014 resolves latest if omitted")
|
|
2161
2233
|
}),
|
|
2162
2234
|
(params) => {
|
|
2163
2235
|
const { orgId, projectId, kind, ref, version } = params;
|
|
@@ -2198,6 +2270,7 @@ var createClient = (baseUrl, options = {}) => {
|
|
|
2198
2270
|
actionRuns: createActionRunsClient(projEnv),
|
|
2199
2271
|
secrets: createSecretsClient(projEnv),
|
|
2200
2272
|
apply: createApplyClient(projEnv),
|
|
2273
|
+
observations: createObservationsClient(baseUrl, hcOpts),
|
|
2201
2274
|
catalogRevisions,
|
|
2202
2275
|
auditEvents: createAuditEventsClient(proj),
|
|
2203
2276
|
driftEvents: createDriftEventsClient(projEnv),
|