@terrantula/sdk 0.1.0 → 0.2.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/{audit-export-BJSNZ9ic.d.mts → audit-export-BtZTnt8a.d.mts} +51 -1
- package/dist/{audit-export-BJSNZ9ic.d.ts → audit-export-BtZTnt8a.d.ts} +51 -1
- package/dist/{chunk-KOGEUSRZ.mjs → chunk-WYOV3M2X.mjs} +110 -1
- package/dist/index.d.mts +74 -5
- package/dist/index.d.ts +74 -5
- package/dist/index.js +110 -1
- package/dist/index.mjs +1 -1
- package/dist/local.d.mts +61 -3
- package/dist/local.d.ts +61 -3
- package/dist/local.js +110 -1
- package/dist/local.mjs +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,56 @@ declare function withSchema<S extends z.ZodObject<z.ZodRawShape>, R>(schema: S,
|
|
|
13
13
|
/** A static token string or a (possibly async) factory that returns one. */
|
|
14
14
|
type TokenSource = string | (() => string | Promise<string>);
|
|
15
15
|
|
|
16
|
+
interface AdminAuditEvent {
|
|
17
|
+
id: string;
|
|
18
|
+
actorUserId: string;
|
|
19
|
+
action: string;
|
|
20
|
+
resourceKind: string;
|
|
21
|
+
resourceId: string | null;
|
|
22
|
+
metadata: unknown;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
}
|
|
25
|
+
interface AdminAuditListResponse {
|
|
26
|
+
data: AdminAuditEvent[];
|
|
27
|
+
total: number;
|
|
28
|
+
limit: number;
|
|
29
|
+
offset: number;
|
|
30
|
+
}
|
|
31
|
+
interface AdminOrgSummary {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
suspendedAt: string | null;
|
|
37
|
+
memberCount: number;
|
|
38
|
+
projectCount: number;
|
|
39
|
+
}
|
|
40
|
+
interface AdminOrgMember {
|
|
41
|
+
userId: string;
|
|
42
|
+
email: string;
|
|
43
|
+
username: string | null;
|
|
44
|
+
name: string | null;
|
|
45
|
+
role: string;
|
|
46
|
+
joinedAt: string;
|
|
47
|
+
}
|
|
48
|
+
interface AdminOrgProject {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
slug: string;
|
|
52
|
+
createdAt: string;
|
|
53
|
+
}
|
|
54
|
+
interface AdminOrgDetail extends AdminOrgSummary {
|
|
55
|
+
members: AdminOrgMember[];
|
|
56
|
+
projects: AdminOrgProject[];
|
|
57
|
+
}
|
|
58
|
+
interface AdminOrgListResponse {
|
|
59
|
+
data: AdminOrgSummary[];
|
|
60
|
+
}
|
|
61
|
+
interface AdminSuspendResponse {
|
|
62
|
+
id: string;
|
|
63
|
+
suspendedAt: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
16
66
|
type SnapshotOp = 'created' | 'updated' | 'deleted' | 'unchanged' | 'failed';
|
|
17
67
|
|
|
18
68
|
interface ExportedItem {
|
|
@@ -53,4 +103,4 @@ interface TestConnectionResponse {
|
|
|
53
103
|
error?: string;
|
|
54
104
|
}
|
|
55
105
|
|
|
56
|
-
export { type AuditExportConfigResponse as A, type ExportCatalogResult as E, type SnapshotOp as S, type TokenSource as T, type SchemaFn as a, type TestConnectionResponse as b, type AuditExportRunResponse as c,
|
|
106
|
+
export { type AuditExportConfigResponse as A, type ExportCatalogResult as E, type SnapshotOp as S, type TokenSource as T, type SchemaFn as a, type TestConnectionResponse as b, type AuditExportRunResponse as c, type AdminAuditListResponse as d, type AdminOrgListResponse as e, type AdminOrgDetail as f, type AdminSuspendResponse as g, type AdminAuditEvent as h, type AdminOrgMember as i, type AdminOrgProject as j, type AdminOrgSummary as k, TerrantulaError as l, withSchema as w };
|
|
@@ -13,6 +13,56 @@ declare function withSchema<S extends z.ZodObject<z.ZodRawShape>, R>(schema: S,
|
|
|
13
13
|
/** A static token string or a (possibly async) factory that returns one. */
|
|
14
14
|
type TokenSource = string | (() => string | Promise<string>);
|
|
15
15
|
|
|
16
|
+
interface AdminAuditEvent {
|
|
17
|
+
id: string;
|
|
18
|
+
actorUserId: string;
|
|
19
|
+
action: string;
|
|
20
|
+
resourceKind: string;
|
|
21
|
+
resourceId: string | null;
|
|
22
|
+
metadata: unknown;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
}
|
|
25
|
+
interface AdminAuditListResponse {
|
|
26
|
+
data: AdminAuditEvent[];
|
|
27
|
+
total: number;
|
|
28
|
+
limit: number;
|
|
29
|
+
offset: number;
|
|
30
|
+
}
|
|
31
|
+
interface AdminOrgSummary {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
suspendedAt: string | null;
|
|
37
|
+
memberCount: number;
|
|
38
|
+
projectCount: number;
|
|
39
|
+
}
|
|
40
|
+
interface AdminOrgMember {
|
|
41
|
+
userId: string;
|
|
42
|
+
email: string;
|
|
43
|
+
username: string | null;
|
|
44
|
+
name: string | null;
|
|
45
|
+
role: string;
|
|
46
|
+
joinedAt: string;
|
|
47
|
+
}
|
|
48
|
+
interface AdminOrgProject {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
slug: string;
|
|
52
|
+
createdAt: string;
|
|
53
|
+
}
|
|
54
|
+
interface AdminOrgDetail extends AdminOrgSummary {
|
|
55
|
+
members: AdminOrgMember[];
|
|
56
|
+
projects: AdminOrgProject[];
|
|
57
|
+
}
|
|
58
|
+
interface AdminOrgListResponse {
|
|
59
|
+
data: AdminOrgSummary[];
|
|
60
|
+
}
|
|
61
|
+
interface AdminSuspendResponse {
|
|
62
|
+
id: string;
|
|
63
|
+
suspendedAt: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
16
66
|
type SnapshotOp = 'created' | 'updated' | 'deleted' | 'unchanged' | 'failed';
|
|
17
67
|
|
|
18
68
|
interface ExportedItem {
|
|
@@ -53,4 +103,4 @@ interface TestConnectionResponse {
|
|
|
53
103
|
error?: string;
|
|
54
104
|
}
|
|
55
105
|
|
|
56
|
-
export { type AuditExportConfigResponse as A, type ExportCatalogResult as E, type SnapshotOp as S, type TokenSource as T, type SchemaFn as a, type TestConnectionResponse as b, type AuditExportRunResponse as c,
|
|
106
|
+
export { type AuditExportConfigResponse as A, type ExportCatalogResult as E, type SnapshotOp as S, type TokenSource as T, type SchemaFn as a, type TestConnectionResponse as b, type AuditExportRunResponse as c, type AdminAuditListResponse as d, type AdminOrgListResponse as e, type AdminOrgDetail as f, type AdminSuspendResponse as g, type AdminAuditEvent as h, type AdminOrgMember as i, type AdminOrgProject as j, type AdminOrgSummary as k, TerrantulaError as l, withSchema as w };
|
|
@@ -1515,6 +1515,114 @@ function createImportSourcesClient(proj) {
|
|
|
1515
1515
|
};
|
|
1516
1516
|
}
|
|
1517
1517
|
|
|
1518
|
+
// src/admin.ts
|
|
1519
|
+
import { z as z18 } from "zod";
|
|
1520
|
+
async function rawRequest2(baseUrl, hcOpts, path, init = {}) {
|
|
1521
|
+
const fetchImpl = hcOpts?.fetch ?? fetch;
|
|
1522
|
+
const rawHeaders = hcOpts?.headers;
|
|
1523
|
+
const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
|
|
1524
|
+
return fetchImpl(`${baseUrl}${path}`, {
|
|
1525
|
+
...init,
|
|
1526
|
+
headers: {
|
|
1527
|
+
...resolvedHeaders,
|
|
1528
|
+
...init.headers
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
async function callRaw2(res) {
|
|
1533
|
+
if (!res.ok) {
|
|
1534
|
+
let message = fallbackMessage(res.status);
|
|
1535
|
+
try {
|
|
1536
|
+
const body = await res.json();
|
|
1537
|
+
if (body.error) message = body.error;
|
|
1538
|
+
} catch {
|
|
1539
|
+
}
|
|
1540
|
+
throw new TerrantulaError(res.status, { error: message });
|
|
1541
|
+
}
|
|
1542
|
+
return res.json();
|
|
1543
|
+
}
|
|
1544
|
+
function createAdminClient(baseUrl, hcOpts) {
|
|
1545
|
+
return {
|
|
1546
|
+
audit: {
|
|
1547
|
+
/**
|
|
1548
|
+
* GET /admin/audit
|
|
1549
|
+
* List super-admin audit events with optional filters.
|
|
1550
|
+
*/
|
|
1551
|
+
list: withSchema(
|
|
1552
|
+
z18.object({
|
|
1553
|
+
actor: z18.string().optional().describe("Filter by actor user ID"),
|
|
1554
|
+
action: z18.string().optional().describe("Filter by action name"),
|
|
1555
|
+
resourceKind: z18.string().optional().describe("Filter by resource kind"),
|
|
1556
|
+
since: z18.string().optional().describe("ISO 8601 datetime lower bound"),
|
|
1557
|
+
until: z18.string().optional().describe("ISO 8601 datetime upper bound"),
|
|
1558
|
+
limit: z18.coerce.number().int().min(1).max(200).optional().describe("Max results (1-200)"),
|
|
1559
|
+
offset: z18.coerce.number().int().min(0).optional().describe("Pagination offset")
|
|
1560
|
+
}),
|
|
1561
|
+
async (params) => {
|
|
1562
|
+
const qs = new URLSearchParams();
|
|
1563
|
+
if (params.actor !== void 0) qs.set("actor", params.actor);
|
|
1564
|
+
if (params.action !== void 0) qs.set("action", params.action);
|
|
1565
|
+
if (params.resourceKind !== void 0) qs.set("resourceKind", params.resourceKind);
|
|
1566
|
+
if (params.since !== void 0) qs.set("since", params.since);
|
|
1567
|
+
if (params.until !== void 0) qs.set("until", params.until);
|
|
1568
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1569
|
+
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
1570
|
+
const search = qs.toString();
|
|
1571
|
+
return callRaw2(
|
|
1572
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/audit${search ? `?${search}` : ""}`)
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
)
|
|
1576
|
+
},
|
|
1577
|
+
orgs: {
|
|
1578
|
+
/**
|
|
1579
|
+
* GET /admin/orgs
|
|
1580
|
+
* List all organizations across tenants with member + project counts.
|
|
1581
|
+
*/
|
|
1582
|
+
list: withSchema(
|
|
1583
|
+
z18.object({}),
|
|
1584
|
+
async () => callRaw2(
|
|
1585
|
+
await rawRequest2(baseUrl, hcOpts, "/admin/orgs")
|
|
1586
|
+
)
|
|
1587
|
+
),
|
|
1588
|
+
/**
|
|
1589
|
+
* GET /admin/orgs/:id
|
|
1590
|
+
* Detail view: org fields + member list + project list.
|
|
1591
|
+
*/
|
|
1592
|
+
get: withSchema(
|
|
1593
|
+
z18.object({ id: z18.string().describe("Organization ID") }),
|
|
1594
|
+
async (params) => callRaw2(
|
|
1595
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}`)
|
|
1596
|
+
)
|
|
1597
|
+
),
|
|
1598
|
+
/**
|
|
1599
|
+
* POST /admin/orgs/:id/suspend
|
|
1600
|
+
* Set suspended_at = now(). Idempotent.
|
|
1601
|
+
*/
|
|
1602
|
+
suspend: withSchema(
|
|
1603
|
+
z18.object({ id: z18.string().describe("Organization ID") }),
|
|
1604
|
+
async (params) => callRaw2(
|
|
1605
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/suspend`, {
|
|
1606
|
+
method: "POST"
|
|
1607
|
+
})
|
|
1608
|
+
)
|
|
1609
|
+
),
|
|
1610
|
+
/**
|
|
1611
|
+
* POST /admin/orgs/:id/unsuspend
|
|
1612
|
+
* Clear suspended_at.
|
|
1613
|
+
*/
|
|
1614
|
+
unsuspend: withSchema(
|
|
1615
|
+
z18.object({ id: z18.string().describe("Organization ID") }),
|
|
1616
|
+
async (params) => callRaw2(
|
|
1617
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/unsuspend`, {
|
|
1618
|
+
method: "POST"
|
|
1619
|
+
})
|
|
1620
|
+
)
|
|
1621
|
+
)
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1518
1626
|
// src/index.ts
|
|
1519
1627
|
var createClient = (baseUrl, options = {}) => {
|
|
1520
1628
|
const opts = typeof options === "string" || typeof options === "function" ? { token: options } : options;
|
|
@@ -1549,7 +1657,8 @@ var createClient = (baseUrl, options = {}) => {
|
|
|
1549
1657
|
auditExport: createAuditExportClient(baseUrl, hcOpts),
|
|
1550
1658
|
userPreferences: createUserPreferencesClient(baseUrl, hcOpts),
|
|
1551
1659
|
importSources: createImportSourcesClient(proj),
|
|
1552
|
-
exportCatalog
|
|
1660
|
+
exportCatalog,
|
|
1661
|
+
admin: createAdminClient(baseUrl, hcOpts)
|
|
1553
1662
|
};
|
|
1554
1663
|
let warnedPools = false;
|
|
1555
1664
|
let warnedApplyRevisions = false;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SnapshotOp, T as TokenSource, a as SchemaFn, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult } from './audit-export-
|
|
2
|
-
export {
|
|
1
|
+
import { S as SnapshotOp, T as TokenSource, a as SchemaFn, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult, d as AdminAuditListResponse, e as AdminOrgListResponse, f as AdminOrgDetail, g as AdminSuspendResponse } from './audit-export-BtZTnt8a.mjs';
|
|
2
|
+
export { h as AdminAuditEvent, i as AdminOrgMember, j as AdminOrgProject, k as AdminOrgSummary, l as TerrantulaError, w as withSchema } from './audit-export-BtZTnt8a.mjs';
|
|
3
3
|
import * as _terrantula_types from '@terrantula/types';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import * as hono_hono_base from 'hono/hono-base';
|
|
@@ -75,6 +75,12 @@ type AppVariables = {
|
|
|
75
75
|
* ignored (no scoping).
|
|
76
76
|
*/
|
|
77
77
|
cellKey?: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Set by requireSuperAdmin middleware. True when the authenticated user
|
|
80
|
+
* has role='admin' (control-plane super-admin). Never set to false —
|
|
81
|
+
* absence means the check has not run or the user is not an admin.
|
|
82
|
+
*/
|
|
83
|
+
isSuperAdmin?: boolean;
|
|
78
84
|
};
|
|
79
85
|
|
|
80
86
|
/**
|
|
@@ -4811,6 +4817,7 @@ declare function _cloudAppShape(): hono_hono_base.HonoBase<hono_types.BlankEnv,
|
|
|
4811
4817
|
deletedAt: string | null;
|
|
4812
4818
|
logo: string | null;
|
|
4813
4819
|
metadata: string | null;
|
|
4820
|
+
suspendedAt: string | null;
|
|
4814
4821
|
};
|
|
4815
4822
|
outputFormat: "json";
|
|
4816
4823
|
status: 201;
|
|
@@ -4843,6 +4850,7 @@ declare function _cloudAppShape(): hono_hono_base.HonoBase<hono_types.BlankEnv,
|
|
|
4843
4850
|
createdAt: string;
|
|
4844
4851
|
metadata: string | null;
|
|
4845
4852
|
deletedAt: string | null;
|
|
4853
|
+
suspendedAt: string | null;
|
|
4846
4854
|
};
|
|
4847
4855
|
outputFormat: "json";
|
|
4848
4856
|
status: hono_utils_http_status.ContentfulStatusCode;
|
|
@@ -4940,6 +4948,9 @@ declare function _cloudAppShape(): hono_hono_base.HonoBase<hono_types.BlankEnv,
|
|
|
4940
4948
|
createdAt: string;
|
|
4941
4949
|
updatedAt: string;
|
|
4942
4950
|
deletedAt: string | null;
|
|
4951
|
+
banned: boolean;
|
|
4952
|
+
banReason: string | null;
|
|
4953
|
+
banExpires: string | null;
|
|
4943
4954
|
};
|
|
4944
4955
|
outputFormat: "json";
|
|
4945
4956
|
status: 201;
|
|
@@ -6083,6 +6094,7 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6083
6094
|
deletedAt: string | null;
|
|
6084
6095
|
logo: string | null;
|
|
6085
6096
|
metadata: string | null;
|
|
6097
|
+
suspendedAt: string | null;
|
|
6086
6098
|
}>;
|
|
6087
6099
|
get: SchemaFn<zod.ZodObject<{
|
|
6088
6100
|
id: zod.ZodString;
|
|
@@ -6100,6 +6112,7 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6100
6112
|
createdAt: string;
|
|
6101
6113
|
metadata: string | null;
|
|
6102
6114
|
deletedAt: string | null;
|
|
6115
|
+
suspendedAt: string | null;
|
|
6103
6116
|
}>;
|
|
6104
6117
|
listUsers: SchemaFn<zod.ZodObject<{
|
|
6105
6118
|
id: zod.ZodString;
|
|
@@ -6147,6 +6160,9 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6147
6160
|
createdAt: string;
|
|
6148
6161
|
updatedAt: string;
|
|
6149
6162
|
deletedAt: string | null;
|
|
6163
|
+
banned: boolean;
|
|
6164
|
+
banReason: string | null;
|
|
6165
|
+
banExpires: string | null;
|
|
6150
6166
|
}>;
|
|
6151
6167
|
updateUserRole: SchemaFn<zod.ZodObject<{
|
|
6152
6168
|
id: zod.ZodString;
|
|
@@ -6154,12 +6170,12 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6154
6170
|
role: zod.ZodEnum<["owner", "admin", "member"]>;
|
|
6155
6171
|
}, "strip", zod.ZodTypeAny, {
|
|
6156
6172
|
id: string;
|
|
6157
|
-
userId: string;
|
|
6158
6173
|
role: "member" | "owner" | "admin";
|
|
6174
|
+
userId: string;
|
|
6159
6175
|
}, {
|
|
6160
6176
|
id: string;
|
|
6161
|
-
userId: string;
|
|
6162
6177
|
role: "member" | "owner" | "admin";
|
|
6178
|
+
userId: string;
|
|
6163
6179
|
}>, {
|
|
6164
6180
|
error: string;
|
|
6165
6181
|
} | {
|
|
@@ -22748,6 +22764,59 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
22748
22764
|
projectId: string;
|
|
22749
22765
|
envName: string;
|
|
22750
22766
|
}>, ExportCatalogResult>;
|
|
22767
|
+
admin: {
|
|
22768
|
+
audit: {
|
|
22769
|
+
list: SchemaFn<zod.ZodObject<{
|
|
22770
|
+
actor: zod.ZodOptional<zod.ZodString>;
|
|
22771
|
+
action: zod.ZodOptional<zod.ZodString>;
|
|
22772
|
+
resourceKind: zod.ZodOptional<zod.ZodString>;
|
|
22773
|
+
since: zod.ZodOptional<zod.ZodString>;
|
|
22774
|
+
until: zod.ZodOptional<zod.ZodString>;
|
|
22775
|
+
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
22776
|
+
offset: zod.ZodOptional<zod.ZodNumber>;
|
|
22777
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22778
|
+
limit?: number | undefined;
|
|
22779
|
+
offset?: number | undefined;
|
|
22780
|
+
action?: string | undefined;
|
|
22781
|
+
resourceKind?: string | undefined;
|
|
22782
|
+
since?: string | undefined;
|
|
22783
|
+
actor?: string | undefined;
|
|
22784
|
+
until?: string | undefined;
|
|
22785
|
+
}, {
|
|
22786
|
+
limit?: number | undefined;
|
|
22787
|
+
offset?: number | undefined;
|
|
22788
|
+
action?: string | undefined;
|
|
22789
|
+
resourceKind?: string | undefined;
|
|
22790
|
+
since?: string | undefined;
|
|
22791
|
+
actor?: string | undefined;
|
|
22792
|
+
until?: string | undefined;
|
|
22793
|
+
}>, AdminAuditListResponse>;
|
|
22794
|
+
};
|
|
22795
|
+
orgs: {
|
|
22796
|
+
list: SchemaFn<zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>, AdminOrgListResponse>;
|
|
22797
|
+
get: SchemaFn<zod.ZodObject<{
|
|
22798
|
+
id: zod.ZodString;
|
|
22799
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22800
|
+
id: string;
|
|
22801
|
+
}, {
|
|
22802
|
+
id: string;
|
|
22803
|
+
}>, AdminOrgDetail>;
|
|
22804
|
+
suspend: SchemaFn<zod.ZodObject<{
|
|
22805
|
+
id: zod.ZodString;
|
|
22806
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22807
|
+
id: string;
|
|
22808
|
+
}, {
|
|
22809
|
+
id: string;
|
|
22810
|
+
}>, AdminSuspendResponse>;
|
|
22811
|
+
unsuspend: SchemaFn<zod.ZodObject<{
|
|
22812
|
+
id: zod.ZodString;
|
|
22813
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22814
|
+
id: string;
|
|
22815
|
+
}, {
|
|
22816
|
+
id: string;
|
|
22817
|
+
}>, AdminSuspendResponse>;
|
|
22818
|
+
};
|
|
22819
|
+
};
|
|
22751
22820
|
} & {
|
|
22752
22821
|
pools: {
|
|
22753
22822
|
list: SchemaFn<zod.ZodObject<{
|
|
@@ -23106,4 +23175,4 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
23106
23175
|
};
|
|
23107
23176
|
type TerrantulaCloudClient = ReturnType<typeof createClient>;
|
|
23108
23177
|
|
|
23109
|
-
export { AuditExportConfigResponse, AuditExportRunResponse, type CloudAppType, type CreateClientOptions, type ProjectAppType, SchemaFn, type TerrantulaCloudClient, TestConnectionResponse, TokenSource, createClient };
|
|
23178
|
+
export { AdminAuditListResponse, AdminOrgDetail, AdminOrgListResponse, AdminSuspendResponse, AuditExportConfigResponse, AuditExportRunResponse, type CloudAppType, type CreateClientOptions, type ProjectAppType, SchemaFn, type TerrantulaCloudClient, TestConnectionResponse, TokenSource, createClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SnapshotOp, T as TokenSource, a as SchemaFn, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult } from './audit-export-
|
|
2
|
-
export {
|
|
1
|
+
import { S as SnapshotOp, T as TokenSource, a as SchemaFn, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult, d as AdminAuditListResponse, e as AdminOrgListResponse, f as AdminOrgDetail, g as AdminSuspendResponse } from './audit-export-BtZTnt8a.js';
|
|
2
|
+
export { h as AdminAuditEvent, i as AdminOrgMember, j as AdminOrgProject, k as AdminOrgSummary, l as TerrantulaError, w as withSchema } from './audit-export-BtZTnt8a.js';
|
|
3
3
|
import * as _terrantula_types from '@terrantula/types';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import * as hono_hono_base from 'hono/hono-base';
|
|
@@ -75,6 +75,12 @@ type AppVariables = {
|
|
|
75
75
|
* ignored (no scoping).
|
|
76
76
|
*/
|
|
77
77
|
cellKey?: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Set by requireSuperAdmin middleware. True when the authenticated user
|
|
80
|
+
* has role='admin' (control-plane super-admin). Never set to false —
|
|
81
|
+
* absence means the check has not run or the user is not an admin.
|
|
82
|
+
*/
|
|
83
|
+
isSuperAdmin?: boolean;
|
|
78
84
|
};
|
|
79
85
|
|
|
80
86
|
/**
|
|
@@ -4811,6 +4817,7 @@ declare function _cloudAppShape(): hono_hono_base.HonoBase<hono_types.BlankEnv,
|
|
|
4811
4817
|
deletedAt: string | null;
|
|
4812
4818
|
logo: string | null;
|
|
4813
4819
|
metadata: string | null;
|
|
4820
|
+
suspendedAt: string | null;
|
|
4814
4821
|
};
|
|
4815
4822
|
outputFormat: "json";
|
|
4816
4823
|
status: 201;
|
|
@@ -4843,6 +4850,7 @@ declare function _cloudAppShape(): hono_hono_base.HonoBase<hono_types.BlankEnv,
|
|
|
4843
4850
|
createdAt: string;
|
|
4844
4851
|
metadata: string | null;
|
|
4845
4852
|
deletedAt: string | null;
|
|
4853
|
+
suspendedAt: string | null;
|
|
4846
4854
|
};
|
|
4847
4855
|
outputFormat: "json";
|
|
4848
4856
|
status: hono_utils_http_status.ContentfulStatusCode;
|
|
@@ -4940,6 +4948,9 @@ declare function _cloudAppShape(): hono_hono_base.HonoBase<hono_types.BlankEnv,
|
|
|
4940
4948
|
createdAt: string;
|
|
4941
4949
|
updatedAt: string;
|
|
4942
4950
|
deletedAt: string | null;
|
|
4951
|
+
banned: boolean;
|
|
4952
|
+
banReason: string | null;
|
|
4953
|
+
banExpires: string | null;
|
|
4943
4954
|
};
|
|
4944
4955
|
outputFormat: "json";
|
|
4945
4956
|
status: 201;
|
|
@@ -6083,6 +6094,7 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6083
6094
|
deletedAt: string | null;
|
|
6084
6095
|
logo: string | null;
|
|
6085
6096
|
metadata: string | null;
|
|
6097
|
+
suspendedAt: string | null;
|
|
6086
6098
|
}>;
|
|
6087
6099
|
get: SchemaFn<zod.ZodObject<{
|
|
6088
6100
|
id: zod.ZodString;
|
|
@@ -6100,6 +6112,7 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6100
6112
|
createdAt: string;
|
|
6101
6113
|
metadata: string | null;
|
|
6102
6114
|
deletedAt: string | null;
|
|
6115
|
+
suspendedAt: string | null;
|
|
6103
6116
|
}>;
|
|
6104
6117
|
listUsers: SchemaFn<zod.ZodObject<{
|
|
6105
6118
|
id: zod.ZodString;
|
|
@@ -6147,6 +6160,9 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6147
6160
|
createdAt: string;
|
|
6148
6161
|
updatedAt: string;
|
|
6149
6162
|
deletedAt: string | null;
|
|
6163
|
+
banned: boolean;
|
|
6164
|
+
banReason: string | null;
|
|
6165
|
+
banExpires: string | null;
|
|
6150
6166
|
}>;
|
|
6151
6167
|
updateUserRole: SchemaFn<zod.ZodObject<{
|
|
6152
6168
|
id: zod.ZodString;
|
|
@@ -6154,12 +6170,12 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
6154
6170
|
role: zod.ZodEnum<["owner", "admin", "member"]>;
|
|
6155
6171
|
}, "strip", zod.ZodTypeAny, {
|
|
6156
6172
|
id: string;
|
|
6157
|
-
userId: string;
|
|
6158
6173
|
role: "member" | "owner" | "admin";
|
|
6174
|
+
userId: string;
|
|
6159
6175
|
}, {
|
|
6160
6176
|
id: string;
|
|
6161
|
-
userId: string;
|
|
6162
6177
|
role: "member" | "owner" | "admin";
|
|
6178
|
+
userId: string;
|
|
6163
6179
|
}>, {
|
|
6164
6180
|
error: string;
|
|
6165
6181
|
} | {
|
|
@@ -22748,6 +22764,59 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
22748
22764
|
projectId: string;
|
|
22749
22765
|
envName: string;
|
|
22750
22766
|
}>, ExportCatalogResult>;
|
|
22767
|
+
admin: {
|
|
22768
|
+
audit: {
|
|
22769
|
+
list: SchemaFn<zod.ZodObject<{
|
|
22770
|
+
actor: zod.ZodOptional<zod.ZodString>;
|
|
22771
|
+
action: zod.ZodOptional<zod.ZodString>;
|
|
22772
|
+
resourceKind: zod.ZodOptional<zod.ZodString>;
|
|
22773
|
+
since: zod.ZodOptional<zod.ZodString>;
|
|
22774
|
+
until: zod.ZodOptional<zod.ZodString>;
|
|
22775
|
+
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
22776
|
+
offset: zod.ZodOptional<zod.ZodNumber>;
|
|
22777
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22778
|
+
limit?: number | undefined;
|
|
22779
|
+
offset?: number | undefined;
|
|
22780
|
+
action?: string | undefined;
|
|
22781
|
+
resourceKind?: string | undefined;
|
|
22782
|
+
since?: string | undefined;
|
|
22783
|
+
actor?: string | undefined;
|
|
22784
|
+
until?: string | undefined;
|
|
22785
|
+
}, {
|
|
22786
|
+
limit?: number | undefined;
|
|
22787
|
+
offset?: number | undefined;
|
|
22788
|
+
action?: string | undefined;
|
|
22789
|
+
resourceKind?: string | undefined;
|
|
22790
|
+
since?: string | undefined;
|
|
22791
|
+
actor?: string | undefined;
|
|
22792
|
+
until?: string | undefined;
|
|
22793
|
+
}>, AdminAuditListResponse>;
|
|
22794
|
+
};
|
|
22795
|
+
orgs: {
|
|
22796
|
+
list: SchemaFn<zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>, AdminOrgListResponse>;
|
|
22797
|
+
get: SchemaFn<zod.ZodObject<{
|
|
22798
|
+
id: zod.ZodString;
|
|
22799
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22800
|
+
id: string;
|
|
22801
|
+
}, {
|
|
22802
|
+
id: string;
|
|
22803
|
+
}>, AdminOrgDetail>;
|
|
22804
|
+
suspend: SchemaFn<zod.ZodObject<{
|
|
22805
|
+
id: zod.ZodString;
|
|
22806
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22807
|
+
id: string;
|
|
22808
|
+
}, {
|
|
22809
|
+
id: string;
|
|
22810
|
+
}>, AdminSuspendResponse>;
|
|
22811
|
+
unsuspend: SchemaFn<zod.ZodObject<{
|
|
22812
|
+
id: zod.ZodString;
|
|
22813
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22814
|
+
id: string;
|
|
22815
|
+
}, {
|
|
22816
|
+
id: string;
|
|
22817
|
+
}>, AdminSuspendResponse>;
|
|
22818
|
+
};
|
|
22819
|
+
};
|
|
22751
22820
|
} & {
|
|
22752
22821
|
pools: {
|
|
22753
22822
|
list: SchemaFn<zod.ZodObject<{
|
|
@@ -23106,4 +23175,4 @@ declare const createClient: (baseUrl: string, options?: CreateClientOptions | To
|
|
|
23106
23175
|
};
|
|
23107
23176
|
type TerrantulaCloudClient = ReturnType<typeof createClient>;
|
|
23108
23177
|
|
|
23109
|
-
export { AuditExportConfigResponse, AuditExportRunResponse, type CloudAppType, type CreateClientOptions, type ProjectAppType, SchemaFn, type TerrantulaCloudClient, TestConnectionResponse, TokenSource, createClient };
|
|
23178
|
+
export { AdminAuditListResponse, AdminOrgDetail, AdminOrgListResponse, AdminSuspendResponse, AuditExportConfigResponse, AuditExportRunResponse, type CloudAppType, type CreateClientOptions, type ProjectAppType, SchemaFn, type TerrantulaCloudClient, TestConnectionResponse, TokenSource, createClient };
|
package/dist/index.js
CHANGED
|
@@ -1538,6 +1538,114 @@ function createImportSourcesClient(proj) {
|
|
|
1538
1538
|
};
|
|
1539
1539
|
}
|
|
1540
1540
|
|
|
1541
|
+
// src/admin.ts
|
|
1542
|
+
var import_zod18 = require("zod");
|
|
1543
|
+
async function rawRequest2(baseUrl, hcOpts, path, init = {}) {
|
|
1544
|
+
const fetchImpl = hcOpts?.fetch ?? fetch;
|
|
1545
|
+
const rawHeaders = hcOpts?.headers;
|
|
1546
|
+
const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
|
|
1547
|
+
return fetchImpl(`${baseUrl}${path}`, {
|
|
1548
|
+
...init,
|
|
1549
|
+
headers: {
|
|
1550
|
+
...resolvedHeaders,
|
|
1551
|
+
...init.headers
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
async function callRaw2(res) {
|
|
1556
|
+
if (!res.ok) {
|
|
1557
|
+
let message = fallbackMessage(res.status);
|
|
1558
|
+
try {
|
|
1559
|
+
const body = await res.json();
|
|
1560
|
+
if (body.error) message = body.error;
|
|
1561
|
+
} catch {
|
|
1562
|
+
}
|
|
1563
|
+
throw new TerrantulaError(res.status, { error: message });
|
|
1564
|
+
}
|
|
1565
|
+
return res.json();
|
|
1566
|
+
}
|
|
1567
|
+
function createAdminClient(baseUrl, hcOpts) {
|
|
1568
|
+
return {
|
|
1569
|
+
audit: {
|
|
1570
|
+
/**
|
|
1571
|
+
* GET /admin/audit
|
|
1572
|
+
* List super-admin audit events with optional filters.
|
|
1573
|
+
*/
|
|
1574
|
+
list: withSchema(
|
|
1575
|
+
import_zod18.z.object({
|
|
1576
|
+
actor: import_zod18.z.string().optional().describe("Filter by actor user ID"),
|
|
1577
|
+
action: import_zod18.z.string().optional().describe("Filter by action name"),
|
|
1578
|
+
resourceKind: import_zod18.z.string().optional().describe("Filter by resource kind"),
|
|
1579
|
+
since: import_zod18.z.string().optional().describe("ISO 8601 datetime lower bound"),
|
|
1580
|
+
until: import_zod18.z.string().optional().describe("ISO 8601 datetime upper bound"),
|
|
1581
|
+
limit: import_zod18.z.coerce.number().int().min(1).max(200).optional().describe("Max results (1-200)"),
|
|
1582
|
+
offset: import_zod18.z.coerce.number().int().min(0).optional().describe("Pagination offset")
|
|
1583
|
+
}),
|
|
1584
|
+
async (params) => {
|
|
1585
|
+
const qs = new URLSearchParams();
|
|
1586
|
+
if (params.actor !== void 0) qs.set("actor", params.actor);
|
|
1587
|
+
if (params.action !== void 0) qs.set("action", params.action);
|
|
1588
|
+
if (params.resourceKind !== void 0) qs.set("resourceKind", params.resourceKind);
|
|
1589
|
+
if (params.since !== void 0) qs.set("since", params.since);
|
|
1590
|
+
if (params.until !== void 0) qs.set("until", params.until);
|
|
1591
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1592
|
+
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
1593
|
+
const search = qs.toString();
|
|
1594
|
+
return callRaw2(
|
|
1595
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/audit${search ? `?${search}` : ""}`)
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1598
|
+
)
|
|
1599
|
+
},
|
|
1600
|
+
orgs: {
|
|
1601
|
+
/**
|
|
1602
|
+
* GET /admin/orgs
|
|
1603
|
+
* List all organizations across tenants with member + project counts.
|
|
1604
|
+
*/
|
|
1605
|
+
list: withSchema(
|
|
1606
|
+
import_zod18.z.object({}),
|
|
1607
|
+
async () => callRaw2(
|
|
1608
|
+
await rawRequest2(baseUrl, hcOpts, "/admin/orgs")
|
|
1609
|
+
)
|
|
1610
|
+
),
|
|
1611
|
+
/**
|
|
1612
|
+
* GET /admin/orgs/:id
|
|
1613
|
+
* Detail view: org fields + member list + project list.
|
|
1614
|
+
*/
|
|
1615
|
+
get: withSchema(
|
|
1616
|
+
import_zod18.z.object({ id: import_zod18.z.string().describe("Organization ID") }),
|
|
1617
|
+
async (params) => callRaw2(
|
|
1618
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}`)
|
|
1619
|
+
)
|
|
1620
|
+
),
|
|
1621
|
+
/**
|
|
1622
|
+
* POST /admin/orgs/:id/suspend
|
|
1623
|
+
* Set suspended_at = now(). Idempotent.
|
|
1624
|
+
*/
|
|
1625
|
+
suspend: withSchema(
|
|
1626
|
+
import_zod18.z.object({ id: import_zod18.z.string().describe("Organization ID") }),
|
|
1627
|
+
async (params) => callRaw2(
|
|
1628
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/suspend`, {
|
|
1629
|
+
method: "POST"
|
|
1630
|
+
})
|
|
1631
|
+
)
|
|
1632
|
+
),
|
|
1633
|
+
/**
|
|
1634
|
+
* POST /admin/orgs/:id/unsuspend
|
|
1635
|
+
* Clear suspended_at.
|
|
1636
|
+
*/
|
|
1637
|
+
unsuspend: withSchema(
|
|
1638
|
+
import_zod18.z.object({ id: import_zod18.z.string().describe("Organization ID") }),
|
|
1639
|
+
async (params) => callRaw2(
|
|
1640
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/unsuspend`, {
|
|
1641
|
+
method: "POST"
|
|
1642
|
+
})
|
|
1643
|
+
)
|
|
1644
|
+
)
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1541
1649
|
// src/index.ts
|
|
1542
1650
|
var createClient = (baseUrl, options = {}) => {
|
|
1543
1651
|
const opts = typeof options === "string" || typeof options === "function" ? { token: options } : options;
|
|
@@ -1572,7 +1680,8 @@ var createClient = (baseUrl, options = {}) => {
|
|
|
1572
1680
|
auditExport: createAuditExportClient(baseUrl, hcOpts),
|
|
1573
1681
|
userPreferences: createUserPreferencesClient(baseUrl, hcOpts),
|
|
1574
1682
|
importSources: createImportSourcesClient(proj),
|
|
1575
|
-
exportCatalog
|
|
1683
|
+
exportCatalog,
|
|
1684
|
+
admin: createAdminClient(baseUrl, hcOpts)
|
|
1576
1685
|
};
|
|
1577
1686
|
let warnedPools = false;
|
|
1578
1687
|
let warnedApplyRevisions = false;
|
package/dist/index.mjs
CHANGED
package/dist/local.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SchemaFn, S as SnapshotOp, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult } from './audit-export-
|
|
1
|
+
import { a as SchemaFn, S as SnapshotOp, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult, d as AdminAuditListResponse, e as AdminOrgListResponse, f as AdminOrgDetail, g as AdminSuspendResponse } from './audit-export-BtZTnt8a.mjs';
|
|
2
2
|
import * as _terrantula_types from '@terrantula/types';
|
|
3
3
|
import * as hono_utils_types from 'hono/utils/types';
|
|
4
4
|
import * as zod from 'zod';
|
|
@@ -26,6 +26,7 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
26
26
|
deletedAt: string | null;
|
|
27
27
|
logo: string | null;
|
|
28
28
|
metadata: string | null;
|
|
29
|
+
suspendedAt: string | null;
|
|
29
30
|
}>;
|
|
30
31
|
get: SchemaFn<zod.ZodObject<{
|
|
31
32
|
id: zod.ZodString;
|
|
@@ -43,6 +44,7 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
43
44
|
createdAt: string;
|
|
44
45
|
metadata: string | null;
|
|
45
46
|
deletedAt: string | null;
|
|
47
|
+
suspendedAt: string | null;
|
|
46
48
|
}>;
|
|
47
49
|
listUsers: SchemaFn<zod.ZodObject<{
|
|
48
50
|
id: zod.ZodString;
|
|
@@ -90,6 +92,9 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
90
92
|
createdAt: string;
|
|
91
93
|
updatedAt: string;
|
|
92
94
|
deletedAt: string | null;
|
|
95
|
+
banned: boolean;
|
|
96
|
+
banReason: string | null;
|
|
97
|
+
banExpires: string | null;
|
|
93
98
|
}>;
|
|
94
99
|
updateUserRole: SchemaFn<zod.ZodObject<{
|
|
95
100
|
id: zod.ZodString;
|
|
@@ -97,12 +102,12 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
97
102
|
role: zod.ZodEnum<["owner", "admin", "member"]>;
|
|
98
103
|
}, "strip", zod.ZodTypeAny, {
|
|
99
104
|
id: string;
|
|
100
|
-
userId: string;
|
|
101
105
|
role: "member" | "owner" | "admin";
|
|
106
|
+
userId: string;
|
|
102
107
|
}, {
|
|
103
108
|
id: string;
|
|
104
|
-
userId: string;
|
|
105
109
|
role: "member" | "owner" | "admin";
|
|
110
|
+
userId: string;
|
|
106
111
|
}>, {
|
|
107
112
|
error: string;
|
|
108
113
|
} | {
|
|
@@ -16691,6 +16696,59 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
16691
16696
|
projectId: string;
|
|
16692
16697
|
envName: string;
|
|
16693
16698
|
}>, ExportCatalogResult>;
|
|
16699
|
+
admin: {
|
|
16700
|
+
audit: {
|
|
16701
|
+
list: SchemaFn<zod.ZodObject<{
|
|
16702
|
+
actor: zod.ZodOptional<zod.ZodString>;
|
|
16703
|
+
action: zod.ZodOptional<zod.ZodString>;
|
|
16704
|
+
resourceKind: zod.ZodOptional<zod.ZodString>;
|
|
16705
|
+
since: zod.ZodOptional<zod.ZodString>;
|
|
16706
|
+
until: zod.ZodOptional<zod.ZodString>;
|
|
16707
|
+
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
16708
|
+
offset: zod.ZodOptional<zod.ZodNumber>;
|
|
16709
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16710
|
+
limit?: number | undefined;
|
|
16711
|
+
offset?: number | undefined;
|
|
16712
|
+
action?: string | undefined;
|
|
16713
|
+
resourceKind?: string | undefined;
|
|
16714
|
+
since?: string | undefined;
|
|
16715
|
+
actor?: string | undefined;
|
|
16716
|
+
until?: string | undefined;
|
|
16717
|
+
}, {
|
|
16718
|
+
limit?: number | undefined;
|
|
16719
|
+
offset?: number | undefined;
|
|
16720
|
+
action?: string | undefined;
|
|
16721
|
+
resourceKind?: string | undefined;
|
|
16722
|
+
since?: string | undefined;
|
|
16723
|
+
actor?: string | undefined;
|
|
16724
|
+
until?: string | undefined;
|
|
16725
|
+
}>, AdminAuditListResponse>;
|
|
16726
|
+
};
|
|
16727
|
+
orgs: {
|
|
16728
|
+
list: SchemaFn<zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>, AdminOrgListResponse>;
|
|
16729
|
+
get: SchemaFn<zod.ZodObject<{
|
|
16730
|
+
id: zod.ZodString;
|
|
16731
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16732
|
+
id: string;
|
|
16733
|
+
}, {
|
|
16734
|
+
id: string;
|
|
16735
|
+
}>, AdminOrgDetail>;
|
|
16736
|
+
suspend: SchemaFn<zod.ZodObject<{
|
|
16737
|
+
id: zod.ZodString;
|
|
16738
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16739
|
+
id: string;
|
|
16740
|
+
}, {
|
|
16741
|
+
id: string;
|
|
16742
|
+
}>, AdminSuspendResponse>;
|
|
16743
|
+
unsuspend: SchemaFn<zod.ZodObject<{
|
|
16744
|
+
id: zod.ZodString;
|
|
16745
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16746
|
+
id: string;
|
|
16747
|
+
}, {
|
|
16748
|
+
id: string;
|
|
16749
|
+
}>, AdminSuspendResponse>;
|
|
16750
|
+
};
|
|
16751
|
+
};
|
|
16694
16752
|
} & {
|
|
16695
16753
|
pools: {
|
|
16696
16754
|
list: SchemaFn<zod.ZodObject<{
|
package/dist/local.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SchemaFn, S as SnapshotOp, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult } from './audit-export-
|
|
1
|
+
import { a as SchemaFn, S as SnapshotOp, A as AuditExportConfigResponse, b as TestConnectionResponse, c as AuditExportRunResponse, E as ExportCatalogResult, d as AdminAuditListResponse, e as AdminOrgListResponse, f as AdminOrgDetail, g as AdminSuspendResponse } from './audit-export-BtZTnt8a.js';
|
|
2
2
|
import * as _terrantula_types from '@terrantula/types';
|
|
3
3
|
import * as hono_utils_types from 'hono/utils/types';
|
|
4
4
|
import * as zod from 'zod';
|
|
@@ -26,6 +26,7 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
26
26
|
deletedAt: string | null;
|
|
27
27
|
logo: string | null;
|
|
28
28
|
metadata: string | null;
|
|
29
|
+
suspendedAt: string | null;
|
|
29
30
|
}>;
|
|
30
31
|
get: SchemaFn<zod.ZodObject<{
|
|
31
32
|
id: zod.ZodString;
|
|
@@ -43,6 +44,7 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
43
44
|
createdAt: string;
|
|
44
45
|
metadata: string | null;
|
|
45
46
|
deletedAt: string | null;
|
|
47
|
+
suspendedAt: string | null;
|
|
46
48
|
}>;
|
|
47
49
|
listUsers: SchemaFn<zod.ZodObject<{
|
|
48
50
|
id: zod.ZodString;
|
|
@@ -90,6 +92,9 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
90
92
|
createdAt: string;
|
|
91
93
|
updatedAt: string;
|
|
92
94
|
deletedAt: string | null;
|
|
95
|
+
banned: boolean;
|
|
96
|
+
banReason: string | null;
|
|
97
|
+
banExpires: string | null;
|
|
93
98
|
}>;
|
|
94
99
|
updateUserRole: SchemaFn<zod.ZodObject<{
|
|
95
100
|
id: zod.ZodString;
|
|
@@ -97,12 +102,12 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
97
102
|
role: zod.ZodEnum<["owner", "admin", "member"]>;
|
|
98
103
|
}, "strip", zod.ZodTypeAny, {
|
|
99
104
|
id: string;
|
|
100
|
-
userId: string;
|
|
101
105
|
role: "member" | "owner" | "admin";
|
|
106
|
+
userId: string;
|
|
102
107
|
}, {
|
|
103
108
|
id: string;
|
|
104
|
-
userId: string;
|
|
105
109
|
role: "member" | "owner" | "admin";
|
|
110
|
+
userId: string;
|
|
106
111
|
}>, {
|
|
107
112
|
error: string;
|
|
108
113
|
} | {
|
|
@@ -16691,6 +16696,59 @@ declare const createLocalClient: (options?: CreateLocalClientOptions) => {
|
|
|
16691
16696
|
projectId: string;
|
|
16692
16697
|
envName: string;
|
|
16693
16698
|
}>, ExportCatalogResult>;
|
|
16699
|
+
admin: {
|
|
16700
|
+
audit: {
|
|
16701
|
+
list: SchemaFn<zod.ZodObject<{
|
|
16702
|
+
actor: zod.ZodOptional<zod.ZodString>;
|
|
16703
|
+
action: zod.ZodOptional<zod.ZodString>;
|
|
16704
|
+
resourceKind: zod.ZodOptional<zod.ZodString>;
|
|
16705
|
+
since: zod.ZodOptional<zod.ZodString>;
|
|
16706
|
+
until: zod.ZodOptional<zod.ZodString>;
|
|
16707
|
+
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
16708
|
+
offset: zod.ZodOptional<zod.ZodNumber>;
|
|
16709
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16710
|
+
limit?: number | undefined;
|
|
16711
|
+
offset?: number | undefined;
|
|
16712
|
+
action?: string | undefined;
|
|
16713
|
+
resourceKind?: string | undefined;
|
|
16714
|
+
since?: string | undefined;
|
|
16715
|
+
actor?: string | undefined;
|
|
16716
|
+
until?: string | undefined;
|
|
16717
|
+
}, {
|
|
16718
|
+
limit?: number | undefined;
|
|
16719
|
+
offset?: number | undefined;
|
|
16720
|
+
action?: string | undefined;
|
|
16721
|
+
resourceKind?: string | undefined;
|
|
16722
|
+
since?: string | undefined;
|
|
16723
|
+
actor?: string | undefined;
|
|
16724
|
+
until?: string | undefined;
|
|
16725
|
+
}>, AdminAuditListResponse>;
|
|
16726
|
+
};
|
|
16727
|
+
orgs: {
|
|
16728
|
+
list: SchemaFn<zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>, AdminOrgListResponse>;
|
|
16729
|
+
get: SchemaFn<zod.ZodObject<{
|
|
16730
|
+
id: zod.ZodString;
|
|
16731
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16732
|
+
id: string;
|
|
16733
|
+
}, {
|
|
16734
|
+
id: string;
|
|
16735
|
+
}>, AdminOrgDetail>;
|
|
16736
|
+
suspend: SchemaFn<zod.ZodObject<{
|
|
16737
|
+
id: zod.ZodString;
|
|
16738
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16739
|
+
id: string;
|
|
16740
|
+
}, {
|
|
16741
|
+
id: string;
|
|
16742
|
+
}>, AdminSuspendResponse>;
|
|
16743
|
+
unsuspend: SchemaFn<zod.ZodObject<{
|
|
16744
|
+
id: zod.ZodString;
|
|
16745
|
+
}, "strip", zod.ZodTypeAny, {
|
|
16746
|
+
id: string;
|
|
16747
|
+
}, {
|
|
16748
|
+
id: string;
|
|
16749
|
+
}>, AdminSuspendResponse>;
|
|
16750
|
+
};
|
|
16751
|
+
};
|
|
16694
16752
|
} & {
|
|
16695
16753
|
pools: {
|
|
16696
16754
|
list: SchemaFn<zod.ZodObject<{
|
package/dist/local.js
CHANGED
|
@@ -1538,6 +1538,114 @@ function createImportSourcesClient(proj) {
|
|
|
1538
1538
|
};
|
|
1539
1539
|
}
|
|
1540
1540
|
|
|
1541
|
+
// src/admin.ts
|
|
1542
|
+
var import_zod18 = require("zod");
|
|
1543
|
+
async function rawRequest2(baseUrl, hcOpts, path, init = {}) {
|
|
1544
|
+
const fetchImpl = hcOpts?.fetch ?? fetch;
|
|
1545
|
+
const rawHeaders = hcOpts?.headers;
|
|
1546
|
+
const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
|
|
1547
|
+
return fetchImpl(`${baseUrl}${path}`, {
|
|
1548
|
+
...init,
|
|
1549
|
+
headers: {
|
|
1550
|
+
...resolvedHeaders,
|
|
1551
|
+
...init.headers
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
async function callRaw2(res) {
|
|
1556
|
+
if (!res.ok) {
|
|
1557
|
+
let message = fallbackMessage(res.status);
|
|
1558
|
+
try {
|
|
1559
|
+
const body = await res.json();
|
|
1560
|
+
if (body.error) message = body.error;
|
|
1561
|
+
} catch {
|
|
1562
|
+
}
|
|
1563
|
+
throw new TerrantulaError(res.status, { error: message });
|
|
1564
|
+
}
|
|
1565
|
+
return res.json();
|
|
1566
|
+
}
|
|
1567
|
+
function createAdminClient(baseUrl, hcOpts) {
|
|
1568
|
+
return {
|
|
1569
|
+
audit: {
|
|
1570
|
+
/**
|
|
1571
|
+
* GET /admin/audit
|
|
1572
|
+
* List super-admin audit events with optional filters.
|
|
1573
|
+
*/
|
|
1574
|
+
list: withSchema(
|
|
1575
|
+
import_zod18.z.object({
|
|
1576
|
+
actor: import_zod18.z.string().optional().describe("Filter by actor user ID"),
|
|
1577
|
+
action: import_zod18.z.string().optional().describe("Filter by action name"),
|
|
1578
|
+
resourceKind: import_zod18.z.string().optional().describe("Filter by resource kind"),
|
|
1579
|
+
since: import_zod18.z.string().optional().describe("ISO 8601 datetime lower bound"),
|
|
1580
|
+
until: import_zod18.z.string().optional().describe("ISO 8601 datetime upper bound"),
|
|
1581
|
+
limit: import_zod18.z.coerce.number().int().min(1).max(200).optional().describe("Max results (1-200)"),
|
|
1582
|
+
offset: import_zod18.z.coerce.number().int().min(0).optional().describe("Pagination offset")
|
|
1583
|
+
}),
|
|
1584
|
+
async (params) => {
|
|
1585
|
+
const qs = new URLSearchParams();
|
|
1586
|
+
if (params.actor !== void 0) qs.set("actor", params.actor);
|
|
1587
|
+
if (params.action !== void 0) qs.set("action", params.action);
|
|
1588
|
+
if (params.resourceKind !== void 0) qs.set("resourceKind", params.resourceKind);
|
|
1589
|
+
if (params.since !== void 0) qs.set("since", params.since);
|
|
1590
|
+
if (params.until !== void 0) qs.set("until", params.until);
|
|
1591
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1592
|
+
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
1593
|
+
const search = qs.toString();
|
|
1594
|
+
return callRaw2(
|
|
1595
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/audit${search ? `?${search}` : ""}`)
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1598
|
+
)
|
|
1599
|
+
},
|
|
1600
|
+
orgs: {
|
|
1601
|
+
/**
|
|
1602
|
+
* GET /admin/orgs
|
|
1603
|
+
* List all organizations across tenants with member + project counts.
|
|
1604
|
+
*/
|
|
1605
|
+
list: withSchema(
|
|
1606
|
+
import_zod18.z.object({}),
|
|
1607
|
+
async () => callRaw2(
|
|
1608
|
+
await rawRequest2(baseUrl, hcOpts, "/admin/orgs")
|
|
1609
|
+
)
|
|
1610
|
+
),
|
|
1611
|
+
/**
|
|
1612
|
+
* GET /admin/orgs/:id
|
|
1613
|
+
* Detail view: org fields + member list + project list.
|
|
1614
|
+
*/
|
|
1615
|
+
get: withSchema(
|
|
1616
|
+
import_zod18.z.object({ id: import_zod18.z.string().describe("Organization ID") }),
|
|
1617
|
+
async (params) => callRaw2(
|
|
1618
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}`)
|
|
1619
|
+
)
|
|
1620
|
+
),
|
|
1621
|
+
/**
|
|
1622
|
+
* POST /admin/orgs/:id/suspend
|
|
1623
|
+
* Set suspended_at = now(). Idempotent.
|
|
1624
|
+
*/
|
|
1625
|
+
suspend: withSchema(
|
|
1626
|
+
import_zod18.z.object({ id: import_zod18.z.string().describe("Organization ID") }),
|
|
1627
|
+
async (params) => callRaw2(
|
|
1628
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/suspend`, {
|
|
1629
|
+
method: "POST"
|
|
1630
|
+
})
|
|
1631
|
+
)
|
|
1632
|
+
),
|
|
1633
|
+
/**
|
|
1634
|
+
* POST /admin/orgs/:id/unsuspend
|
|
1635
|
+
* Clear suspended_at.
|
|
1636
|
+
*/
|
|
1637
|
+
unsuspend: withSchema(
|
|
1638
|
+
import_zod18.z.object({ id: import_zod18.z.string().describe("Organization ID") }),
|
|
1639
|
+
async (params) => callRaw2(
|
|
1640
|
+
await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/unsuspend`, {
|
|
1641
|
+
method: "POST"
|
|
1642
|
+
})
|
|
1643
|
+
)
|
|
1644
|
+
)
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1541
1649
|
// src/index.ts
|
|
1542
1650
|
var createClient = (baseUrl, options = {}) => {
|
|
1543
1651
|
const opts = typeof options === "string" || typeof options === "function" ? { token: options } : options;
|
|
@@ -1572,7 +1680,8 @@ var createClient = (baseUrl, options = {}) => {
|
|
|
1572
1680
|
auditExport: createAuditExportClient(baseUrl, hcOpts),
|
|
1573
1681
|
userPreferences: createUserPreferencesClient(baseUrl, hcOpts),
|
|
1574
1682
|
importSources: createImportSourcesClient(proj),
|
|
1575
|
-
exportCatalog
|
|
1683
|
+
exportCatalog,
|
|
1684
|
+
admin: createAdminClient(baseUrl, hcOpts)
|
|
1576
1685
|
};
|
|
1577
1686
|
let warnedPools = false;
|
|
1578
1687
|
let warnedApplyRevisions = false;
|
package/dist/local.mjs
CHANGED
package/package.json
CHANGED