@canopy-io/node 0.3.4 → 0.3.6

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/index.js CHANGED
@@ -768,6 +768,127 @@ var Organizations = class {
768
768
  `/api/v1/organizations/${enc(id)}/sso-connections/${enc(connectionId)}`
769
769
  );
770
770
  }
771
+ // ── Directory sync: the organization's own SCIM connection ──
772
+ /**
773
+ * The roles this organization's identity provider may grant, and the one
774
+ * people arrive with. An empty list means directory sync is not open for
775
+ * the organization.
776
+ */
777
+ listDirectoryGrantableRoles(id) {
778
+ return this.client.request(
779
+ "GET",
780
+ `/api/v1/organizations/${enc(id)}/directory/grantable-roles`
781
+ );
782
+ }
783
+ /**
784
+ * Replace the list in one act, which is how directory sync is opened for
785
+ * an organization. Exactly one role is `default_role_id`, the one people
786
+ * arrive with. Withdrawing a role unmaps the groups naming it and keeps
787
+ * their members in the organization; an empty list is refused while a
788
+ * directory is connected. Your API key only: an organization admin's
789
+ * token can read the list but is refused changing it.
790
+ */
791
+ setDirectoryGrantableRoles(id, input) {
792
+ return this.client.request(
793
+ "PUT",
794
+ `/api/v1/organizations/${enc(id)}/directory/grantable-roles`,
795
+ { body: input }
796
+ );
797
+ }
798
+ /**
799
+ * The organization's directory, its full SCIM base URL, and the roles it
800
+ * may grant. `id` is null until a directory is connected.
801
+ */
802
+ getDirectory(id) {
803
+ return this.client.request(
804
+ "GET",
805
+ `/api/v1/organizations/${enc(id)}/directory`
806
+ );
807
+ }
808
+ /** Connect a directory. Refused until the organization's roles are set. */
809
+ createDirectory(id) {
810
+ return this.client.request(
811
+ "POST",
812
+ `/api/v1/organizations/${enc(id)}/directory`
813
+ );
814
+ }
815
+ /**
816
+ * End the connection. The people it provisioned keep their accounts and
817
+ * their membership; what ends is the provider's ability to push.
818
+ */
819
+ removeDirectory(id) {
820
+ return this.client.request(
821
+ "DELETE",
822
+ `/api/v1/organizations/${enc(id)}/directory`
823
+ );
824
+ }
825
+ listDirectoryTokens(id) {
826
+ return this.client.request(
827
+ "GET",
828
+ `/api/v1/organizations/${enc(id)}/directory/tokens`
829
+ );
830
+ }
831
+ /**
832
+ * The raw token is in this answer and nowhere else, alongside the full
833
+ * base URL the identity provider's connector needs with it.
834
+ */
835
+ mintDirectoryToken(id, input = {}) {
836
+ return this.client.request(
837
+ "POST",
838
+ `/api/v1/organizations/${enc(id)}/directory/tokens`,
839
+ { body: input }
840
+ );
841
+ }
842
+ /**
843
+ * A replacement token, shown once. The old one keeps working for a short
844
+ * overlap, so the provider can be moved across without an outage.
845
+ */
846
+ rotateDirectoryToken(id, tokenId, input = {}) {
847
+ return this.client.request(
848
+ "POST",
849
+ `/api/v1/organizations/${enc(id)}/directory/tokens/${enc(tokenId)}/rotate`,
850
+ { body: input }
851
+ );
852
+ }
853
+ revokeDirectoryToken(id, tokenId) {
854
+ return this.client.request(
855
+ "DELETE",
856
+ `/api/v1/organizations/${enc(id)}/directory/tokens/${enc(tokenId)}`
857
+ );
858
+ }
859
+ /** The organization's own provisioning events, newest first. */
860
+ listDirectoryActivity(id) {
861
+ return this.client.request(
862
+ "GET",
863
+ `/api/v1/organizations/${enc(id)}/directory/activity`
864
+ );
865
+ }
866
+ /** The groups the provider has pushed, each with its role mapping. */
867
+ listDirectoryGroups(id) {
868
+ return this.client.request(
869
+ "GET",
870
+ `/api/v1/organizations/${enc(id)}/directory/groups`
871
+ );
872
+ }
873
+ /**
874
+ * Grant a listed role to every member of a pushed group, at the
875
+ * organization. A role not on the organization's list is refused with
876
+ * `scim.role_not_grantable`.
877
+ */
878
+ mapDirectoryGroup(id, groupId, input) {
879
+ return this.client.request(
880
+ "PUT",
881
+ `/api/v1/organizations/${enc(id)}/directory/groups/${enc(groupId)}/mapping`,
882
+ { body: input }
883
+ );
884
+ }
885
+ /** Members fall back to the arrival role and stay in the organization. */
886
+ unmapDirectoryGroup(id, groupId) {
887
+ return this.client.request(
888
+ "DELETE",
889
+ `/api/v1/organizations/${enc(id)}/directory/groups/${enc(groupId)}/mapping`
890
+ );
891
+ }
771
892
  };
772
893
  function enc(segment) {
773
894
  return encodeURIComponent(segment);
@@ -1483,6 +1604,11 @@ var TokenVerifier = class {
1483
1604
  }
1484
1605
  };
1485
1606
 
1486
- export { Assignments, Canopy, CanopyAuthorizerError, CanopyClient, CanopyConnectionError, CanopyError, CanopyTokenError, Identities, LocalAuthorizer, Organizations, Paginator, Permissions, Roles, TokenVerifier, isCanopyAuthorizerError, isCanopyConnectionError, isCanopyError, isCanopyTokenError, isCursorPagination, orgContext, paginate, withConcurrency };
1607
+ // src/webhooks.ts
1608
+ function isWebhookEvent(delivery, name) {
1609
+ return delivery.event === name;
1610
+ }
1611
+
1612
+ export { Assignments, Canopy, CanopyAuthorizerError, CanopyClient, CanopyConnectionError, CanopyError, CanopyTokenError, Identities, LocalAuthorizer, Organizations, Paginator, Permissions, Roles, TokenVerifier, isCanopyAuthorizerError, isCanopyConnectionError, isCanopyError, isCanopyTokenError, isCursorPagination, isWebhookEvent, orgContext, paginate, withConcurrency };
1487
1613
  //# sourceMappingURL=index.js.map
1488
1614
  //# sourceMappingURL=index.js.map