@terrantula/sdk 0.10.0 → 0.11.1

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.
@@ -461,6 +461,32 @@ function createEntitiesClient(projEnv) {
461
461
  );
462
462
  }
463
463
  ),
464
+ facets: withSchema(
465
+ z3.object({
466
+ orgId: z3.string().describe("Organization slug"),
467
+ projectId: z3.string().describe("Project name"),
468
+ envName: z3.string().describe("Environment name"),
469
+ kind: z3.array(z3.string()).optional().describe("Filter: entity type names"),
470
+ state: z3.array(z3.string()).optional().describe("Filter: states"),
471
+ owner: z3.array(z3.string()).optional().describe("Filter: owner label values ('' = unset)"),
472
+ cell: z3.array(z3.string()).optional().describe("Filter: cell label values ('' = unset)"),
473
+ search: z3.string().optional().describe("Substring match on name + entity type"),
474
+ cellKey: z3.string().optional().describe("Project cell label key; omit to skip the cell dimension")
475
+ }),
476
+ (params) => {
477
+ const { orgId, projectId, envName, kind, state, owner, cell, search, cellKey } = params;
478
+ const query = {};
479
+ if (kind?.length) query.kind = JSON.stringify(kind);
480
+ if (state?.length) query.state = JSON.stringify(state);
481
+ if (owner?.length) query.owner = JSON.stringify(owner);
482
+ if (cell?.length) query.cell = JSON.stringify(cell);
483
+ if (search) query.search = search;
484
+ if (cellKey) query.cellKey = cellKey;
485
+ return call(
486
+ projEnv(orgId, projectId, envName)["entities"]["facets"].$get({ query })
487
+ );
488
+ }
489
+ ),
464
490
  get: withSchema(
465
491
  z3.object({
466
492
  orgId: z3.string().describe("Organization slug"),
@@ -836,7 +862,8 @@ function createRelationshipsClient(projEnv) {
836
862
  toEntity: z6.string().uuid().optional().describe("Filter by to-entity ID"),
837
863
  fromEntityCell: z6.string().optional().describe("Filter by from-entity cell membership"),
838
864
  toEntityCell: z6.string().optional().describe("Filter by to-entity cell membership"),
839
- limit: z6.coerce.number().int().min(1).max(100).optional().describe("Max results (1-100)")
865
+ limit: z6.coerce.number().int().min(1).max(100).optional().describe("Max results (1-100)"),
866
+ cursor: z6.string().optional().describe("Pagination cursor")
840
867
  }),
841
868
  (params) => {
842
869
  const { orgId, projectId, envName, ...query } = params;
@@ -1237,9 +1264,12 @@ function createExportCatalogFn(proj, projEnv) {
1237
1264
  ...entityTypes.map(
1238
1265
  (r) => ({ kind: "EntityType", ...stripServerFields(r) })
1239
1266
  ),
1240
- ...cells.map(
1241
- (r) => ({ kind: "Cell", ...stripServerFields(r) })
1242
- ),
1267
+ ...cells.map((r) => {
1268
+ const { entityTypeName, ...rest } = r;
1269
+ const stripped = stripServerFields(rest);
1270
+ if (entityTypeName != null) stripped.entityType = entityTypeName;
1271
+ return { kind: "Cell", ...stripped };
1272
+ }),
1243
1273
  ...relationshipTypes.map((r) => {
1244
1274
  const { fromEntityTypeName, toEntityTypeName, ...rest } = r;
1245
1275
  const stripped = stripServerFields(rest);
@@ -2005,6 +2035,27 @@ function createAdminClient(baseUrl, hcOpts) {
2005
2035
  };
2006
2036
  }
2007
2037
 
2038
+ // src/resolve-source.ts
2039
+ import { z as z22 } from "zod";
2040
+ function createResolveSourceFn(proj) {
2041
+ return withSchema(
2042
+ z22.object({
2043
+ orgId: z22.string().describe("Organization slug"),
2044
+ projectId: z22.string().describe("Project ID"),
2045
+ kind: z22.literal("registry").describe('Source kind \u2014 only "registry" is supported today'),
2046
+ ref: z22.string().regex(/^[^/]+\/[^/]+\/[^/]+$/, { message: "ref must be <namespace>/<name>/<provider>" }).describe("Terraform Registry module ref (<namespace>/<name>/<provider>)"),
2047
+ version: z22.string().optional().describe("Module version semver \u2014 resolves latest if omitted")
2048
+ }),
2049
+ (params) => {
2050
+ const { orgId, projectId, kind, ref, version } = params;
2051
+ const json = version !== void 0 ? { kind, ref, version } : { kind, ref };
2052
+ return call(
2053
+ proj(orgId, projectId)["resolve-source"].$post({ json })
2054
+ );
2055
+ }
2056
+ );
2057
+ }
2058
+
2008
2059
  // src/index.ts
2009
2060
  var createClient = (baseUrl, options = {}) => {
2010
2061
  const opts = typeof options === "string" || typeof options === "function" ? { token: options } : options;
@@ -2042,6 +2093,7 @@ var createClient = (baseUrl, options = {}) => {
2042
2093
  auditExport: createAuditExportClient(baseUrl, hcOpts),
2043
2094
  userPreferences: createUserPreferencesClient(baseUrl, hcOpts),
2044
2095
  importSources: createImportSourcesClient(proj),
2096
+ resolveSource: createResolveSourceFn(proj),
2045
2097
  exportCatalog,
2046
2098
  admin: createAdminClient(baseUrl, hcOpts)
2047
2099
  };