@mondaydotcomorg/monday-authorization 1.1.9-bugmoshefixhourcolumn.385 → 1.1.9-bugmoshefixlodashesm.3791

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +57 -0
  3. package/dist/attributions-service.d.ts +3 -0
  4. package/dist/attributions-service.js +55 -0
  5. package/dist/authorization-attributes-service.d.ts +44 -0
  6. package/dist/authorization-attributes-service.js +144 -0
  7. package/dist/authorization-internal-service.d.ts +13 -0
  8. package/dist/authorization-internal-service.js +80 -0
  9. package/dist/authorization-middleware.d.ts +6 -0
  10. package/dist/authorization-middleware.js +48 -0
  11. package/dist/authorization-service.d.ts +29 -0
  12. package/dist/authorization-service.js +184 -0
  13. package/dist/constants/sns.d.ts +3 -0
  14. package/dist/constants/sns.js +9 -0
  15. package/dist/esm/attributions-service.d.ts +3 -0
  16. package/dist/esm/attributions-service.mjs +53 -0
  17. package/dist/esm/authorization-attributes-service.d.ts +44 -0
  18. package/dist/esm/authorization-attributes-service.mjs +138 -0
  19. package/dist/esm/authorization-internal-service.d.ts +13 -0
  20. package/dist/esm/authorization-internal-service.mjs +57 -0
  21. package/dist/esm/authorization-middleware.d.ts +6 -0
  22. package/dist/esm/authorization-middleware.mjs +39 -0
  23. package/dist/esm/authorization-service.d.ts +29 -0
  24. package/dist/esm/authorization-service.mjs +174 -0
  25. package/dist/esm/constants/sns.d.ts +3 -0
  26. package/dist/esm/constants/sns.mjs +5 -0
  27. package/dist/esm/index.d.ts +13 -0
  28. package/dist/esm/index.mjs +21 -0
  29. package/dist/esm/prometheus-service.d.ts +10 -0
  30. package/dist/esm/prometheus-service.mjs +49 -0
  31. package/dist/esm/testKit/index.d.ts +11 -0
  32. package/dist/esm/testKit/index.mjs +44 -0
  33. package/dist/esm/types/authorization-attributes-contracts.d.ts +27 -0
  34. package/dist/esm/types/authorization-attributes-contracts.mjs +7 -0
  35. package/dist/esm/types/express.d.ts +10 -0
  36. package/dist/esm/types/express.mjs +1 -0
  37. package/dist/esm/types/general.d.ts +32 -0
  38. package/dist/esm/types/general.mjs +1 -0
  39. package/dist/esm/types/scoped-actions-contracts.d.ts +38 -0
  40. package/dist/esm/types/scoped-actions-contracts.mjs +8 -0
  41. package/dist/index.d.ts +13 -0
  42. package/dist/index.js +27 -0
  43. package/dist/prometheus-service.d.ts +10 -0
  44. package/dist/prometheus-service.js +55 -0
  45. package/dist/testKit/index.d.ts +11 -0
  46. package/dist/testKit/index.js +48 -0
  47. package/dist/types/authorization-attributes-contracts.d.ts +27 -0
  48. package/dist/types/authorization-attributes-contracts.js +7 -0
  49. package/dist/types/express.d.ts +10 -0
  50. package/dist/types/express.js +1 -0
  51. package/dist/types/general.d.ts +32 -0
  52. package/dist/types/general.js +1 -0
  53. package/dist/types/scoped-actions-contracts.d.ts +38 -0
  54. package/dist/types/scoped-actions-contracts.js +8 -0
  55. package/package.json +32 -11
@@ -0,0 +1,27 @@
1
+ import { Resource } from './general';
2
+ export interface ResourceAttributeAssignment {
3
+ resourceType: Resource['type'];
4
+ resourceId: Resource['id'];
5
+ key: string;
6
+ value: string;
7
+ }
8
+ export interface ResourceAttributeResponse {
9
+ attributes: ResourceAttributeAssignment[];
10
+ }
11
+ export interface ResourceAttributeDelete {
12
+ resourceType: Resource['type'];
13
+ resourceId: Resource['id'];
14
+ key: string;
15
+ }
16
+ export declare enum ResourceAttributeOperationEnum {
17
+ UPSERT = "upsert",
18
+ DELETE = "delete"
19
+ }
20
+ interface UpsertResourceAttributeOperation extends ResourceAttributeAssignment {
21
+ operationType: ResourceAttributeOperationEnum.UPSERT;
22
+ }
23
+ interface DeleteResourceAttributeOperation extends ResourceAttributeDelete {
24
+ operationType: ResourceAttributeOperationEnum.DELETE;
25
+ }
26
+ export type ResourceAttributesOperation = UpsertResourceAttributeOperation | DeleteResourceAttributeOperation;
27
+ export {};
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ exports.ResourceAttributeOperationEnum = void 0;
4
+ (function (ResourceAttributeOperationEnum) {
5
+ ResourceAttributeOperationEnum["UPSERT"] = "upsert";
6
+ ResourceAttributeOperationEnum["DELETE"] = "delete";
7
+ })(exports.ResourceAttributeOperationEnum || (exports.ResourceAttributeOperationEnum = {}));
@@ -0,0 +1,10 @@
1
+ declare namespace Express {
2
+ interface Request {
3
+ payload: {
4
+ accountId: number;
5
+ userId: number;
6
+ };
7
+ authorizationCheckPerformed: boolean;
8
+ authorizationSkipPerformed: boolean;
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,32 @@
1
+ import type { Request, Response } from 'express';
2
+ export interface Resource {
3
+ id?: number;
4
+ type: string;
5
+ wrapperData?: object;
6
+ }
7
+ export type Action = string;
8
+ export interface Context {
9
+ accountId: number;
10
+ userId: number;
11
+ }
12
+ export interface AuthorizationObject {
13
+ resource_id?: Resource['id'];
14
+ resource_type: Resource['type'];
15
+ wrapper_data?: Resource['wrapperData'];
16
+ action: Action;
17
+ }
18
+ export interface AuthorizationParams {
19
+ authorizationObjects: AuthorizationObject[];
20
+ }
21
+ type BasicObject = {
22
+ [key: string]: string;
23
+ };
24
+ export type BaseParameters = BasicObject;
25
+ export type BaseResponseBody = BasicObject;
26
+ export type BaseBodyParameters = BasicObject;
27
+ export type BaseQueryParameters = BasicObject;
28
+ export type BaseRequest = Request<BaseParameters, BaseResponseBody, BaseBodyParameters, BaseQueryParameters>;
29
+ export type BaseResponse = Response<BaseResponseBody>;
30
+ export type ResourceGetter = (request: BaseRequest) => Resource[];
31
+ export type ContextGetter = (request: BaseRequest) => Context;
32
+ export {};
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,38 @@
1
+ export interface WorkspaceScope {
2
+ workspaceId: number;
3
+ }
4
+ export interface BoardScope {
5
+ boardId: number;
6
+ }
7
+ export interface PulseScope {
8
+ pulseId: number;
9
+ }
10
+ export interface AccountProductScope {
11
+ accountProductId: number;
12
+ }
13
+ export interface AccountScope {
14
+ accountId: number;
15
+ }
16
+ export type ScopeOptions = WorkspaceScope | BoardScope | PulseScope | AccountProductScope | AccountScope;
17
+ export interface Translation {
18
+ key: string;
19
+ [option: string]: string;
20
+ }
21
+ export declare enum PermitTechnicalReason {
22
+ NO_REASON = 0,
23
+ NOT_ELIGIBLE = 1,
24
+ BY_ROLE_IN_SCOPE = 2
25
+ }
26
+ export interface ScopedActionPermit {
27
+ can: boolean;
28
+ reason: Translation;
29
+ technicalReason: PermitTechnicalReason;
30
+ }
31
+ export interface ScopedAction {
32
+ action: string;
33
+ scope: ScopeOptions;
34
+ }
35
+ export interface ScopedActionResponseObject {
36
+ scopedAction: ScopedAction;
37
+ permit: ScopedActionPermit;
38
+ }
@@ -0,0 +1,8 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ exports.PermitTechnicalReason = void 0;
4
+ (function (PermitTechnicalReason) {
5
+ PermitTechnicalReason[PermitTechnicalReason["NO_REASON"] = 0] = "NO_REASON";
6
+ PermitTechnicalReason[PermitTechnicalReason["NOT_ELIGIBLE"] = 1] = "NOT_ELIGIBLE";
7
+ PermitTechnicalReason[PermitTechnicalReason["BY_ROLE_IN_SCOPE"] = 2] = "BY_ROLE_IN_SCOPE";
8
+ })(exports.PermitTechnicalReason || (exports.PermitTechnicalReason = {}));
package/package.json CHANGED
@@ -1,36 +1,57 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/monday-authorization",
3
- "version": "1.1.9-bugmoshefixhourcolumn.385+615c92e7d",
3
+ "version": "1.1.9-bugmoshefixlodashesm.3791+0724a6a58",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "BSD-3-Clause",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/esm/index.mjs",
10
+ "require": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
7
15
  "scripts": {
8
- "test": "mocha -r ts-node/register -r tsconfig-paths/register './tests/*.test.ts' --timeout 5000 --exit",
9
- "build": "tsc --build"
16
+ "test": "trident-library test",
17
+ "lint": "trident-library lint",
18
+ "build": "trident-library build",
19
+ "watch": "trident-library build -w"
10
20
  },
11
21
  "dependencies": {
12
22
  "@mondaydotcomorg/monday-fetch": "^0.0.7",
13
- "@mondaydotcomorg/monday-jwt": "^3.0.10",
14
- "@mondaydotcomorg/monday-logger": "^3.0.10",
23
+ "@mondaydotcomorg/monday-jwt": "^3.0.14",
24
+ "@mondaydotcomorg/monday-logger": "^4.0.11",
25
+ "@mondaydotcomorg/monday-sns": "^1.0.6",
26
+ "@mondaydotcomorg/trident-backend-api": "^0.24.3",
27
+ "lodash": "^4.17.21",
15
28
  "node-fetch": "^2.6.7",
29
+ "on-headers": "^1.0.2",
16
30
  "ts-node": "^10.0.0"
17
31
  },
18
32
  "devDependencies": {
33
+ "@mondaydotcomorg/trident-library": "^0.6.53",
19
34
  "@types/express": "^4.17.20",
20
- "@types/mocha": "^8.2.2",
35
+ "@types/lodash": "^4.17.10",
21
36
  "@types/on-headers": "^1.0.0",
22
37
  "@types/supertest": "^2.0.11",
23
38
  "express": "^4.17.1",
24
39
  "ioredis": "^5.2.4",
25
40
  "ioredis-mock": "^8.2.2",
26
- "mocha": "^9.0.1",
27
- "on-headers": "^1.0.2",
28
41
  "supertest": "^6.1.3",
29
- "tsconfig-paths": "^3.9.0",
30
- "typescript": "^5.1.6"
42
+ "typescript": "^5.2.2"
31
43
  },
32
44
  "files": [
33
45
  "dist/"
34
46
  ],
35
- "gitHead": "615c92e7dc78def059faf333b5443ae643730929"
47
+ "eslintConfig": {
48
+ "extends": "@mondaydotcomorg/trident-library",
49
+ "root": true
50
+ },
51
+ "trident": {
52
+ "build": {
53
+ "esmMjsRename": true
54
+ }
55
+ },
56
+ "gitHead": "0724a6a58ad189b245879473cd13572d601294c0"
36
57
  }