@mondaydotcomorg/monday-authorization 3.4.0-feature-bashanye-add-membership-create-delete-api-9ba3b16 → 3.5.0-feat-use-profile-for-graph-can-action-in-scope-f1451ab
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/README.md +2 -2
- package/dist/clients/graph-api.d.ts.map +1 -1
- package/dist/clients/graph-api.js +1 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/esm/clients/graph-api.d.ts.map +1 -1
- package/dist/esm/clients/graph-api.mjs +2 -1
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.mjs +5 -1
- package/dist/esm/memberships.d.ts +3 -4
- package/dist/esm/memberships.d.ts.map +1 -1
- package/dist/esm/memberships.mjs +7 -8
- package/dist/esm/types/memberships.d.ts +1 -1
- package/dist/esm/types/memberships.d.ts.map +1 -1
- package/dist/memberships.d.ts +3 -4
- package/dist/memberships.d.ts.map +1 -1
- package/dist/memberships.js +7 -8
- package/dist/types/memberships.d.ts +1 -1
- package/dist/types/memberships.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/graph-api.ts +2 -1
- package/src/constants.ts +4 -0
- package/src/memberships.ts +7 -8
- package/src/types/memberships.ts +2 -2
package/README.md
CHANGED
|
@@ -47,8 +47,8 @@ startServer(...)
|
|
|
47
47
|
|
|
48
48
|
- `prometheus` (optional) enables the legacy Prometheus summary `authorization_check_response_time` with labels `resourceType`, `action`, `isAuthorized`, and `responseStatus`.
|
|
49
49
|
- `metrics` (optional) enables StatsD emission through `@mondaydotcomorg/monday-observability-kit` with:
|
|
50
|
-
- `authorization.authorizationCheck.platform
|
|
51
|
-
- `authorization.authorizationCheck.platform
|
|
50
|
+
- `authorization.authorizationCheck.platform.<API>.duration` / `.graph.<API>.duration` (distributions per API path)
|
|
51
|
+
- `authorization.authorizationCheck.platform.<API>.error` / `.graph.<API>.error` counters (with `statusCode` tag)
|
|
52
52
|
- When `metrics.disabled` is omitted, the SDK automatically disables StatsD in `test`/`development` environments.
|
|
53
53
|
- StatsD requires `DOGSTATSD_HOST` / `DOGSTATSD_PORT` (or the defaults `localhost:8125`). Errors are logged and skipped if the client is unavailable.
|
|
54
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.d.ts","sourceRoot":"","sources":["../../src/clients/graph-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,0BAA0B,EAG3B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEL,sBAAsB,EAMvB,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;;IAezC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-api.d.ts","sourceRoot":"","sources":["../../src/clients/graph-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,0BAA0B,EAG3B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEL,sBAAsB,EAMvB,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;;IAezC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiCzG;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiC1B;;OAEG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAMxC,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAWjC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { RecursivePartial } from '@mondaydotcomorg/monday-fetch-api';
|
|
|
2
2
|
import { FetcherConfig } from '@mondaydotcomorg/trident-backend-api';
|
|
3
3
|
export declare const APP_NAME = "authorization";
|
|
4
4
|
export declare const GRAPH_APP_NAME = "authorization-graph";
|
|
5
|
+
export declare enum GraphProfile {
|
|
6
|
+
PERMISSION = "authorization-graph-permission"
|
|
7
|
+
}
|
|
5
8
|
export declare const ERROR_MESSAGES: {
|
|
6
9
|
readonly HTTP_CLIENT_NOT_INITIALIZED: "MondayAuthorization: HTTP client is not initialized";
|
|
7
10
|
readonly REQUEST_FAILED: (method: string, status: number, reason: string) => string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,cAAc;;sCAEA,MAAM,UAAU,MAAM,UAAU,MAAM;CAEvD,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,aAAa,CAUjE,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,oBAAY,YAAY;IACtB,UAAU,mCAAmC;CAC9C;AAED,eAAO,MAAM,cAAc;;sCAEA,MAAM,UAAU,MAAM,UAAU,MAAM;CAEvD,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,aAAa,CAUjE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -2,6 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const APP_NAME = 'authorization';
|
|
4
4
|
const GRAPH_APP_NAME = 'authorization-graph';
|
|
5
|
+
exports.GraphProfile = void 0;
|
|
6
|
+
(function (GraphProfile) {
|
|
7
|
+
GraphProfile["PERMISSION"] = "authorization-graph-permission";
|
|
8
|
+
})(exports.GraphProfile || (exports.GraphProfile = {}));
|
|
5
9
|
const ERROR_MESSAGES = {
|
|
6
10
|
HTTP_CLIENT_NOT_INITIALIZED: 'MondayAuthorization: HTTP client is not initialized',
|
|
7
11
|
REQUEST_FAILED: (method, status, reason) => `MondayAuthorization: [${method}] request failed with status ${status} with reason: ${reason}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.d.ts","sourceRoot":"","sources":["../../../src/clients/graph-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,0BAA0B,EAG3B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEL,sBAAsB,EAMvB,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;;IAezC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-api.d.ts","sourceRoot":"","sources":["../../../src/clients/graph-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,0BAA0B,EAG3B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEL,sBAAsB,EAMvB,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;;IAezC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiCzG;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiC1B;;OAEG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAMxC,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAWjC"}
|
|
@@ -4,7 +4,7 @@ import { PermitTechnicalReason } from '../types/scoped-actions-contracts.mjs';
|
|
|
4
4
|
import { AuthorizationInternalService } from '../authorization-internal-service.mjs';
|
|
5
5
|
import { getAttributionsFromApi } from '../attributions-service.mjs';
|
|
6
6
|
import { scopeToResource } from '../utils/authorization.utils.mjs';
|
|
7
|
-
import { GRAPH_APP_NAME } from '../constants.mjs';
|
|
7
|
+
import { GRAPH_APP_NAME, GraphProfile } from '../constants.mjs';
|
|
8
8
|
import { handleApiError } from '../utils/api-error-handler.mjs';
|
|
9
9
|
|
|
10
10
|
const CAN_ACTION_IN_SCOPE_GRAPH_PATH = '/permissions/is-allowed';
|
|
@@ -63,6 +63,7 @@ class GraphApi {
|
|
|
63
63
|
url: {
|
|
64
64
|
appName: GRAPH_APP_NAME,
|
|
65
65
|
path: CAN_ACTION_IN_SCOPE_GRAPH_PATH,
|
|
66
|
+
profile: GraphProfile.PERMISSION,
|
|
66
67
|
},
|
|
67
68
|
method: 'POST',
|
|
68
69
|
headers: {
|
package/dist/esm/constants.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { RecursivePartial } from '@mondaydotcomorg/monday-fetch-api';
|
|
|
2
2
|
import { FetcherConfig } from '@mondaydotcomorg/trident-backend-api';
|
|
3
3
|
export declare const APP_NAME = "authorization";
|
|
4
4
|
export declare const GRAPH_APP_NAME = "authorization-graph";
|
|
5
|
+
export declare enum GraphProfile {
|
|
6
|
+
PERMISSION = "authorization-graph-permission"
|
|
7
|
+
}
|
|
5
8
|
export declare const ERROR_MESSAGES: {
|
|
6
9
|
readonly HTTP_CLIENT_NOT_INITIALIZED: "MondayAuthorization: HTTP client is not initialized";
|
|
7
10
|
readonly REQUEST_FAILED: (method: string, status: number, reason: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,cAAc;;sCAEA,MAAM,UAAU,MAAM,UAAU,MAAM;CAEvD,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,aAAa,CAUjE,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,oBAAY,YAAY;IACtB,UAAU,mCAAmC;CAC9C;AAED,eAAO,MAAM,cAAc;;sCAEA,MAAM,UAAU,MAAM,UAAU,MAAM;CAEvD,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,aAAa,CAUjE,CAAC"}
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const APP_NAME = 'authorization';
|
|
2
2
|
const GRAPH_APP_NAME = 'authorization-graph';
|
|
3
|
+
var GraphProfile;
|
|
4
|
+
(function (GraphProfile) {
|
|
5
|
+
GraphProfile["PERMISSION"] = "authorization-graph-permission";
|
|
6
|
+
})(GraphProfile || (GraphProfile = {}));
|
|
3
7
|
const ERROR_MESSAGES = {
|
|
4
8
|
HTTP_CLIENT_NOT_INITIALIZED: 'MondayAuthorization: HTTP client is not initialized',
|
|
5
9
|
REQUEST_FAILED: (method, status, reason) => `MondayAuthorization: [${method}] request failed with status ${status} with reason: ${reason}`,
|
|
@@ -16,4 +20,4 @@ const DEFAULT_FETCH_OPTIONS = {
|
|
|
16
20
|
},
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
export { APP_NAME, DEFAULT_FETCH_OPTIONS, ERROR_MESSAGES, GRAPH_APP_NAME };
|
|
23
|
+
export { APP_NAME, DEFAULT_FETCH_OPTIONS, ERROR_MESSAGES, GRAPH_APP_NAME, GraphProfile };
|
|
@@ -6,7 +6,7 @@ export declare class MembershipsService {
|
|
|
6
6
|
private httpClient;
|
|
7
7
|
private fetchOptions;
|
|
8
8
|
/**
|
|
9
|
-
* Public constructor to create the
|
|
9
|
+
* Public constructor to create the MembershipsService instance.
|
|
10
10
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
11
11
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
12
12
|
*/
|
|
@@ -21,9 +21,8 @@ export declare class MembershipsService {
|
|
|
21
21
|
/**
|
|
22
22
|
* Delete memberships synchronously, performing http call to the authorization MS to delete the given memberships.
|
|
23
23
|
* @param accountId
|
|
24
|
-
* @param
|
|
25
|
-
* @
|
|
26
|
-
* @returns ResourceAttributeResponse - The affected (deleted) resource attributes assignments in the `attributes` field.
|
|
24
|
+
* @param memberships - Array of memberships to delete.
|
|
25
|
+
* @returns MembershipDeleteResponse - The affected (deleted) memberships.
|
|
27
26
|
*/
|
|
28
27
|
deleteMemberships(accountId: number, memberships: MembershipForDelete[]): Promise<MembershipDeleteResponse>;
|
|
29
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/memberships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAM3B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,SAAS,CAGb;IACX,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,YAAY,CAAkC;IAEtD;;;;OAIG;gBACS,UAAU,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAoBnF;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA0BjH
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/memberships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAM3B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,SAAS,CAGb;IACX,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,YAAY,CAAkC;IAEtD;;;;OAIG;gBACS,UAAU,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAoBnF;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA0BjH;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAyBlH"}
|
package/dist/esm/memberships.mjs
CHANGED
|
@@ -5,13 +5,13 @@ import { ERROR_MESSAGES, DEFAULT_FETCH_OPTIONS, APP_NAME } from './constants.mjs
|
|
|
5
5
|
|
|
6
6
|
class MembershipsService {
|
|
7
7
|
static API_PATHS = {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
UPSERT_MEMBERSHIPS: '/memberships/account/{accountId}',
|
|
9
|
+
DELETE_MEMBERSHIPS: '/memberships/account/{accountId}',
|
|
10
10
|
};
|
|
11
11
|
httpClient;
|
|
12
12
|
fetchOptions;
|
|
13
13
|
/**
|
|
14
|
-
* Public constructor to create the
|
|
14
|
+
* Public constructor to create the MembershipsService instance.
|
|
15
15
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
16
16
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
17
17
|
*/
|
|
@@ -46,7 +46,7 @@ class MembershipsService {
|
|
|
46
46
|
return await this.httpClient.fetch({
|
|
47
47
|
url: {
|
|
48
48
|
appName: APP_NAME,
|
|
49
|
-
path: MembershipsService.API_PATHS.
|
|
49
|
+
path: MembershipsService.API_PATHS.UPSERT_MEMBERSHIPS.replace('{accountId}', accountId.toString()),
|
|
50
50
|
},
|
|
51
51
|
method: 'PUT',
|
|
52
52
|
query: {
|
|
@@ -66,9 +66,8 @@ class MembershipsService {
|
|
|
66
66
|
/**
|
|
67
67
|
* Delete memberships synchronously, performing http call to the authorization MS to delete the given memberships.
|
|
68
68
|
* @param accountId
|
|
69
|
-
* @param
|
|
70
|
-
* @
|
|
71
|
-
* @returns ResourceAttributeResponse - The affected (deleted) resource attributes assignments in the `attributes` field.
|
|
69
|
+
* @param memberships - Array of memberships to delete.
|
|
70
|
+
* @returns MembershipDeleteResponse - The affected (deleted) memberships.
|
|
72
71
|
*/
|
|
73
72
|
async deleteMemberships(accountId, memberships) {
|
|
74
73
|
const attributionHeaders = getAttributionsFromApi();
|
|
@@ -76,7 +75,7 @@ class MembershipsService {
|
|
|
76
75
|
return await this.httpClient.fetch({
|
|
77
76
|
url: {
|
|
78
77
|
appName: APP_NAME,
|
|
79
|
-
path: MembershipsService.API_PATHS.
|
|
78
|
+
path: MembershipsService.API_PATHS.DELETE_MEMBERSHIPS.replace('{accountId}', accountId.toString()),
|
|
80
79
|
},
|
|
81
80
|
method: 'DELETE',
|
|
82
81
|
query: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../../src/types/memberships.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../../src/types/memberships.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC"}
|
package/dist/memberships.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class MembershipsService {
|
|
|
6
6
|
private httpClient;
|
|
7
7
|
private fetchOptions;
|
|
8
8
|
/**
|
|
9
|
-
* Public constructor to create the
|
|
9
|
+
* Public constructor to create the MembershipsService instance.
|
|
10
10
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
11
11
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
12
12
|
*/
|
|
@@ -21,9 +21,8 @@ export declare class MembershipsService {
|
|
|
21
21
|
/**
|
|
22
22
|
* Delete memberships synchronously, performing http call to the authorization MS to delete the given memberships.
|
|
23
23
|
* @param accountId
|
|
24
|
-
* @param
|
|
25
|
-
* @
|
|
26
|
-
* @returns ResourceAttributeResponse - The affected (deleted) resource attributes assignments in the `attributes` field.
|
|
24
|
+
* @param memberships - Array of memberships to delete.
|
|
25
|
+
* @returns MembershipDeleteResponse - The affected (deleted) memberships.
|
|
27
26
|
*/
|
|
28
27
|
deleteMemberships(accountId: number, memberships: MembershipForDelete[]): Promise<MembershipDeleteResponse>;
|
|
29
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../src/memberships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAM3B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,SAAS,CAGb;IACX,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,YAAY,CAAkC;IAEtD;;;;OAIG;gBACS,UAAU,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAoBnF;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA0BjH
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../src/memberships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAM3B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,SAAS,CAGb;IACX,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,YAAY,CAAkC;IAEtD;;;;OAIG;gBACS,UAAU,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAoBnF;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA0BjH;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAyBlH"}
|
package/dist/memberships.js
CHANGED
|
@@ -7,13 +7,13 @@ const constants = require('./constants.js');
|
|
|
7
7
|
|
|
8
8
|
class MembershipsService {
|
|
9
9
|
static API_PATHS = {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
UPSERT_MEMBERSHIPS: '/memberships/account/{accountId}',
|
|
11
|
+
DELETE_MEMBERSHIPS: '/memberships/account/{accountId}',
|
|
12
12
|
};
|
|
13
13
|
httpClient;
|
|
14
14
|
fetchOptions;
|
|
15
15
|
/**
|
|
16
|
-
* Public constructor to create the
|
|
16
|
+
* Public constructor to create the MembershipsService instance.
|
|
17
17
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
18
18
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
19
19
|
*/
|
|
@@ -48,7 +48,7 @@ class MembershipsService {
|
|
|
48
48
|
return await this.httpClient.fetch({
|
|
49
49
|
url: {
|
|
50
50
|
appName: constants.APP_NAME,
|
|
51
|
-
path: MembershipsService.API_PATHS.
|
|
51
|
+
path: MembershipsService.API_PATHS.UPSERT_MEMBERSHIPS.replace('{accountId}', accountId.toString()),
|
|
52
52
|
},
|
|
53
53
|
method: 'PUT',
|
|
54
54
|
query: {
|
|
@@ -68,9 +68,8 @@ class MembershipsService {
|
|
|
68
68
|
/**
|
|
69
69
|
* Delete memberships synchronously, performing http call to the authorization MS to delete the given memberships.
|
|
70
70
|
* @param accountId
|
|
71
|
-
* @param
|
|
72
|
-
* @
|
|
73
|
-
* @returns ResourceAttributeResponse - The affected (deleted) resource attributes assignments in the `attributes` field.
|
|
71
|
+
* @param memberships - Array of memberships to delete.
|
|
72
|
+
* @returns MembershipDeleteResponse - The affected (deleted) memberships.
|
|
74
73
|
*/
|
|
75
74
|
async deleteMemberships(accountId, memberships) {
|
|
76
75
|
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
@@ -78,7 +77,7 @@ class MembershipsService {
|
|
|
78
77
|
return await this.httpClient.fetch({
|
|
79
78
|
url: {
|
|
80
79
|
appName: constants.APP_NAME,
|
|
81
|
-
path: MembershipsService.API_PATHS.
|
|
80
|
+
path: MembershipsService.API_PATHS.DELETE_MEMBERSHIPS.replace('{accountId}', accountId.toString()),
|
|
82
81
|
},
|
|
83
82
|
method: 'DELETE',
|
|
84
83
|
query: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/types/memberships.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/types/memberships.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/monday-authorization",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-feat-use-profile-for-graph-can-action-in-scope-f1451ab",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "BSD-3-Clause",
|
package/src/clients/graph-api.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
GraphPermissionReason,
|
|
19
19
|
} from '../types/graph-api.types';
|
|
20
20
|
import { scopeToResource } from '../utils/authorization.utils';
|
|
21
|
-
import { GRAPH_APP_NAME } from '../constants';
|
|
21
|
+
import { GRAPH_APP_NAME, GraphProfile } from '../constants';
|
|
22
22
|
import { handleApiError } from '../utils/api-error-handler';
|
|
23
23
|
|
|
24
24
|
const CAN_ACTION_IN_SCOPE_GRAPH_PATH = '/permissions/is-allowed';
|
|
@@ -85,6 +85,7 @@ export class GraphApi {
|
|
|
85
85
|
url: {
|
|
86
86
|
appName: GRAPH_APP_NAME,
|
|
87
87
|
path: CAN_ACTION_IN_SCOPE_GRAPH_PATH,
|
|
88
|
+
profile: GraphProfile.PERMISSION,
|
|
88
89
|
},
|
|
89
90
|
method: 'POST',
|
|
90
91
|
headers: {
|
package/src/constants.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { FetcherConfig } from '@mondaydotcomorg/trident-backend-api';
|
|
|
4
4
|
export const APP_NAME = 'authorization';
|
|
5
5
|
export const GRAPH_APP_NAME = 'authorization-graph';
|
|
6
6
|
|
|
7
|
+
export enum GraphProfile {
|
|
8
|
+
PERMISSION = 'authorization-graph-permission',
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
export const ERROR_MESSAGES = {
|
|
8
12
|
HTTP_CLIENT_NOT_INITIALIZED: 'MondayAuthorization: HTTP client is not initialized',
|
|
9
13
|
REQUEST_FAILED: (method: string, status: number, reason: string) =>
|
package/src/memberships.ts
CHANGED
|
@@ -13,14 +13,14 @@ import { APP_NAME, DEFAULT_FETCH_OPTIONS, ERROR_MESSAGES } from './constants';
|
|
|
13
13
|
|
|
14
14
|
export class MembershipsService {
|
|
15
15
|
private static API_PATHS = {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
UPSERT_MEMBERSHIPS: '/memberships/account/{accountId}',
|
|
17
|
+
DELETE_MEMBERSHIPS: '/memberships/account/{accountId}',
|
|
18
18
|
} as const;
|
|
19
19
|
private httpClient: HttpClient;
|
|
20
20
|
private fetchOptions: RecursivePartial<FetcherConfig>;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Public constructor to create the
|
|
23
|
+
* Public constructor to create the MembershipsService instance.
|
|
24
24
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
25
25
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
26
26
|
*/
|
|
@@ -57,7 +57,7 @@ export class MembershipsService {
|
|
|
57
57
|
{
|
|
58
58
|
url: {
|
|
59
59
|
appName: APP_NAME,
|
|
60
|
-
path: MembershipsService.API_PATHS.
|
|
60
|
+
path: MembershipsService.API_PATHS.UPSERT_MEMBERSHIPS.replace('{accountId}', accountId.toString()),
|
|
61
61
|
},
|
|
62
62
|
method: 'PUT',
|
|
63
63
|
query: {
|
|
@@ -79,9 +79,8 @@ export class MembershipsService {
|
|
|
79
79
|
/**
|
|
80
80
|
* Delete memberships synchronously, performing http call to the authorization MS to delete the given memberships.
|
|
81
81
|
* @param accountId
|
|
82
|
-
* @param
|
|
83
|
-
* @
|
|
84
|
-
* @returns ResourceAttributeResponse - The affected (deleted) resource attributes assignments in the `attributes` field.
|
|
82
|
+
* @param memberships - Array of memberships to delete.
|
|
83
|
+
* @returns MembershipDeleteResponse - The affected (deleted) memberships.
|
|
85
84
|
*/
|
|
86
85
|
async deleteMemberships(accountId: number, memberships: MembershipForDelete[]): Promise<MembershipDeleteResponse> {
|
|
87
86
|
const attributionHeaders = getAttributionsFromApi();
|
|
@@ -90,7 +89,7 @@ export class MembershipsService {
|
|
|
90
89
|
{
|
|
91
90
|
url: {
|
|
92
91
|
appName: APP_NAME,
|
|
93
|
-
path: MembershipsService.API_PATHS.
|
|
92
|
+
path: MembershipsService.API_PATHS.DELETE_MEMBERSHIPS.replace('{accountId}', accountId.toString()),
|
|
94
93
|
},
|
|
95
94
|
method: 'DELETE',
|
|
96
95
|
query: {
|
package/src/types/memberships.ts
CHANGED
|
@@ -9,9 +9,9 @@ export interface MembershipForCreate {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface MembershipForDelete {
|
|
12
|
-
entityId?: number; // Which entity has the role?
|
|
12
|
+
entityId?: number; // Which entity has the role? omit to delete all memberships to the resource
|
|
13
13
|
entityType: string; // What type of entity is this?
|
|
14
|
-
resourceId
|
|
14
|
+
resourceId: number; // What resource is this membership for?
|
|
15
15
|
resourceType: string; // What type of resource is this membership for?
|
|
16
16
|
}
|
|
17
17
|
|