@canopy-io/node 0.11.0 → 0.12.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/CHANGELOG.md +8 -0
- package/README.md +14 -4
- package/dist/index.cjs +25 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1506 -256
- package/dist/index.d.ts +1506 -256
- package/dist/index.js +25 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -471,6 +471,14 @@ function paginate(fetchPage, initial = {}, options = {}) {
|
|
|
471
471
|
return new Paginator(fetchPage, initial, options);
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
// src/schema.ts
|
|
475
|
+
function withConcurrency(options = {}) {
|
|
476
|
+
if (options.ifMatch === void 0) {
|
|
477
|
+
return {};
|
|
478
|
+
}
|
|
479
|
+
return { headers: { "If-Match": options.ifMatch } };
|
|
480
|
+
}
|
|
481
|
+
|
|
474
482
|
// src/resources/assignments.ts
|
|
475
483
|
var Assignments = class {
|
|
476
484
|
constructor(client) {
|
|
@@ -496,11 +504,16 @@ var Assignments = class {
|
|
|
496
504
|
create(input) {
|
|
497
505
|
return this.client.request("POST", "/api/v1/assignments", { body: input });
|
|
498
506
|
}
|
|
499
|
-
|
|
507
|
+
/**
|
|
508
|
+
* Change the role or the window of a grant. Pass the `version` the
|
|
509
|
+
* assignment was read with as `ifMatch`; a stale one answers 409
|
|
510
|
+
* `assignment.version_mismatch` rather than overwriting a newer change.
|
|
511
|
+
*/
|
|
512
|
+
update(id, input, options = {}) {
|
|
500
513
|
return this.client.request(
|
|
501
514
|
"PATCH",
|
|
502
515
|
`/api/v1/assignments/${encodeURIComponent(id)}`,
|
|
503
|
-
{ body: input }
|
|
516
|
+
{ body: input, ...withConcurrency(options) }
|
|
504
517
|
);
|
|
505
518
|
}
|
|
506
519
|
delete(id) {
|
|
@@ -675,14 +688,6 @@ var Identities = class {
|
|
|
675
688
|
}
|
|
676
689
|
};
|
|
677
690
|
|
|
678
|
-
// src/schema.ts
|
|
679
|
-
function withConcurrency(options = {}) {
|
|
680
|
-
if (options.ifMatch === void 0) {
|
|
681
|
-
return {};
|
|
682
|
-
}
|
|
683
|
-
return { headers: { "If-Match": options.ifMatch } };
|
|
684
|
-
}
|
|
685
|
-
|
|
686
691
|
// src/resources/organizations.ts
|
|
687
692
|
var Organizations = class {
|
|
688
693
|
constructor(client) {
|
|
@@ -732,7 +737,7 @@ var Organizations = class {
|
|
|
732
737
|
deleteAll() {
|
|
733
738
|
return this.client.request("DELETE", "/api/v1/organizations");
|
|
734
739
|
}
|
|
735
|
-
// ── Members:
|
|
740
|
+
// ── Members: admission to the organization, apart from the roles held in it ──
|
|
736
741
|
listMembers(id, query = {}) {
|
|
737
742
|
return paginate(
|
|
738
743
|
(params) => this.client.request("GET", `/api/v1/organizations/${enc(id)}/members`, {
|
|
@@ -748,14 +753,12 @@ var Organizations = class {
|
|
|
748
753
|
{ body: input }
|
|
749
754
|
);
|
|
750
755
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
/** Revokes that organization's one role; the identity and its other memberships are untouched. */
|
|
756
|
+
/**
|
|
757
|
+
* Deactivates the membership and revokes every role the member holds at
|
|
758
|
+
* the organization's nodes; the identity and its other memberships are
|
|
759
|
+
* untouched. A role in the organization is changed through the
|
|
760
|
+
* organization's assignment routes, not here.
|
|
761
|
+
*/
|
|
759
762
|
removeMember(id, identityId) {
|
|
760
763
|
return this.client.request(
|
|
761
764
|
"DELETE",
|
|
@@ -1769,11 +1772,11 @@ function resolveIssuer(options) {
|
|
|
1769
1772
|
);
|
|
1770
1773
|
}
|
|
1771
1774
|
function orgContext(claims) {
|
|
1772
|
-
const { org_id,
|
|
1773
|
-
if (typeof org_id !== "string" || org_id === "" || typeof
|
|
1775
|
+
const { org_id, org_roles } = claims;
|
|
1776
|
+
if (typeof org_id !== "string" || org_id === "" || !Array.isArray(org_roles) || org_roles.some((role) => typeof role !== "string" || role === "")) {
|
|
1774
1777
|
return null;
|
|
1775
1778
|
}
|
|
1776
|
-
return { orgId: org_id,
|
|
1779
|
+
return { orgId: org_id, orgRoles: [...org_roles] };
|
|
1777
1780
|
}
|
|
1778
1781
|
function decodeBase64Url(value) {
|
|
1779
1782
|
const padded = value.replace(/-/g, "+").replace(/_/g, "/");
|