@terrantula/sdk 0.5.3 → 0.7.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.
@@ -357,9 +357,12 @@ function createProjectsClient(cloud, baseUrl, hcOpts) {
357
357
  * members, GitHub repo links, API tokens, and environments. Idempotent.
358
358
  */
359
359
  nuke: withSchema(
360
- z2.object({ projectId: z2.string().describe("Project ID to nuke") }),
360
+ z2.object({
361
+ orgId: z2.string().describe("Organization slug"),
362
+ projectId: z2.string().describe("Project ID to nuke")
363
+ }),
361
364
  async (params) => {
362
- const url = `${baseUrl}/projects/${encodeURIComponent(params.projectId)}/nuke`;
365
+ const url = `${baseUrl}/${encodeURIComponent(params.orgId)}/${encodeURIComponent(params.projectId)}/nuke`;
363
366
  const fetchImpl = hcOpts?.fetch ?? fetch;
364
367
  const rawHeaders = hcOpts?.headers;
365
368
  const resolvedHeaders = typeof rawHeaders === "function" ? await rawHeaders() : rawHeaders ?? {};
@@ -392,40 +395,49 @@ function createEntityTypesClient(proj) {
392
395
  return {
393
396
  list: withSchema(
394
397
  z3.object({
398
+ orgId: z3.string().describe("Organization slug"),
395
399
  projectId: z3.string().describe("Project ID")
396
400
  }),
397
- (params) => call(proj(params.projectId)["entity-types"].$get())
401
+ (params) => call(proj(params.orgId, params.projectId)["entity-types"].$get())
398
402
  ),
399
403
  get: withSchema(
400
404
  z3.object({
405
+ orgId: z3.string().describe("Organization slug"),
401
406
  projectId: z3.string().describe("Project ID"),
402
407
  name: z3.string().describe("Entity type name")
403
408
  }),
404
- (params) => call(proj(params.projectId)["entity-types"][":name"].$get({ param: { name: params.name } }))
409
+ (params) => call(proj(params.orgId, params.projectId)["entity-types"][":name"].$get({ param: { name: params.name } }))
405
410
  ),
406
411
  create: withSchema(
407
- EntityTypeSchema.extend({ projectId: z3.string().describe("Project ID") }),
412
+ EntityTypeSchema.extend({
413
+ orgId: z3.string().describe("Organization slug"),
414
+ projectId: z3.string().describe("Project ID")
415
+ }),
408
416
  (params) => {
409
- const { projectId, ...body } = params;
410
- return call(proj(projectId)["entity-types"].$post({ json: body }));
417
+ const { orgId, projectId, ...body } = params;
418
+ return call(proj(orgId, projectId)["entity-types"].$post({ json: body }));
411
419
  }
412
420
  ),
413
421
  update: withSchema(
414
- EntityTypeSchema.extend({ projectId: z3.string().describe("Project ID") }),
422
+ EntityTypeSchema.extend({
423
+ orgId: z3.string().describe("Organization slug"),
424
+ projectId: z3.string().describe("Project ID")
425
+ }),
415
426
  (params) => {
416
- const { projectId, ...body } = params;
427
+ const { orgId, projectId, ...body } = params;
417
428
  return call(
418
- proj(projectId)["entity-types"][":name"].$put({ param: { name: params.name }, json: body })
429
+ proj(orgId, projectId)["entity-types"][":name"].$put({ param: { name: params.name }, json: body })
419
430
  );
420
431
  }
421
432
  ),
422
433
  delete: withSchema(
423
434
  z3.object({
435
+ orgId: z3.string().describe("Organization slug"),
424
436
  projectId: z3.string().describe("Project ID"),
425
437
  name: z3.string().describe("Entity type name")
426
438
  }),
427
439
  (params) => call(
428
- proj(params.projectId)["entity-types"][":name"].$delete({ param: { name: params.name } })
440
+ proj(params.orgId, params.projectId)["entity-types"][":name"].$delete({ param: { name: params.name } })
429
441
  )
430
442
  )
431
443
  };
@@ -434,6 +446,7 @@ function createEntitiesClient(projEnv) {
434
446
  return {
435
447
  list: withSchema(
436
448
  z3.object({
449
+ orgId: z3.string().describe("Organization slug"),
437
450
  projectId: z3.string().describe("Project ID"),
438
451
  envName: z3.string().describe("Environment name"),
439
452
  entityType: z3.string().optional().describe("Filter by entity type"),
@@ -443,42 +456,46 @@ function createEntitiesClient(projEnv) {
443
456
  cursor: z3.string().optional().describe("Pagination cursor")
444
457
  }),
445
458
  (params) => {
446
- const { projectId, envName, ...query } = params;
459
+ const { orgId, projectId, envName, ...query } = params;
447
460
  return call(
448
- projEnv(projectId, envName)["entities"].$get({ query: stringifyQuery(query) })
461
+ projEnv(orgId, projectId, envName)["entities"].$get({ query: stringifyQuery(query) })
449
462
  );
450
463
  }
451
464
  ),
452
465
  get: withSchema(
453
466
  z3.object({
467
+ orgId: z3.string().describe("Organization slug"),
454
468
  projectId: z3.string().describe("Project ID"),
455
469
  envName: z3.string().describe("Environment name"),
456
470
  id: z3.string().uuid().describe("Entity ID")
457
471
  }),
458
- (params) => call(projEnv(params.projectId, params.envName)["entities"][":id"].$get({ param: { id: params.id } }))
472
+ (params) => call(projEnv(params.orgId, params.projectId, params.envName)["entities"][":id"].$get({ param: { id: params.id } }))
459
473
  ),
460
474
  create: withSchema(
461
475
  EntitySchema.extend({
476
+ orgId: z3.string().describe("Organization slug"),
462
477
  projectId: z3.string().describe("Project ID"),
463
478
  envName: z3.string().describe("Environment name")
464
479
  }),
465
480
  (params) => {
466
- const { projectId, envName, ...body } = params;
467
- return call(projEnv(projectId, envName)["entities"].$post({ json: body }));
481
+ const { orgId, projectId, envName, ...body } = params;
482
+ return call(projEnv(orgId, projectId, envName)["entities"].$post({ json: body }));
468
483
  }
469
484
  ),
470
485
  delete: withSchema(
471
486
  z3.object({
487
+ orgId: z3.string().describe("Organization slug"),
472
488
  projectId: z3.string().describe("Project ID"),
473
489
  envName: z3.string().describe("Environment name"),
474
490
  id: z3.string().uuid().describe("Entity ID")
475
491
  }),
476
492
  (params) => call(
477
- projEnv(params.projectId, params.envName)["entities"][":id"].$delete({ param: { id: params.id } })
493
+ projEnv(params.orgId, params.projectId, params.envName)["entities"][":id"].$delete({ param: { id: params.id } })
478
494
  )
479
495
  ),
480
496
  setMetric: withSchema(
481
497
  z3.object({
498
+ orgId: z3.string().describe("Organization slug"),
482
499
  projectId: z3.string().describe("Project ID"),
483
500
  envName: z3.string().describe("Environment name"),
484
501
  id: z3.string().uuid().describe("Entity ID"),
@@ -486,9 +503,9 @@ function createEntitiesClient(projEnv) {
486
503
  value: z3.number().describe("Metric value")
487
504
  }),
488
505
  (params) => {
489
- const { projectId, envName, id, metricName, value } = params;
506
+ const { orgId, projectId, envName, id, metricName, value } = params;
490
507
  return call(
491
- projEnv(projectId, envName)["entities"][":id"]["metrics"][":metricName"].$put({
508
+ projEnv(orgId, projectId, envName)["entities"][":id"]["metrics"][":metricName"].$put({
492
509
  param: { id, metricName },
493
510
  json: { value }
494
511
  })
@@ -497,6 +514,7 @@ function createEntitiesClient(projEnv) {
497
514
  ),
498
515
  trigger: withSchema(
499
516
  z3.object({
517
+ orgId: z3.string().describe("Organization slug"),
500
518
  projectId: z3.string().describe("Project ID"),
501
519
  envName: z3.string().describe("Environment name"),
502
520
  id: z3.string().uuid().describe("Entity ID"),
@@ -505,9 +523,9 @@ function createEntitiesClient(projEnv) {
505
523
  recommendations: z3.record(z3.string()).optional().describe("Recommendation selections as JSON")
506
524
  }).describe("Trigger an instance-scope action on a single entity"),
507
525
  (params) => {
508
- const { projectId, envName, id, actionName, parameters, recommendations } = params;
526
+ const { orgId, projectId, envName, id, actionName, parameters, recommendations } = params;
509
527
  return call(
510
- projEnv(projectId, envName)["entities"][":id"]["actions"][":actionName"].$post({
528
+ projEnv(orgId, projectId, envName)["entities"][":id"]["actions"][":actionName"].$post({
511
529
  param: { id, actionName },
512
530
  json: { parameters, recommendations }
513
531
  })
@@ -516,22 +534,24 @@ function createEntitiesClient(projEnv) {
516
534
  ),
517
535
  getMetrics: withSchema(
518
536
  z3.object({
537
+ orgId: z3.string().describe("Organization slug"),
519
538
  projectId: z3.string().describe("Project ID"),
520
539
  envName: z3.string().describe("Environment name"),
521
540
  entityId: z3.string().describe("Entity ID")
522
541
  }),
523
- (params) => call(projEnv(params.projectId, params.envName).entities[":id"].metrics.$get({ param: { id: params.entityId } }))
542
+ (params) => call(projEnv(params.orgId, params.projectId, params.envName).entities[":id"].metrics.$get({ param: { id: params.entityId } }))
524
543
  ),
525
544
  getMetricsBatch: withSchema(
526
545
  z3.object({
546
+ orgId: z3.string().describe("Organization slug"),
527
547
  projectId: z3.string().describe("Project ID"),
528
548
  envName: z3.string().describe("Environment name"),
529
549
  entityIds: z3.array(z3.string().uuid()).min(1).max(500).describe("Entity IDs to fetch metrics for (max 500)")
530
550
  }),
531
551
  (params) => {
532
- const { projectId, envName, entityIds } = params;
552
+ const { orgId, projectId, envName, entityIds } = params;
533
553
  return call(
534
- projEnv(projectId, envName).entities.metrics.$get({
554
+ projEnv(orgId, projectId, envName).entities.metrics.$get({
535
555
  query: { ids: entityIds.join(",") }
536
556
  })
537
557
  );
@@ -539,14 +559,16 @@ function createEntitiesClient(projEnv) {
539
559
  ),
540
560
  getRelationships: withSchema(
541
561
  z3.object({
562
+ orgId: z3.string().describe("Organization slug"),
542
563
  projectId: z3.string().describe("Project ID"),
543
564
  envName: z3.string().describe("Environment name"),
544
565
  entityId: z3.string().describe("Entity ID")
545
566
  }),
546
- (params) => call(projEnv(params.projectId, params.envName).entities[":id"].relationships.$get({ param: { id: params.entityId } }))
567
+ (params) => call(projEnv(params.orgId, params.projectId, params.envName).entities[":id"].relationships.$get({ param: { id: params.entityId } }))
547
568
  ),
548
569
  syncStamp: withSchema(
549
570
  z3.object({
571
+ orgId: z3.string().describe("Organization slug"),
550
572
  projectId: z3.string().describe("Project ID"),
551
573
  envName: z3.string().describe("Environment name"),
552
574
  id: z3.string().uuid().describe("Entity ID"),
@@ -554,9 +576,9 @@ function createEntitiesClient(projEnv) {
554
576
  observedAt: z3.string().datetime().optional().describe("ISO-8601 observation timestamp; defaults to server time")
555
577
  }),
556
578
  (params) => {
557
- const { projectId, envName, id, source, observedAt } = params;
579
+ const { orgId, projectId, envName, id, source, observedAt } = params;
558
580
  return call(
559
- projEnv(projectId, envName)["entities"][":id"]["sync-stamp"].$post({
581
+ projEnv(orgId, projectId, envName)["entities"][":id"]["sync-stamp"].$post({
560
582
  param: { id },
561
583
  json: { source, observedAt }
562
584
  })
@@ -573,76 +595,103 @@ function createCellsClient(proj) {
573
595
  return {
574
596
  list: withSchema(
575
597
  z4.object({
598
+ orgId: z4.string().describe("Organization slug"),
576
599
  projectId: z4.string().describe("Project ID")
577
600
  }),
578
- (params) => call(proj(params.projectId)["cells"].$get())
601
+ (params) => call(proj(params.orgId, params.projectId)["cells"].$get())
579
602
  ),
580
603
  get: withSchema(
581
604
  z4.object({
605
+ orgId: z4.string().describe("Organization slug"),
582
606
  projectId: z4.string().describe("Project ID"),
583
607
  name: z4.string().describe("Cell name")
584
608
  }),
585
- (params) => call(proj(params.projectId)["cells"][":name"].$get({ param: { name: params.name } }))
609
+ (params) => call(proj(params.orgId, params.projectId)["cells"][":name"].$get({ param: { name: params.name } }))
586
610
  ),
587
611
  create: withSchema(
588
- CellSchema.extend({ projectId: z4.string().describe("Project ID") }),
612
+ CellSchema.extend({
613
+ orgId: z4.string().describe("Organization slug"),
614
+ projectId: z4.string().describe("Project ID")
615
+ }),
589
616
  (params) => {
590
- const { projectId, ...body } = params;
591
- return call(proj(projectId)["cells"].$post({ json: body }));
617
+ const { orgId, projectId, ...body } = params;
618
+ return call(proj(orgId, projectId)["cells"].$post({ json: body }));
592
619
  }
593
620
  ),
594
621
  update: withSchema(
595
- CellSchema.extend({ projectId: z4.string().describe("Project ID") }),
622
+ CellSchema.extend({
623
+ orgId: z4.string().describe("Organization slug"),
624
+ projectId: z4.string().describe("Project ID")
625
+ }),
596
626
  (params) => {
597
- const { projectId, ...body } = params;
627
+ const { orgId, projectId, ...body } = params;
598
628
  return call(
599
- proj(projectId)["cells"][":name"].$put({ param: { name: params.name }, json: body })
629
+ proj(orgId, projectId)["cells"][":name"].$put({ param: { name: params.name }, json: body })
600
630
  );
601
631
  }
602
632
  ),
603
633
  delete: withSchema(
604
634
  z4.object({
635
+ orgId: z4.string().describe("Organization slug"),
605
636
  projectId: z4.string().describe("Project ID"),
606
637
  name: z4.string().describe("Cell name")
607
638
  }),
608
- (params) => call(proj(params.projectId)["cells"][":name"].$delete({ param: { name: params.name } }))
639
+ (params) => call(proj(params.orgId, params.projectId)["cells"][":name"].$delete({ param: { name: params.name } }))
609
640
  ),
610
641
  listMembers: withSchema(
611
642
  z4.object({
643
+ orgId: z4.string().describe("Organization slug"),
612
644
  projectId: z4.string().describe("Project ID"),
613
- name: z4.string().describe("Cell name")
645
+ name: z4.string().describe("Cell name"),
646
+ envName: z4.string().describe("Environment name").default("default")
614
647
  }),
615
- (params) => call(
616
- proj(params.projectId)["cells"][":name"]["members"].$get({ param: { name: params.name } })
617
- )
648
+ (params) => {
649
+ const envName = params.envName ?? "default";
650
+ return call(
651
+ proj(params.orgId, params.projectId)["cells"][":name"]["members"].$get({
652
+ param: { name: params.name },
653
+ query: { envName }
654
+ })
655
+ );
656
+ }
618
657
  ),
619
658
  addMember: withSchema(
620
659
  z4.object({
660
+ orgId: z4.string().describe("Organization slug"),
621
661
  projectId: z4.string().describe("Project ID"),
622
662
  name: z4.string().describe("Cell name"),
623
- entityId: z4.string().uuid().describe("Entity ID")
663
+ entityName: z4.string().describe("Entity name (M5-rework natural key)"),
664
+ entityTypeName: z4.string().describe("Entity type name (M5-rework natural key)"),
665
+ envName: z4.string().describe("Environment name").default("default")
624
666
  }),
625
667
  (params) => {
626
- const { projectId, name, entityId } = params;
668
+ const { orgId, projectId, name, entityName, entityTypeName } = params;
669
+ const envName = params.envName ?? "default";
627
670
  return call(
628
- proj(projectId)["cells"][":name"]["members"].$post({
671
+ proj(orgId, projectId)["cells"][":name"]["members"].$post({
629
672
  param: { name },
630
- json: { entityId }
673
+ json: { entityName, entityTypeName, envName }
631
674
  })
632
675
  );
633
676
  }
634
677
  ),
635
678
  removeMember: withSchema(
636
679
  z4.object({
680
+ orgId: z4.string().describe("Organization slug"),
637
681
  projectId: z4.string().describe("Project ID"),
638
682
  name: z4.string().describe("Cell name"),
639
- entityId: z4.string().uuid().describe("Entity ID")
683
+ entityName: z4.string().describe("Entity name (M5-rework natural key)"),
684
+ envName: z4.string().describe("Environment name").default("default")
640
685
  }),
641
- (params) => call(
642
- proj(params.projectId)["cells"][":name"]["members"][":entityId"].$delete({
643
- param: { name: params.name, entityId: params.entityId }
644
- })
645
- )
686
+ (params) => {
687
+ const envName = params.envName ?? "default";
688
+ return call(
689
+ proj(params.orgId, params.projectId)["cells"][":name"]["members"][":entityName"].$delete({
690
+ param: { name: params.name, entityName: params.entityName },
691
+ query: { envName }
692
+ })
693
+ );
694
+ }
646
695
  )
647
696
  };
648
697
  }
@@ -654,34 +703,42 @@ function createRelationshipTypesClient(proj) {
654
703
  return {
655
704
  list: withSchema(
656
705
  z5.object({
706
+ orgId: z5.string().describe("Organization slug"),
657
707
  projectId: z5.string().describe("Project ID")
658
708
  }),
659
- (params) => call(proj(params.projectId)["relationship-types"].$get())
709
+ (params) => call(proj(params.orgId, params.projectId)["relationship-types"].$get())
660
710
  ),
661
711
  get: withSchema(
662
712
  z5.object({
713
+ orgId: z5.string().describe("Organization slug"),
663
714
  projectId: z5.string().describe("Project ID"),
664
715
  name: z5.string().describe("Relationship type name")
665
716
  }),
666
717
  (params) => call(
667
- proj(params.projectId)["relationship-types"][":name"].$get({
718
+ proj(params.orgId, params.projectId)["relationship-types"][":name"].$get({
668
719
  param: { name: params.name }
669
720
  })
670
721
  )
671
722
  ),
672
723
  create: withSchema(
673
- RelationshipTypeSchema.extend({ projectId: z5.string().describe("Project ID") }),
724
+ RelationshipTypeSchema.extend({
725
+ orgId: z5.string().describe("Organization slug"),
726
+ projectId: z5.string().describe("Project ID")
727
+ }),
674
728
  (params) => {
675
- const { projectId, ...body } = params;
676
- return call(proj(projectId)["relationship-types"].$post({ json: body }));
729
+ const { orgId, projectId, ...body } = params;
730
+ return call(proj(orgId, projectId)["relationship-types"].$post({ json: body }));
677
731
  }
678
732
  ),
679
733
  update: withSchema(
680
- RelationshipTypeSchema.extend({ projectId: z5.string().describe("Project ID") }),
734
+ RelationshipTypeSchema.extend({
735
+ orgId: z5.string().describe("Organization slug"),
736
+ projectId: z5.string().describe("Project ID")
737
+ }),
681
738
  (params) => {
682
- const { projectId, ...body } = params;
739
+ const { orgId, projectId, ...body } = params;
683
740
  return call(
684
- proj(projectId)["relationship-types"][":name"].$put({
741
+ proj(orgId, projectId)["relationship-types"][":name"].$put({
685
742
  param: { name: params.name },
686
743
  json: body
687
744
  })
@@ -690,11 +747,12 @@ function createRelationshipTypesClient(proj) {
690
747
  ),
691
748
  delete: withSchema(
692
749
  z5.object({
750
+ orgId: z5.string().describe("Organization slug"),
693
751
  projectId: z5.string().describe("Project ID"),
694
752
  name: z5.string().describe("Relationship type name")
695
753
  }),
696
754
  (params) => call(
697
- proj(params.projectId)["relationship-types"][":name"].$delete({
755
+ proj(params.orgId, params.projectId)["relationship-types"][":name"].$delete({
698
756
  param: { name: params.name }
699
757
  })
700
758
  )
@@ -705,6 +763,7 @@ function createRelationshipsClient(projEnv) {
705
763
  return {
706
764
  list: withSchema(
707
765
  z5.object({
766
+ orgId: z5.string().describe("Organization slug"),
708
767
  projectId: z5.string().describe("Project ID"),
709
768
  envName: z5.string().describe("Environment name"),
710
769
  relationshipType: z5.string().optional().describe("Filter by relationship type"),
@@ -716,40 +775,43 @@ function createRelationshipsClient(projEnv) {
716
775
  limit: z5.coerce.number().int().min(1).max(100).optional().describe("Max results (1-100)")
717
776
  }),
718
777
  (params) => {
719
- const { projectId, envName, ...query } = params;
778
+ const { orgId, projectId, envName, ...query } = params;
720
779
  return call(
721
- projEnv(projectId, envName)["relationships"].$get({ query: stringifyQuery(query) })
780
+ projEnv(orgId, projectId, envName)["relationships"].$get({ query: stringifyQuery(query) })
722
781
  );
723
782
  }
724
783
  ),
725
784
  get: withSchema(
726
785
  z5.object({
786
+ orgId: z5.string().describe("Organization slug"),
727
787
  projectId: z5.string().describe("Project ID"),
728
788
  envName: z5.string().describe("Environment name"),
729
789
  id: z5.string().uuid().describe("Relationship ID")
730
790
  }),
731
791
  (params) => call(
732
- projEnv(params.projectId, params.envName)["relationships"][":id"].$get({ param: { id: params.id } })
792
+ projEnv(params.orgId, params.projectId, params.envName)["relationships"][":id"].$get({ param: { id: params.id } })
733
793
  )
734
794
  ),
735
795
  create: withSchema(
736
796
  RelationshipSchema.extend({
797
+ orgId: z5.string().describe("Organization slug"),
737
798
  projectId: z5.string().describe("Project ID"),
738
799
  envName: z5.string().describe("Environment name")
739
800
  }),
740
801
  (params) => {
741
- const { projectId, envName, ...body } = params;
742
- return call(projEnv(projectId, envName)["relationships"].$post({ json: body }));
802
+ const { orgId, projectId, envName, ...body } = params;
803
+ return call(projEnv(orgId, projectId, envName)["relationships"].$post({ json: body }));
743
804
  }
744
805
  ),
745
806
  delete: withSchema(
746
807
  z5.object({
808
+ orgId: z5.string().describe("Organization slug"),
747
809
  projectId: z5.string().describe("Project ID"),
748
810
  envName: z5.string().describe("Environment name"),
749
811
  id: z5.string().uuid().describe("Relationship ID")
750
812
  }),
751
813
  (params) => call(
752
- projEnv(params.projectId, params.envName)["relationships"][":id"].$delete({ param: { id: params.id } })
814
+ projEnv(params.orgId, params.projectId, params.envName)["relationships"][":id"].$delete({ param: { id: params.id } })
753
815
  )
754
816
  )
755
817
  };
@@ -762,44 +824,54 @@ function createActionsClient(proj, projEnv) {
762
824
  return {
763
825
  list: withSchema(
764
826
  z6.object({
827
+ orgId: z6.string().describe("Organization slug"),
765
828
  projectId: z6.string().describe("Project ID")
766
829
  }),
767
- (params) => call(proj(params.projectId)["actions"].$get())
830
+ (params) => call(proj(params.orgId, params.projectId)["actions"].$get())
768
831
  ),
769
832
  get: withSchema(
770
833
  z6.object({
834
+ orgId: z6.string().describe("Organization slug"),
771
835
  projectId: z6.string().describe("Project ID"),
772
836
  name: z6.string().describe("Action name")
773
837
  }),
774
- (params) => call(proj(params.projectId)["actions"][":name"].$get({ param: { name: params.name } }))
838
+ (params) => call(proj(params.orgId, params.projectId)["actions"][":name"].$get({ param: { name: params.name } }))
775
839
  ),
776
840
  create: withSchema(
777
- ActionSchema.extend({ projectId: z6.string().describe("Project ID") }),
841
+ ActionSchema.extend({
842
+ orgId: z6.string().describe("Organization slug"),
843
+ projectId: z6.string().describe("Project ID")
844
+ }),
778
845
  (params) => {
779
- const { projectId, ...body } = params;
780
- return call(proj(projectId)["actions"].$post({ json: body }));
846
+ const { orgId, projectId, ...body } = params;
847
+ return call(proj(orgId, projectId)["actions"].$post({ json: body }));
781
848
  }
782
849
  ),
783
850
  update: withSchema(
784
- ActionSchema.extend({ projectId: z6.string().describe("Project ID") }),
851
+ ActionSchema.extend({
852
+ orgId: z6.string().describe("Organization slug"),
853
+ projectId: z6.string().describe("Project ID")
854
+ }),
785
855
  (params) => {
786
- const { projectId, ...body } = params;
856
+ const { orgId, projectId, ...body } = params;
787
857
  return call(
788
- proj(projectId)["actions"][":name"].$put({ param: { name: params.name }, json: body })
858
+ proj(orgId, projectId)["actions"][":name"].$put({ param: { name: params.name }, json: body })
789
859
  );
790
860
  }
791
861
  ),
792
862
  delete: withSchema(
793
863
  z6.object({
864
+ orgId: z6.string().describe("Organization slug"),
794
865
  projectId: z6.string().describe("Project ID"),
795
866
  name: z6.string().describe("Action name")
796
867
  }),
797
868
  (params) => call(
798
- proj(params.projectId)["actions"][":name"].$delete({ param: { name: params.name } })
869
+ proj(params.orgId, params.projectId)["actions"][":name"].$delete({ param: { name: params.name } })
799
870
  )
800
871
  ),
801
872
  run: withSchema(
802
873
  z6.object({
874
+ orgId: z6.string().describe("Organization slug"),
803
875
  projectId: z6.string().describe("Project ID"),
804
876
  envName: z6.string().describe("Environment name"),
805
877
  actionName: z6.string().describe("Action name"),
@@ -807,9 +879,9 @@ function createActionsClient(proj, projEnv) {
807
879
  recommendations: z6.record(z6.string()).optional().describe("Recommendation selections as JSON")
808
880
  }),
809
881
  (params) => {
810
- const { projectId, envName, actionName, parameters, recommendations } = params;
882
+ const { orgId, projectId, envName, actionName, parameters, recommendations } = params;
811
883
  return call(
812
- projEnv(projectId, envName)["actions"][":name"]["run"].$post({
884
+ projEnv(orgId, projectId, envName)["actions"][":name"]["run"].$post({
813
885
  param: { name: actionName },
814
886
  json: { parameters, recommendations }
815
887
  })
@@ -822,6 +894,7 @@ function createActionRunsClient(projEnv) {
822
894
  return {
823
895
  list: withSchema(
824
896
  z6.object({
897
+ orgId: z6.string().describe("Organization slug"),
825
898
  projectId: z6.string().describe("Project ID"),
826
899
  envName: z6.string().describe("Environment name"),
827
900
  actionName: z6.string().optional().describe("Filter by action name"),
@@ -830,30 +903,32 @@ function createActionRunsClient(projEnv) {
830
903
  limit: z6.coerce.number().int().min(1).max(100).optional().describe("Max results (1-100)")
831
904
  }),
832
905
  (params) => {
833
- const { projectId, envName, ...query } = params;
906
+ const { orgId, projectId, envName, ...query } = params;
834
907
  return call(
835
- projEnv(projectId, envName)["action-runs"].$get({ query: stringifyQuery(query) })
908
+ projEnv(orgId, projectId, envName)["action-runs"].$get({ query: stringifyQuery(query) })
836
909
  );
837
910
  }
838
911
  ),
839
912
  get: withSchema(
840
913
  z6.object({
914
+ orgId: z6.string().describe("Organization slug"),
841
915
  projectId: z6.string().describe("Project ID"),
842
916
  envName: z6.string().describe("Environment name"),
843
917
  id: z6.string().uuid().describe("Action run ID")
844
918
  }),
845
919
  (params) => call(
846
- projEnv(params.projectId, params.envName)["action-runs"][":id"].$get({ param: { id: params.id } })
920
+ projEnv(params.orgId, params.projectId, params.envName)["action-runs"][":id"].$get({ param: { id: params.id } })
847
921
  )
848
922
  ),
849
923
  cancel: withSchema(
850
924
  z6.object({
925
+ orgId: z6.string().describe("Organization slug"),
851
926
  projectId: z6.string().describe("Project ID"),
852
927
  envName: z6.string().describe("Environment name"),
853
928
  id: z6.string().uuid().describe("Action run ID")
854
929
  }),
855
930
  (params) => call(
856
- projEnv(params.projectId, params.envName)["action-runs"][":id"].$delete({ param: { id: params.id } })
931
+ projEnv(params.orgId, params.projectId, params.envName)["action-runs"][":id"].$delete({ param: { id: params.id } })
857
932
  )
858
933
  )
859
934
  };
@@ -866,56 +941,61 @@ function createSecretsClient(projEnv) {
866
941
  return {
867
942
  list: withSchema(
868
943
  z7.object({
944
+ orgId: z7.string().describe("Organization slug"),
869
945
  projectId: z7.string().describe("Project ID"),
870
946
  envName: z7.string().describe("Environment name")
871
947
  }),
872
- (params) => call(projEnv(params.projectId, params.envName)["secrets"].$get())
948
+ (params) => call(projEnv(params.orgId, params.projectId, params.envName)["secrets"].$get())
873
949
  ),
874
950
  get: withSchema(
875
951
  z7.object({
952
+ orgId: z7.string().describe("Organization slug"),
876
953
  projectId: z7.string().describe("Project ID"),
877
954
  envName: z7.string().describe("Environment name"),
878
955
  name: z7.string().describe("Secret name")
879
956
  }),
880
957
  (params) => call(
881
- projEnv(params.projectId, params.envName)["secrets"][":name"].$get({ param: { name: params.name } })
958
+ projEnv(params.orgId, params.projectId, params.envName)["secrets"][":name"].$get({ param: { name: params.name } })
882
959
  )
883
960
  ),
884
961
  create: withSchema(
885
962
  z7.object({
963
+ orgId: z7.string().describe("Organization slug"),
886
964
  projectId: z7.string().describe("Project ID"),
887
965
  envName: z7.string().describe("Environment name"),
888
966
  name: z7.string().describe("Secret name"),
889
967
  description: z7.string().optional().describe("Description")
890
968
  }),
891
969
  (params) => {
892
- const { projectId, envName, name, description } = params;
970
+ const { orgId, projectId, envName, name, description } = params;
893
971
  return call(
894
- projEnv(projectId, envName)["secrets"].$post({ json: { kind: "Secret", name, description } })
972
+ projEnv(orgId, projectId, envName)["secrets"].$post({ json: { kind: "Secret", name, description } })
895
973
  );
896
974
  }
897
975
  ),
898
976
  delete: withSchema(
899
977
  z7.object({
978
+ orgId: z7.string().describe("Organization slug"),
900
979
  projectId: z7.string().describe("Project ID"),
901
980
  envName: z7.string().describe("Environment name"),
902
981
  name: z7.string().describe("Secret name")
903
982
  }),
904
983
  (params) => call(
905
- projEnv(params.projectId, params.envName)["secrets"][":name"].$delete({ param: { name: params.name } })
984
+ projEnv(params.orgId, params.projectId, params.envName)["secrets"][":name"].$delete({ param: { name: params.name } })
906
985
  )
907
986
  ),
908
987
  setValue: withSchema(
909
988
  z7.object({
989
+ orgId: z7.string().describe("Organization slug"),
910
990
  projectId: z7.string().describe("Project ID"),
911
991
  envName: z7.string().describe("Environment name"),
912
992
  name: z7.string().describe("Secret name"),
913
993
  value: z7.string().min(1).describe("Secret value")
914
994
  }),
915
995
  (params) => {
916
- const { projectId, envName, name, value } = params;
996
+ const { orgId, projectId, envName, name, value } = params;
917
997
  return call(
918
- projEnv(projectId, envName)["secrets"][":name"]["value"].$put({
998
+ projEnv(orgId, projectId, envName)["secrets"][":name"]["value"].$put({
919
999
  param: { name },
920
1000
  json: { value }
921
1001
  })
@@ -927,12 +1007,13 @@ function createSecretsClient(projEnv) {
927
1007
  function createApplyClient(projEnv) {
928
1008
  return withSchema(
929
1009
  ApplyRequestSchema.extend({
1010
+ orgId: z7.string().describe("Organization slug"),
930
1011
  projectId: z7.string().describe("Project ID"),
931
1012
  envName: z7.string().describe("Environment name")
932
1013
  }),
933
1014
  (params) => {
934
- const { projectId, envName, ...body } = params;
935
- return call(projEnv(projectId, envName)["apply"].$post({ json: body }));
1015
+ const { orgId, projectId, envName, ...body } = params;
1016
+ return call(projEnv(orgId, projectId, envName)["apply"].$post({ json: body }));
936
1017
  }
937
1018
  );
938
1019
  }
@@ -945,21 +1026,21 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
945
1026
  z8.object({
946
1027
  projectId: z8.string().describe("Project ID")
947
1028
  }),
948
- (params) => call(cloud.api.github["install-url"].$post({ json: params }))
1029
+ (params) => call(cloud.github["install-url"].$post({ json: params }))
949
1030
  ),
950
1031
  installations: {
951
1032
  list: withSchema(
952
1033
  z8.object({
953
1034
  orgId: z8.string().describe("Organization ID")
954
1035
  }),
955
- (params) => call(cloud.api.github.installations.$get({ query: params }))
1036
+ (params) => call(cloud.github.installations.$get({ query: params }))
956
1037
  ),
957
1038
  repos: withSchema(
958
1039
  z8.object({
959
1040
  installationId: z8.string().describe("Installation row ID")
960
1041
  }),
961
1042
  (params) => call(
962
- cloud.api.github.installations[":installationId"].repos.$get({
1043
+ cloud.github.installations[":installationId"].repos.$get({
963
1044
  param: params
964
1045
  })
965
1046
  )
@@ -969,7 +1050,7 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
969
1050
  installationId: z8.string().describe("Installation row ID")
970
1051
  }),
971
1052
  (params) => call(
972
- cloud.api.github.installations[":installationId"].$delete({
1053
+ cloud.github.installations[":installationId"].$delete({
973
1054
  param: params
974
1055
  })
975
1056
  )
@@ -979,7 +1060,7 @@ function createGithubClient(cloud, _baseUrl, _hcOpts) {
979
1060
  orgId: z8.string().describe("Organization ID"),
980
1061
  installationId: z8.number().int().positive().describe("GitHub installation ID (from the GitHub install URL)")
981
1062
  }),
982
- (params) => call(cloud.api.github.installations.recover.$post({ json: params }))
1063
+ (params) => call(cloud.github.installations.recover.$post({ json: params }))
983
1064
  )
984
1065
  },
985
1066
  projects: {
@@ -1040,12 +1121,13 @@ function stripServerFields(row) {
1040
1121
  function createExportCatalogFn(proj, projEnv) {
1041
1122
  return withSchema(
1042
1123
  z9.object({
1124
+ orgId: z9.string().describe("Organization slug"),
1043
1125
  projectId: z9.string().describe("Project ID"),
1044
1126
  envName: z9.string().describe("Environment name to export secret declarations from")
1045
1127
  }).describe("Export every catalog kind as a single apply-shaped payload"),
1046
1128
  async (params) => {
1047
- const projClient = proj(params.projectId);
1048
- const envClient = projEnv(params.projectId, params.envName);
1129
+ const projClient = proj(params.orgId, params.projectId);
1130
+ const envClient = projEnv(params.orgId, params.projectId, params.envName);
1049
1131
  const [entityTypes, cells, relationshipTypes, actions, secrets] = await Promise.all([
1050
1132
  call(projClient["entity-types"].$get()),
1051
1133
  call(projClient["cells"].$get()),
@@ -1085,32 +1167,35 @@ function createCatalogRevisionsClient(proj) {
1085
1167
  return {
1086
1168
  list: withSchema(
1087
1169
  z10.object({
1170
+ orgId: z10.string().describe("Organization slug"),
1088
1171
  projectId: z10.string().describe("Project ID"),
1089
1172
  limit: z10.coerce.number().int().min(1).max(200).optional().describe("Max revisions to return (1-200)")
1090
1173
  }),
1091
1174
  (params) => {
1092
- const { projectId, ...query } = params;
1175
+ const { orgId, projectId, ...query } = params;
1093
1176
  return call(
1094
- proj(projectId)["catalog-revisions"].$get({ query: stringifyQuery(query) })
1177
+ proj(orgId, projectId)["catalog-revisions"].$get({ query: stringifyQuery(query) })
1095
1178
  );
1096
1179
  }
1097
1180
  ),
1098
1181
  get: withSchema(
1099
1182
  z10.object({
1183
+ orgId: z10.string().describe("Organization slug"),
1100
1184
  projectId: z10.string().describe("Project ID"),
1101
1185
  id: z10.string().uuid().describe("Revision ID")
1102
1186
  }),
1103
1187
  (params) => call(
1104
- proj(params.projectId)["catalog-revisions"][":id"].$get({ param: { id: params.id } })
1188
+ proj(params.orgId, params.projectId)["catalog-revisions"][":id"].$get({ param: { id: params.id } })
1105
1189
  )
1106
1190
  ),
1107
1191
  snapshots: withSchema(
1108
1192
  z10.object({
1193
+ orgId: z10.string().describe("Organization slug"),
1109
1194
  projectId: z10.string().describe("Project ID"),
1110
1195
  id: z10.string().uuid().describe("Revision ID to read snapshots for")
1111
1196
  }),
1112
1197
  (params) => call(
1113
- proj(params.projectId)["catalog-revisions"][":id"]["snapshots"].$get({
1198
+ proj(params.orgId, params.projectId)["catalog-revisions"][":id"]["snapshots"].$get({
1114
1199
  param: { id: params.id }
1115
1200
  })
1116
1201
  )
@@ -1122,15 +1207,16 @@ function createCatalogRevisionsClient(proj) {
1122
1207
  */
1123
1208
  rollback: withSchema(
1124
1209
  z10.object({
1210
+ orgId: z10.string().describe("Organization slug"),
1125
1211
  projectId: z10.string().describe("Project ID"),
1126
1212
  id: z10.string().uuid().describe("Revision ID to roll back to"),
1127
1213
  hunkId: z10.string().uuid().optional().describe("Single-hunk filter"),
1128
1214
  force: z10.boolean().optional().describe("Required if the inverse diff is destructive")
1129
1215
  }),
1130
1216
  (params) => {
1131
- const { projectId, id, hunkId, force } = params;
1217
+ const { orgId, projectId, id, hunkId, force } = params;
1132
1218
  return call(
1133
- proj(projectId)["catalog-revisions"][":id"]["rollback"].$post({
1219
+ proj(orgId, projectId)["catalog-revisions"][":id"]["rollback"].$post({
1134
1220
  param: { id },
1135
1221
  json: { force: force ?? false },
1136
1222
  query: hunkId ? stringifyQuery({ hunkId }) : void 0
@@ -1147,6 +1233,7 @@ function createAuditEventsClient(proj) {
1147
1233
  return {
1148
1234
  list: withSchema(
1149
1235
  z11.object({
1236
+ orgId: z11.string().describe("Organization slug"),
1150
1237
  projectId: z11.string().describe("Project ID"),
1151
1238
  envName: z11.string().optional().describe("Filter to a single env"),
1152
1239
  actorType: z11.enum(["user", "token"]).optional().describe("Filter by actor type"),
@@ -1157,8 +1244,8 @@ function createAuditEventsClient(proj) {
1157
1244
  limit: z11.coerce.number().int().min(1).max(500).optional().describe("Max rows (1-500)")
1158
1245
  }).describe("List audit events for a project \u2014 auditor-friendly read-only feed"),
1159
1246
  (params) => {
1160
- const { projectId, ...query } = params;
1161
- return call(proj(projectId)["audit-events"].$get({ query: stringifyQuery(query) }));
1247
+ const { orgId, projectId, ...query } = params;
1248
+ return call(proj(orgId, projectId)["audit-events"].$get({ query: stringifyQuery(query) }));
1162
1249
  }
1163
1250
  )
1164
1251
  };
@@ -1170,27 +1257,30 @@ function createEnvironmentsClient(proj) {
1170
1257
  return {
1171
1258
  list: withSchema(
1172
1259
  z12.object({
1260
+ orgId: z12.string().describe("Organization slug"),
1173
1261
  projectId: z12.string().describe("Project ID")
1174
1262
  }),
1175
- (params) => call(proj(params.projectId)["environments"].$get())
1263
+ (params) => call(proj(params.orgId, params.projectId)["environments"].$get())
1176
1264
  ),
1177
1265
  create: withSchema(
1178
1266
  z12.object({
1267
+ orgId: z12.string().describe("Organization slug"),
1179
1268
  projectId: z12.string().describe("Project ID"),
1180
1269
  name: z12.string().min(1).max(31).regex(/^[a-z0-9][a-z0-9-]{0,30}$/).describe("Environment name (lowercase letters, digits, hyphens; max 31 chars)")
1181
1270
  }),
1182
1271
  (params) => {
1183
- const { projectId, name } = params;
1184
- return call(proj(projectId)["environments"].$post({ json: { name } }));
1272
+ const { orgId, projectId, name } = params;
1273
+ return call(proj(orgId, projectId)["environments"].$post({ json: { name } }));
1185
1274
  }
1186
1275
  ),
1187
1276
  delete: withSchema(
1188
1277
  z12.object({
1278
+ orgId: z12.string().describe("Organization slug"),
1189
1279
  projectId: z12.string().describe("Project ID"),
1190
1280
  name: z12.string().describe("Environment name")
1191
1281
  }),
1192
1282
  (params) => call(
1193
- proj(params.projectId)["environments"][":envName"].$delete({
1283
+ proj(params.orgId, params.projectId)["environments"][":envName"].$delete({
1194
1284
  param: { envName: params.name }
1195
1285
  })
1196
1286
  )
@@ -1204,6 +1294,7 @@ function createDriftEventsClient(projEnv) {
1204
1294
  return {
1205
1295
  list: withSchema(
1206
1296
  z13.object({
1297
+ orgId: z13.string().describe("Organization slug"),
1207
1298
  projectId: z13.string().describe("Project ID"),
1208
1299
  envName: z13.string().describe("Environment name"),
1209
1300
  status: z13.enum(["open", "accepted", "reapplied", "snoozed"]).optional(),
@@ -1213,61 +1304,69 @@ function createDriftEventsClient(projEnv) {
1213
1304
  limit: z13.coerce.number().int().min(1).max(500).optional()
1214
1305
  }),
1215
1306
  (params) => {
1216
- const { projectId, envName, ...query } = params;
1307
+ const { orgId, projectId, envName, ...query } = params;
1217
1308
  return call(
1218
- projEnv(projectId, envName)["drift-events"].$get({ query: stringifyQuery(query) })
1309
+ projEnv(orgId, projectId, envName)["drift-events"].$get({ query: stringifyQuery(query) })
1219
1310
  );
1220
1311
  }
1221
1312
  ),
1222
1313
  count: withSchema(
1223
- z13.object({ projectId: z13.string(), envName: z13.string() }),
1224
- (params) => call(projEnv(params.projectId, params.envName)["drift-events"].count.$get())
1314
+ z13.object({
1315
+ orgId: z13.string().describe("Organization slug"),
1316
+ projectId: z13.string().describe("Project ID"),
1317
+ envName: z13.string().describe("Environment name")
1318
+ }),
1319
+ (params) => call(projEnv(params.orgId, params.projectId, params.envName)["drift-events"].count.$get())
1225
1320
  ),
1226
1321
  get: withSchema(
1227
1322
  z13.object({
1228
- projectId: z13.string(),
1229
- envName: z13.string(),
1323
+ orgId: z13.string().describe("Organization slug"),
1324
+ projectId: z13.string().describe("Project ID"),
1325
+ envName: z13.string().describe("Environment name"),
1230
1326
  id: z13.string().uuid()
1231
1327
  }),
1232
1328
  (params) => call(
1233
- projEnv(params.projectId, params.envName)["drift-events"][":id"].$get({
1329
+ projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].$get({
1234
1330
  param: { id: params.id }
1235
1331
  })
1236
1332
  )
1237
1333
  ),
1238
1334
  accept: withSchema(
1239
1335
  z13.object({
1240
- projectId: z13.string(),
1241
- envName: z13.string(),
1336
+ orgId: z13.string().describe("Organization slug"),
1337
+ projectId: z13.string().describe("Project ID"),
1338
+ envName: z13.string().describe("Environment name"),
1242
1339
  id: z13.string().uuid()
1243
1340
  }),
1244
1341
  (params) => call(
1245
- projEnv(params.projectId, params.envName)["drift-events"][":id"].accept.$post({
1342
+ projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].accept.$post({
1246
1343
  param: { id: params.id }
1247
1344
  })
1248
1345
  )
1249
1346
  ),
1250
1347
  reapply: withSchema(
1251
1348
  z13.object({
1252
- projectId: z13.string(),
1253
- envName: z13.string(),
1349
+ orgId: z13.string().describe("Organization slug"),
1350
+ projectId: z13.string().describe("Project ID"),
1351
+ envName: z13.string().describe("Environment name"),
1254
1352
  id: z13.string().uuid()
1255
1353
  }),
1256
1354
  (params) => call(
1257
- projEnv(params.projectId, params.envName)["drift-events"][":id"].reapply.$post({
1355
+ projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].reapply.$post({
1258
1356
  param: { id: params.id }
1259
1357
  })
1260
1358
  )
1261
1359
  ),
1262
1360
  snooze: withSchema(
1263
1361
  z13.object({
1264
- projectId: z13.string(),
1265
- envName: z13.string(),
1362
+ orgId: z13.string().describe("Organization slug"),
1363
+ projectId: z13.string().describe("Project ID"),
1364
+ envName: z13.string().describe("Environment name"),
1266
1365
  id: z13.string().uuid(),
1267
1366
  untilSeconds: z13.number().int().positive().optional()
1268
1367
  }),
1269
1368
  (params) => call(
1270
- projEnv(params.projectId, params.envName)["drift-events"][":id"].snooze.$post({
1369
+ projEnv(params.orgId, params.projectId, params.envName)["drift-events"][":id"].snooze.$post({
1271
1370
  param: { id: params.id },
1272
1371
  json: { untilSeconds: params.untilSeconds }
1273
1372
  })
@@ -1284,58 +1383,136 @@ function createStatsClient(proj) {
1284
1383
  return {
1285
1384
  entitiesByState: withSchema(
1286
1385
  z14.object({
1386
+ orgId: z14.string().describe("Organization slug"),
1287
1387
  projectId: z14.string().describe("Project ID"),
1288
1388
  window: WindowSchema,
1289
1389
  bucket: BucketSchema
1290
1390
  }),
1291
1391
  (params) => {
1292
- const { projectId, ...query } = params;
1293
- return call(proj(projectId)["stats"]["entities-by-state"].$get({ query: stringifyQuery(query) }));
1392
+ const { orgId, projectId, ...query } = params;
1393
+ return call(proj(orgId, projectId)["stats"]["entities-by-state"].$get({ query: stringifyQuery(query) }));
1294
1394
  }
1295
1395
  ),
1296
1396
  runsByType: withSchema(
1297
1397
  z14.object({
1398
+ orgId: z14.string().describe("Organization slug"),
1298
1399
  projectId: z14.string().describe("Project ID"),
1299
1400
  window: WindowSchema
1300
1401
  }),
1301
1402
  (params) => {
1302
- const { projectId, ...query } = params;
1303
- return call(proj(projectId)["stats"]["runs-by-type"].$get({ query: stringifyQuery(query) }));
1403
+ const { orgId, projectId, ...query } = params;
1404
+ return call(proj(orgId, projectId)["stats"]["runs-by-type"].$get({ query: stringifyQuery(query) }));
1304
1405
  }
1305
1406
  ),
1306
1407
  failingKinds: withSchema(
1307
1408
  z14.object({
1409
+ orgId: z14.string().describe("Organization slug"),
1308
1410
  projectId: z14.string().describe("Project ID"),
1309
1411
  window: WindowSchema
1310
1412
  }),
1311
1413
  (params) => {
1312
- const { projectId, ...query } = params;
1313
- return call(proj(projectId)["stats"]["failing-kinds"].$get({ query: stringifyQuery(query) }));
1414
+ const { orgId, projectId, ...query } = params;
1415
+ return call(proj(orgId, projectId)["stats"]["failing-kinds"].$get({ query: stringifyQuery(query) }));
1314
1416
  }
1315
1417
  ),
1316
1418
  driftDensity: withSchema(
1317
1419
  z14.object({
1420
+ orgId: z14.string().describe("Organization slug"),
1318
1421
  projectId: z14.string().describe("Project ID"),
1319
1422
  dim: z14.string().optional().describe('Dimensions to bucket \u2014 e.g. "kind,cell"')
1320
1423
  }),
1321
1424
  (params) => {
1322
- const { projectId, ...query } = params;
1323
- return call(proj(projectId)["stats"]["drift-density"].$get({ query: stringifyQuery(query) }));
1425
+ const { orgId, projectId, ...query } = params;
1426
+ return call(proj(orgId, projectId)["stats"]["drift-density"].$get({ query: stringifyQuery(query) }));
1324
1427
  }
1325
1428
  )
1326
1429
  };
1327
1430
  }
1328
1431
 
1329
- // src/notifications.ts
1432
+ // src/graph-views.ts
1330
1433
  import { z as z15 } from "zod";
1434
+ var ViewConfigSchema = z15.unknown();
1435
+ var PinnedPositionsSchema = z15.record(z15.string(), z15.object({ x: z15.number(), y: z15.number() })).nullable();
1436
+ function createGraphViewsClient(proj) {
1437
+ return {
1438
+ list: withSchema(
1439
+ z15.object({
1440
+ orgId: z15.string().describe("Organization slug"),
1441
+ projectId: z15.string().describe("Project ID")
1442
+ }),
1443
+ (params) => call(proj(params.orgId, params.projectId)["graph-views"].$get())
1444
+ ),
1445
+ get: withSchema(
1446
+ z15.object({
1447
+ orgId: z15.string().describe("Organization slug"),
1448
+ projectId: z15.string().describe("Project ID"),
1449
+ id: z15.string().describe("View id")
1450
+ }),
1451
+ (params) => call(proj(params.orgId, params.projectId)["graph-views"][":id"].$get({ param: { id: params.id } }))
1452
+ ),
1453
+ create: withSchema(
1454
+ z15.object({
1455
+ orgId: z15.string().describe("Organization slug"),
1456
+ projectId: z15.string().describe("Project ID"),
1457
+ name: z15.string().describe("View name"),
1458
+ scope: z15.enum(["user", "project"]).describe("Personal or project scope"),
1459
+ config: ViewConfigSchema.describe("ViewConfig JSON"),
1460
+ pinnedPositions: PinnedPositionsSchema.optional().describe("Pinned node positions")
1461
+ }),
1462
+ (params) => {
1463
+ const { orgId, projectId, ...body } = params;
1464
+ return call(proj(orgId, projectId)["graph-views"].$post({ json: body }));
1465
+ }
1466
+ ),
1467
+ update: withSchema(
1468
+ z15.object({
1469
+ orgId: z15.string().describe("Organization slug"),
1470
+ projectId: z15.string().describe("Project ID"),
1471
+ id: z15.string().describe("View id"),
1472
+ name: z15.string().optional().describe("New name"),
1473
+ config: ViewConfigSchema.optional().describe("Replacement ViewConfig JSON"),
1474
+ pinnedPositions: PinnedPositionsSchema.optional().describe("Replacement pinned positions")
1475
+ }),
1476
+ (params) => {
1477
+ const { orgId, projectId, id, ...body } = params;
1478
+ return call(
1479
+ proj(orgId, projectId)["graph-views"][":id"].$put({ param: { id }, json: body })
1480
+ );
1481
+ }
1482
+ ),
1483
+ delete: withSchema(
1484
+ z15.object({
1485
+ orgId: z15.string().describe("Organization slug"),
1486
+ projectId: z15.string().describe("Project ID"),
1487
+ id: z15.string().describe("View id")
1488
+ }),
1489
+ (params) => call(proj(params.orgId, params.projectId)["graph-views"][":id"].$delete({ param: { id: params.id } }))
1490
+ ),
1491
+ setDefault: withSchema(
1492
+ z15.object({
1493
+ orgId: z15.string().describe("Organization slug"),
1494
+ projectId: z15.string().describe("Project ID"),
1495
+ id: z15.string().describe("View id")
1496
+ }),
1497
+ (params) => call(
1498
+ proj(params.orgId, params.projectId)["graph-views"][":id"]["default"].$patch({
1499
+ param: { id: params.id }
1500
+ })
1501
+ )
1502
+ )
1503
+ };
1504
+ }
1505
+
1506
+ // src/notifications.ts
1507
+ import { z as z16 } from "zod";
1331
1508
  import { hc as hc2 } from "hono/client";
1332
1509
  function createNotificationsClient(baseUrl, hcOpts) {
1333
1510
  const c = hc2(`${baseUrl}/notifications`, hcOpts);
1334
1511
  return {
1335
1512
  list: withSchema(
1336
- z15.object({
1337
- limit: z15.coerce.number().int().min(1).max(100).optional(),
1338
- unread: z15.boolean().optional()
1513
+ z16.object({
1514
+ limit: z16.coerce.number().int().min(1).max(100).optional(),
1515
+ unread: z16.boolean().optional()
1339
1516
  }),
1340
1517
  (params) => {
1341
1518
  const query = {};
@@ -1345,18 +1522,18 @@ function createNotificationsClient(baseUrl, hcOpts) {
1345
1522
  }
1346
1523
  ),
1347
1524
  read: withSchema(
1348
- z15.object({ id: z15.string().uuid() }),
1525
+ z16.object({ id: z16.string().uuid() }),
1349
1526
  (params) => call(c[":id"].read.$post({ param: { id: params.id } }))
1350
1527
  ),
1351
1528
  readAll: withSchema(
1352
- z15.object({}),
1529
+ z16.object({}),
1353
1530
  () => call(c["read-all"].$post())
1354
1531
  )
1355
1532
  };
1356
1533
  }
1357
1534
 
1358
1535
  // src/audit-export.ts
1359
- import { z as z16 } from "zod";
1536
+ import { z as z17 } from "zod";
1360
1537
  async function rawRequest(baseUrl, hcOpts, path, init = {}) {
1361
1538
  const fetchImpl = hcOpts?.fetch ?? fetch;
1362
1539
  const rawHeaders = hcOpts?.headers;
@@ -1385,19 +1562,19 @@ function createAuditExportClient(baseUrl, hcOpts) {
1385
1562
  return {
1386
1563
  /** GET /orgs/:orgId/audit-export/config — returns current config or throws 404. */
1387
1564
  getConfig: withSchema(
1388
- z16.object({ orgId: z16.string().describe("Organization ID") }),
1565
+ z17.object({ orgId: z17.string().describe("Organization ID") }),
1389
1566
  async (params) => callRaw(
1390
1567
  await rawRequest(baseUrl, hcOpts, `/orgs/${params.orgId}/audit-export/config`)
1391
1568
  )
1392
1569
  ),
1393
1570
  /** POST /orgs/:orgId/audit-export/config — upsert the S3 export config. */
1394
1571
  setConfig: withSchema(
1395
- z16.object({
1396
- orgId: z16.string().describe("Organization ID"),
1397
- bucket: z16.string().describe("S3 bucket name"),
1398
- region: z16.string().describe("AWS region"),
1399
- roleArn: z16.string().describe("IAM role ARN for assume-role"),
1400
- enabled: z16.boolean().optional().describe("Enable/disable export")
1572
+ z17.object({
1573
+ orgId: z17.string().describe("Organization ID"),
1574
+ bucket: z17.string().describe("S3 bucket name"),
1575
+ region: z17.string().describe("AWS region"),
1576
+ roleArn: z17.string().describe("IAM role ARN for assume-role"),
1577
+ enabled: z17.boolean().optional().describe("Enable/disable export")
1401
1578
  }),
1402
1579
  async (params) => {
1403
1580
  const { orgId, ...body } = params;
@@ -1412,11 +1589,11 @@ function createAuditExportClient(baseUrl, hcOpts) {
1412
1589
  ),
1413
1590
  /** POST /orgs/:orgId/audit-export/test-connection — dry-run write+delete. */
1414
1591
  testConnection: withSchema(
1415
- z16.object({
1416
- orgId: z16.string().describe("Organization ID"),
1417
- bucket: z16.string().describe("S3 bucket name"),
1418
- region: z16.string().describe("AWS region"),
1419
- roleArn: z16.string().describe("IAM role ARN for assume-role")
1592
+ z17.object({
1593
+ orgId: z17.string().describe("Organization ID"),
1594
+ bucket: z17.string().describe("S3 bucket name"),
1595
+ region: z17.string().describe("AWS region"),
1596
+ roleArn: z17.string().describe("IAM role ARN for assume-role")
1420
1597
  }),
1421
1598
  async (params) => {
1422
1599
  const { orgId, ...body } = params;
@@ -1431,9 +1608,9 @@ function createAuditExportClient(baseUrl, hcOpts) {
1431
1608
  ),
1432
1609
  /** GET /orgs/:orgId/audit-export/runs — recent batch run history. */
1433
1610
  listRuns: withSchema(
1434
- z16.object({
1435
- orgId: z16.string().describe("Organization ID"),
1436
- limit: z16.number().optional().describe("Max results (default 20, max 100)")
1611
+ z17.object({
1612
+ orgId: z17.string().describe("Organization ID"),
1613
+ limit: z17.number().optional().describe("Max results (default 20, max 100)")
1437
1614
  }),
1438
1615
  async (params) => {
1439
1616
  const qs = params.limit ? `?limit=${params.limit}` : "";
@@ -1469,47 +1646,53 @@ function createUserPreferencesClient(baseUrl, hcOpts) {
1469
1646
  }
1470
1647
 
1471
1648
  // src/import-sources.ts
1472
- import { z as z17 } from "zod";
1473
- var SourceKindEnum = z17.enum(["tf-state", "atmos-manifests"]);
1474
- var PolicyEnum = z17.enum(["auto-update", "human-approval"]);
1649
+ import { z as z18 } from "zod";
1650
+ var SourceKindEnum = z18.enum(["tf-state", "atmos-manifests"]);
1651
+ var PolicyEnum = z18.enum(["auto-update", "human-approval"]);
1475
1652
  function createImportSourcesClient(proj) {
1476
1653
  return {
1477
1654
  list: withSchema(
1478
- z17.object({ projectId: z17.string().describe("Project ID") }),
1479
- (params) => call(proj(params.projectId)["import-sources"].$get())
1655
+ z18.object({
1656
+ orgId: z18.string().describe("Organization slug"),
1657
+ projectId: z18.string().describe("Project ID")
1658
+ }),
1659
+ (params) => call(proj(params.orgId, params.projectId)["import-sources"].$get())
1480
1660
  ),
1481
1661
  get: withSchema(
1482
- z17.object({
1483
- projectId: z17.string().describe("Project ID"),
1484
- id: z17.string().uuid().describe("ImportSource ID")
1662
+ z18.object({
1663
+ orgId: z18.string().describe("Organization slug"),
1664
+ projectId: z18.string().describe("Project ID"),
1665
+ id: z18.string().uuid().describe("ImportSource ID")
1485
1666
  }),
1486
- (params) => call(proj(params.projectId)["import-sources"][":id"].$get({ param: { id: params.id } }))
1667
+ (params) => call(proj(params.orgId, params.projectId)["import-sources"][":id"].$get({ param: { id: params.id } }))
1487
1668
  ),
1488
1669
  registerOrUpdate: withSchema(
1489
- z17.object({
1490
- projectId: z17.string().describe("Project ID"),
1491
- envName: z17.string().describe("Env name the source belongs to"),
1670
+ z18.object({
1671
+ orgId: z18.string().describe("Organization slug"),
1672
+ projectId: z18.string().describe("Project ID"),
1673
+ envName: z18.string().describe("Env name the source belongs to"),
1492
1674
  sourceKind: SourceKindEnum,
1493
- sourceUri: z17.string().describe("Stable URI identifying the source"),
1675
+ sourceUri: z18.string().describe("Stable URI identifying the source"),
1494
1676
  reconciliationPolicy: PolicyEnum.optional()
1495
1677
  }),
1496
1678
  (params) => {
1497
- const { projectId, ...body } = params;
1498
- return call(proj(projectId)["import-sources"].$post({ json: body }));
1679
+ const { orgId, projectId, ...body } = params;
1680
+ return call(proj(orgId, projectId)["import-sources"].$post({ json: body }));
1499
1681
  }
1500
1682
  ),
1501
1683
  rescan: withSchema(
1502
- z17.object({
1503
- projectId: z17.string(),
1504
- id: z17.string().uuid(),
1505
- envName: z17.string(),
1506
- items: z17.array(z17.unknown()),
1507
- deletions: z17.array(z17.object({ kind: z17.string(), name: z17.string() })).optional()
1684
+ z18.object({
1685
+ orgId: z18.string().describe("Organization slug"),
1686
+ projectId: z18.string().describe("Project ID"),
1687
+ id: z18.string().uuid(),
1688
+ envName: z18.string(),
1689
+ items: z18.array(z18.unknown()),
1690
+ deletions: z18.array(z18.object({ kind: z18.string(), name: z18.string() })).optional()
1508
1691
  }),
1509
1692
  (params) => {
1510
- const { projectId, id, ...body } = params;
1693
+ const { orgId, projectId, id, ...body } = params;
1511
1694
  return call(
1512
- proj(projectId)["import-sources"][":id"].rescan.$post({
1695
+ proj(orgId, projectId)["import-sources"][":id"].rescan.$post({
1513
1696
  param: { id },
1514
1697
  // why: the Hono RPC type for the body is the AnyKindSchema union;
1515
1698
  // the SDK accepts `unknown[]` so callers don't have to re-import the
@@ -1520,32 +1703,35 @@ function createImportSourcesClient(proj) {
1520
1703
  }
1521
1704
  ),
1522
1705
  drift: withSchema(
1523
- z17.object({
1524
- projectId: z17.string(),
1525
- id: z17.string().uuid()
1706
+ z18.object({
1707
+ orgId: z18.string().describe("Organization slug"),
1708
+ projectId: z18.string().describe("Project ID"),
1709
+ id: z18.string().uuid()
1526
1710
  }),
1527
- (params) => call(proj(params.projectId)["import-sources"][":id"].drift.$get({ param: { id: params.id } }))
1711
+ (params) => call(proj(params.orgId, params.projectId)["import-sources"][":id"].drift.$get({ param: { id: params.id } }))
1528
1712
  ),
1529
1713
  approveProposal: withSchema(
1530
- z17.object({
1531
- projectId: z17.string(),
1532
- id: z17.string().uuid(),
1533
- proposalId: z17.string().uuid()
1714
+ z18.object({
1715
+ orgId: z18.string().describe("Organization slug"),
1716
+ projectId: z18.string().describe("Project ID"),
1717
+ id: z18.string().uuid(),
1718
+ proposalId: z18.string().uuid()
1534
1719
  }),
1535
1720
  (params) => call(
1536
- proj(params.projectId)["import-sources"][":id"]["drift-proposals"][":proposalId"].approve.$post({
1721
+ proj(params.orgId, params.projectId)["import-sources"][":id"]["drift-proposals"][":proposalId"].approve.$post({
1537
1722
  param: { id: params.id, proposalId: params.proposalId }
1538
1723
  })
1539
1724
  )
1540
1725
  ),
1541
1726
  rejectProposal: withSchema(
1542
- z17.object({
1543
- projectId: z17.string(),
1544
- id: z17.string().uuid(),
1545
- proposalId: z17.string().uuid()
1727
+ z18.object({
1728
+ orgId: z18.string().describe("Organization slug"),
1729
+ projectId: z18.string().describe("Project ID"),
1730
+ id: z18.string().uuid(),
1731
+ proposalId: z18.string().uuid()
1546
1732
  }),
1547
1733
  (params) => call(
1548
- proj(params.projectId)["import-sources"][":id"]["drift-proposals"][":proposalId"].reject.$post({
1734
+ proj(params.orgId, params.projectId)["import-sources"][":id"]["drift-proposals"][":proposalId"].reject.$post({
1549
1735
  param: { id: params.id, proposalId: params.proposalId }
1550
1736
  })
1551
1737
  )
@@ -1554,7 +1740,7 @@ function createImportSourcesClient(proj) {
1554
1740
  }
1555
1741
 
1556
1742
  // src/admin.ts
1557
- import { z as z18 } from "zod";
1743
+ import { z as z19 } from "zod";
1558
1744
  async function rawRequest2(baseUrl, hcOpts, path, init = {}) {
1559
1745
  const fetchImpl = hcOpts?.fetch ?? fetch;
1560
1746
  const rawHeaders = hcOpts?.headers;
@@ -1587,14 +1773,14 @@ function createAdminClient(baseUrl, hcOpts) {
1587
1773
  * List super-admin audit events with optional filters.
1588
1774
  */
1589
1775
  list: withSchema(
1590
- z18.object({
1591
- actor: z18.string().optional().describe("Filter by actor user ID"),
1592
- action: z18.string().optional().describe("Filter by action name"),
1593
- resourceKind: z18.string().optional().describe("Filter by resource kind"),
1594
- since: z18.string().optional().describe("ISO 8601 datetime lower bound"),
1595
- until: z18.string().optional().describe("ISO 8601 datetime upper bound"),
1596
- limit: z18.coerce.number().int().min(1).max(200).optional().describe("Max results (1-200)"),
1597
- offset: z18.coerce.number().int().min(0).optional().describe("Pagination offset")
1776
+ z19.object({
1777
+ actor: z19.string().optional().describe("Filter by actor user ID"),
1778
+ action: z19.string().optional().describe("Filter by action name"),
1779
+ resourceKind: z19.string().optional().describe("Filter by resource kind"),
1780
+ since: z19.string().optional().describe("ISO 8601 datetime lower bound"),
1781
+ until: z19.string().optional().describe("ISO 8601 datetime upper bound"),
1782
+ limit: z19.coerce.number().int().min(1).max(200).optional().describe("Max results (1-200)"),
1783
+ offset: z19.coerce.number().int().min(0).optional().describe("Pagination offset")
1598
1784
  }),
1599
1785
  async (params) => {
1600
1786
  const qs = new URLSearchParams();
@@ -1618,7 +1804,7 @@ function createAdminClient(baseUrl, hcOpts) {
1618
1804
  * List all organizations across tenants with member + project counts.
1619
1805
  */
1620
1806
  list: withSchema(
1621
- z18.object({}),
1807
+ z19.object({}),
1622
1808
  async () => callRaw2(
1623
1809
  await rawRequest2(baseUrl, hcOpts, "/admin/orgs")
1624
1810
  )
@@ -1628,7 +1814,7 @@ function createAdminClient(baseUrl, hcOpts) {
1628
1814
  * Detail view: org fields + member list + project list.
1629
1815
  */
1630
1816
  get: withSchema(
1631
- z18.object({ id: z18.string().describe("Organization ID") }),
1817
+ z19.object({ id: z19.string().describe("Organization ID") }),
1632
1818
  async (params) => callRaw2(
1633
1819
  await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}`)
1634
1820
  )
@@ -1638,7 +1824,7 @@ function createAdminClient(baseUrl, hcOpts) {
1638
1824
  * Set suspended_at = now(). Idempotent.
1639
1825
  */
1640
1826
  suspend: withSchema(
1641
- z18.object({ id: z18.string().describe("Organization ID") }),
1827
+ z19.object({ id: z19.string().describe("Organization ID") }),
1642
1828
  async (params) => callRaw2(
1643
1829
  await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/suspend`, {
1644
1830
  method: "POST"
@@ -1650,7 +1836,7 @@ function createAdminClient(baseUrl, hcOpts) {
1650
1836
  * Clear suspended_at.
1651
1837
  */
1652
1838
  unsuspend: withSchema(
1653
- z18.object({ id: z18.string().describe("Organization ID") }),
1839
+ z19.object({ id: z19.string().describe("Organization ID") }),
1654
1840
  async (params) => callRaw2(
1655
1841
  await rawRequest2(baseUrl, hcOpts, `/admin/orgs/${params.id}/unsuspend`, {
1656
1842
  method: "POST"
@@ -1666,7 +1852,7 @@ function createAdminClient(baseUrl, hcOpts) {
1666
1852
  * api tokens, and environments. Idempotent. Super-admin only.
1667
1853
  */
1668
1854
  nuke: withSchema(
1669
- z18.object({ projectId: z18.string().describe("Project ID to nuke") }),
1855
+ z19.object({ projectId: z19.string().describe("Project ID to nuke") }),
1670
1856
  async (params) => callRaw2(
1671
1857
  await rawRequest2(
1672
1858
  baseUrl,
@@ -1684,7 +1870,7 @@ function createAdminClient(baseUrl, hcOpts) {
1684
1870
  * all derived from single-table COUNT queries.
1685
1871
  */
1686
1872
  overview: withSchema(
1687
- z18.object({}),
1873
+ z19.object({}),
1688
1874
  async () => callRaw2(
1689
1875
  await rawRequest2(baseUrl, hcOpts, "/admin/metrics/overview")
1690
1876
  )
@@ -1699,7 +1885,7 @@ function createAdminClient(baseUrl, hcOpts) {
1699
1885
  * Requires super-admin.
1700
1886
  */
1701
1887
  list: withSchema(
1702
- z18.object({}),
1888
+ z19.object({}),
1703
1889
  async () => callRaw2(
1704
1890
  await rawRequest2(
1705
1891
  baseUrl,
@@ -1719,9 +1905,9 @@ var createClient = (baseUrl, options = {}) => {
1719
1905
  const headers = buildHeaders(opts.token);
1720
1906
  const fetchImpl = opts.fetch;
1721
1907
  const hcOpts = fetchImpl ? { headers, fetch: fetchImpl } : { headers };
1722
- const cloud = hc4(baseUrl, hcOpts);
1723
- const proj = (projectId) => hc4(`${baseUrl}/projects/${projectId}`, hcOpts);
1724
- const projEnv = (projectId, envName) => hc4(`${baseUrl}/projects/${projectId}/envs/${envName}`, hcOpts);
1908
+ const cloud = hc4(`${baseUrl}`, hcOpts);
1909
+ const proj = (orgId, projectId) => hc4(`${baseUrl}/${orgId}/${projectId}`, hcOpts);
1910
+ const projEnv = (orgId, projectId, envName) => hc4(`${baseUrl}/${orgId}/${projectId}/envs/${envName}`, hcOpts);
1725
1911
  const cells = createCellsClient(proj);
1726
1912
  const catalogRevisions = createCatalogRevisionsClient(proj);
1727
1913
  const exportCatalog = createExportCatalogFn(proj, projEnv);
@@ -1743,6 +1929,7 @@ var createClient = (baseUrl, options = {}) => {
1743
1929
  auditEvents: createAuditEventsClient(proj),
1744
1930
  driftEvents: createDriftEventsClient(projEnv),
1745
1931
  stats: createStatsClient(proj),
1932
+ graphViews: createGraphViewsClient(proj),
1746
1933
  notifications: createNotificationsClient(baseUrl, hcOpts),
1747
1934
  auditExport: createAuditExportClient(baseUrl, hcOpts),
1748
1935
  userPreferences: createUserPreferencesClient(baseUrl, hcOpts),