@axinom/mosaic-id-utils 0.3.2-rc.3 → 0.4.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 CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.4.0](https://dev.azure.com/axinom/CMS/_git/Navy/branchCompare?baseVersion=GT@axinom/mosaic-id-utils@0.3.1&targetVersion=GT@axinom/mosaic-id-utils@0.4.0) (2021-12-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * change permission definition folder path ([1ea44e0](https://dev.azure.com/axinom/CMS/_git/Navy/commit/1ea44e0bb3bffe3df06ca511cb23df9b2b0fcbe3))
12
+ * fixed failed test cases ([def2783](https://dev.azure.com/axinom/CMS/_git/Navy/commit/def2783dbf0d07d7fa1cb43e2176dd376f95c57f))
13
+ * fixed PR commits ([a271b5c](https://dev.azure.com/axinom/CMS/_git/Navy/commit/a271b5ccb9dec8368a47932fa90d1f3fd07b449e))
14
+ * permission structure v2 changes all ([4ddff67](https://dev.azure.com/axinom/CMS/_git/Navy/commit/4ddff677d8a9d5f39a3cd15dc608d1fc4f06d419))
15
+ * permission structure v2 implement for api ([2db1f7c](https://dev.azure.com/axinom/CMS/_git/Navy/commit/2db1f7c90ae05786eaed49399ee943ef8687ff55))
16
+ * personalization service integrated with id service ([c5ea4b0](https://dev.azure.com/axinom/CMS/_git/Navy/commit/c5ea4b06bc260bb491a29172b30913f05b14775a)), closes [#33411](https://dev.azure.com/axinom/CMS/_workitems/edit/33411)
17
+ * refactor permission definition file ([bfa648c](https://dev.azure.com/axinom/CMS/_git/Navy/commit/bfa648c341ad7a3ab42d68594168133965303475))
18
+
19
+
20
+
6
21
  ### [0.3.1](https://dev.azure.com/axinom/CMS/_git/Navy/branchCompare?baseVersion=GT@axinom/mosaic-id-utils@0.3.0&targetVersion=GT@axinom/mosaic-id-utils@0.3.1) (2021-11-24)
7
22
 
8
23
  **Note:** Version bump only for package @axinom/mosaic-id-utils
@@ -30,5 +30,5 @@ export interface TokenResult {
30
30
  expiresInSeconds: number;
31
31
  tokenType: string;
32
32
  }
33
- export declare type ManagedServiceId = 'ax-id-service' | 'ax-micro-frontend-service' | 'ax-portal-service' | 'ax-auth-service' | 'ax-image-service' | 'ax-encoding-service' | 'ax-user-service';
33
+ export declare type ManagedServiceId = 'ax-id-service' | 'ax-micro-frontend-service' | 'ax-portal-service' | 'ax-auth-service' | 'ax-image-service' | 'ax-encoding-service' | 'ax-user-service' | 'ax-personalization-service';
34
34
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,6BAA6B,EAC7B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB,EAAE,6BAA6B,EAAE,CAAC;CAC3D;AAGD,MAAM,WAAW,qBAAqB;IACpC,wB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,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,gBAAgB,GACxB,eAAe,GACf,2BAA2B,GAC3B,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,GACjB,4BAA4B,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export * from './mappings.helpers';
2
- export * from './operations-to-permission-mappings.interface';
2
+ export * from './permission-definition.interface';
3
3
  export * from './permission-structure.interface';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC"}
@@ -11,6 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./mappings.helpers"), exports);
14
- __exportStar(require("./operations-to-permission-mappings.interface"), exports);
14
+ __exportStar(require("./permission-definition.interface"), exports);
15
15
  __exportStar(require("./permission-structure.interface"), exports);
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,gFAA8D;AAC9D,mEAAiD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,oEAAkD;AAClD,mEAAiD"}
@@ -1,23 +1,29 @@
1
- import { IOperationsToPermissionMappings } from './operations-to-permission-mappings.interface';
2
- export declare const getPermissionsForOperation: (operation: string, mappings: IOperationsToPermissionMappings) => string[];
1
+ import { PermissionDefinition } from './permission-definition.interface';
3
2
  /**
4
- * The function reads and returns all operations in the permission mapping object except which are marked as IGNORE.
5
- * @param mappings An object of type IOperationsToPermissionMappings
3
+ *
4
+ * @param operation The GQL operation name which will be used to find associated Permissions for
5
+ * @param permissionDefinition An object of type PermissionDefinition
6
+ * @returns An array of permission-keys (strings) which contain the given operation
6
7
  */
7
- export declare const getMappedOperations: (mappings: IOperationsToPermissionMappings) => string[];
8
+ export declare const getPermissionsForOperation: (operation: string, permissionDefinition: PermissionDefinition) => string[];
8
9
  /**
9
- * The function reads and returns operations in the permission mapping object which are marked as ADDITIONAL.
10
- * @param mappings An object of type IOperationsToPermissionMappings
10
+ * The function reads and returns all mapped operations in the permission definition object except which are marked as IGNORE.
11
+ * @param permissionDefinition An object of type PermissionDefinition
11
12
  */
12
- export declare const getAdditionalOperations: (mappings: IOperationsToPermissionMappings) => string[];
13
+ export declare const getMappedOperations: (permissionDefinition: PermissionDefinition) => string[];
13
14
  /**
14
- * The function reads and returns operations in the permission mapping object which are marked as IGNORE.
15
- * @param mappings An object of type IOperationsToPermissionMappings
15
+ * The function reads and returns operations in the permission definition object which are marked as ADDITIONAL.
16
+ * @param permissionDefinition An object of type PermissionDefinition
16
17
  */
17
- export declare const getIgnoredOperations: (mappings: IOperationsToPermissionMappings) => string[];
18
+ export declare const getAdditionalOperations: (permissionDefinition: PermissionDefinition) => string[] | undefined;
18
19
  /**
19
- * Returns all active permission names - excluding well-known permission types ANONYMOUS, IGNORE and ADDITIONAL.
20
- * @param mappings An object of type IOperationsToPermissionMappings
20
+ * The function reads and returns operations in the permission definition object which are marked as IGNORE.
21
+ * @param permissionDefinition An object of type PermissionDefinition
21
22
  */
22
- export declare const getPermissionsFromMapping: (mappings: IOperationsToPermissionMappings) => string[];
23
+ export declare const getIgnoredOperations: (permissionDefinition: PermissionDefinition) => string[] | undefined;
24
+ /**
25
+ * Returns all permission keys.
26
+ * @param permissionDefinition An object of type PermissionDefinition
27
+ */
28
+ export declare const getPermissionsFromDefinition: (permissionDefinition: PermissionDefinition) => string[];
23
29
  //# sourceMappingURL=mappings.helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappings.helpers.d.ts","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/mappings.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,eAAO,MAAM,0BAA0B,cAC1B,MAAM,YACP,+BAA+B,KACxC,MAAM,EAER,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aACpB,+BAA+B,KACxC,MAAM,EAKR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,aACxB,+BAA+B,KACxC,MAAM,EAKR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,aACrB,+BAA+B,KACxC,MAAM,EAKR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,aAC1B,+BAA+B,KACxC,MAAM,EASR,CAAC"}
1
+ {"version":3,"file":"mappings.helpers.d.ts","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/mappings.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,cAC1B,MAAM,wBACK,oBAAoB,KACzC,MAAM,EAIR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,yBACR,oBAAoB,KACzC,MAAM,EAoBR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yBACZ,oBAAoB,KACzC,MAAM,EAAE,GAAG,SAEb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yBACT,oBAAoB,KACzC,MAAM,EAAE,GAAG,SAEb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,yBACjB,oBAAoB,KACzC,MAAM,EAER,CAAC"}
@@ -1,51 +1,58 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPermissionsFromMapping = exports.getIgnoredOperations = exports.getAdditionalOperations = exports.getMappedOperations = exports.getPermissionsForOperation = void 0;
4
- const getPermissionsForOperation = (operation, mappings) => {
5
- return Object.keys(mappings).filter(key => mappings[key].includes(operation));
3
+ exports.getPermissionsFromDefinition = exports.getIgnoredOperations = exports.getAdditionalOperations = exports.getMappedOperations = exports.getPermissionsForOperation = void 0;
4
+ /**
5
+ *
6
+ * @param operation The GQL operation name which will be used to find associated Permissions for
7
+ * @param permissionDefinition An object of type PermissionDefinition
8
+ * @returns An array of permission-keys (strings) which contain the given operation
9
+ */
10
+ const getPermissionsForOperation = (operation, permissionDefinition) => {
11
+ return permissionDefinition.permissions
12
+ .filter((permission) => { var _a; return (_a = permission.gqlOperations) === null || _a === void 0 ? void 0 : _a.includes(operation); })
13
+ .map((permission) => permission.key);
6
14
  };
7
15
  exports.getPermissionsForOperation = getPermissionsForOperation;
8
16
  /**
9
- * The function reads and returns all operations in the permission mapping object except which are marked as IGNORE.
10
- * @param mappings An object of type IOperationsToPermissionMappings
17
+ * The function reads and returns all mapped operations in the permission definition object except which are marked as IGNORE.
18
+ * @param permissionDefinition An object of type PermissionDefinition
11
19
  */
12
- const getMappedOperations = (mappings) => {
13
- const mappedOperationArrays = Object.keys(mappings)
14
- .filter(key => !(key === 'IGNORE')) // exclude operations that must be ignored
15
- .map(key => mappings[key]);
16
- return [...new Set(Array().concat(...mappedOperationArrays))];
20
+ const getMappedOperations = (permissionDefinition) => {
21
+ var _a, _b;
22
+ const otherOperations = permissionDefinition.permissions.map((permission) => permission.gqlOperations);
23
+ const additionalOperations = ((_a = permissionDefinition.gqlOptions) === null || _a === void 0 ? void 0 : _a.additionalGqlOperations) ||
24
+ new Array();
25
+ const anonymousOperations = ((_b = permissionDefinition.gqlOptions) === null || _b === void 0 ? void 0 : _b.anonymousGqlOperations) ||
26
+ new Array();
27
+ return [
28
+ ...new Set(Array().concat(...otherOperations.filter(Array.isArray), additionalOperations, anonymousOperations)),
29
+ ];
17
30
  };
18
31
  exports.getMappedOperations = getMappedOperations;
19
32
  /**
20
- * The function reads and returns operations in the permission mapping object which are marked as ADDITIONAL.
21
- * @param mappings An object of type IOperationsToPermissionMappings
33
+ * The function reads and returns operations in the permission definition object which are marked as ADDITIONAL.
34
+ * @param permissionDefinition An object of type PermissionDefinition
22
35
  */
23
- const getAdditionalOperations = (mappings) => {
24
- const additionalOperationArrays = Object.keys(mappings)
25
- .filter(key => key === 'ADDITIONAL')
26
- .map(key => mappings[key]);
27
- return [...new Set(Array().concat(...additionalOperationArrays))];
36
+ const getAdditionalOperations = (permissionDefinition) => {
37
+ var _a;
38
+ return (_a = permissionDefinition.gqlOptions) === null || _a === void 0 ? void 0 : _a.additionalGqlOperations;
28
39
  };
29
40
  exports.getAdditionalOperations = getAdditionalOperations;
30
41
  /**
31
- * The function reads and returns operations in the permission mapping object which are marked as IGNORE.
32
- * @param mappings An object of type IOperationsToPermissionMappings
42
+ * The function reads and returns operations in the permission definition object which are marked as IGNORE.
43
+ * @param permissionDefinition An object of type PermissionDefinition
33
44
  */
34
- const getIgnoredOperations = (mappings) => {
35
- const ignoredOperationArrays = Object.keys(mappings)
36
- .filter(key => key === 'IGNORE')
37
- .map(key => mappings[key]);
38
- return [...new Set(Array().concat(...ignoredOperationArrays))];
45
+ const getIgnoredOperations = (permissionDefinition) => {
46
+ var _a;
47
+ return (_a = permissionDefinition.gqlOptions) === null || _a === void 0 ? void 0 : _a.ignoredGqlOperations;
39
48
  };
40
49
  exports.getIgnoredOperations = getIgnoredOperations;
41
50
  /**
42
- * Returns all active permission names - excluding well-known permission types ANONYMOUS, IGNORE and ADDITIONAL.
43
- * @param mappings An object of type IOperationsToPermissionMappings
51
+ * Returns all permission keys.
52
+ * @param permissionDefinition An object of type PermissionDefinition
44
53
  */
45
- const getPermissionsFromMapping = (mappings) => {
46
- return Object.keys(mappings).filter(permission => !(permission === 'ANONYMOUS' ||
47
- permission === 'IGNORE' ||
48
- permission === 'ADDITIONAL'));
54
+ const getPermissionsFromDefinition = (permissionDefinition) => {
55
+ return permissionDefinition.permissions.map((permission) => permission.key);
49
56
  };
50
- exports.getPermissionsFromMapping = getPermissionsFromMapping;
57
+ exports.getPermissionsFromDefinition = getPermissionsFromDefinition;
51
58
  //# sourceMappingURL=mappings.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappings.helpers.js","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/mappings.helpers.ts"],"names":[],"mappings":";;;AAEO,MAAM,0BAA0B,GAAG,CACxC,SAAiB,EACjB,QAAyC,EAC/B,EAAE;IACZ,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC;AAEF;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CACjC,QAAyC,EAC/B,EAAE;IACZ,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SAChD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,0CAA0C;SAC7E,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,EAAU,CAAC,MAAM,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAA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1
+ {"version":3,"file":"mappings.helpers.js","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/mappings.helpers.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CACxC,SAAiB,EACjB,oBAA0C,EAChC,EAAE;IACZ,OAAO,oBAAoB,CAAC,WAAW;SACpC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,WAAC,OAAA,MAAA,UAAU,CAAC,aAAa,0CAAE,QAAQ,CAAC,SAAS,CAAC,CAAA,EAAA,CAAC;SACrE,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC,CAAC;AAPW,QAAA,0BAA0B,8BAOrC;AAEF;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CACjC,oBAA0C,EAChC,EAAE;;IACZ,MAAM,eAAe,GAAG,oBAAoB,CAAC,WAAW,CAAC,GAAG,CAC1D,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CACzC,CAAC;IACF,MAAM,oBAAoB,GACxB,CAAA,MAAA,oBAAoB,CAAC,UAAU,0CAAE,uBAAuB;QACxD,IAAI,KAAK,EAAU,CAAC;IACtB,MAAM,mBAAmB,GACvB,CAAA,MAAA,oBAAoB,CAAC,UAAU,0CAAE,sBAAsB;QACvD,IAAI,KAAK,EAAU,CAAC;IAEtB,OAAO;QACL,GAAG,IAAI,GAAG,CACR,KAAK,EAAU,CAAC,MAAM,CACpB,GAAG,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EACxC,oBAAoB,EACpB,mBAAmB,CACpB,CACF;KACF,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,mBAAmB,uBAsB9B;AAEF;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CACrC,oBAA0C,EACpB,EAAE;;IACxB,OAAO,MAAA,oBAAoB,CAAC,UAAU,0CAAE,uBAAuB,CAAC;AAClE,CAAC,CAAC;AAJW,QAAA,uBAAuB,2BAIlC;AAEF;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAClC,oBAA0C,EACpB,EAAE;;IACxB,OAAO,MAAA,oBAAoB,CAAC,UAAU,0CAAE,oBAAoB,CAAC;AAC/D,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B;AAEF;;;GAGG;AACI,MAAM,4BAA4B,GAAG,CAC1C,oBAA0C,EAChC,EAAE;IACZ,OAAO,oBAAoB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC9E,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This interface is define the structure of a permission array of PermissionDefinition.
3
+ *
4
+ */
5
+ export interface Permission {
6
+ /**
7
+ * Key of the permission.
8
+ * @property
9
+ */
10
+ key: string;
11
+ /**
12
+ * Title of the permission.
13
+ * @property
14
+ */
15
+ title: string;
16
+ /**
17
+ * True for only permission is used for manage services.
18
+ * @property
19
+ */
20
+ usedByManagedServiceOnly?: boolean;
21
+ /**
22
+ * True for only permission is used for development.
23
+ * @property
24
+ */
25
+ usedForDevelopment?: boolean;
26
+ /**
27
+ * List of gqlOperations.
28
+ * @property
29
+ */
30
+ gqlOperations?: readonly string[];
31
+ }
32
+ /**
33
+ * This interface is define the structure of a PermissionDefinition array for permission structure V2..
34
+ *
35
+ */
36
+ export interface PermissionDefinition {
37
+ gqlOptions?: {
38
+ /**
39
+ * Any operations defined under ANONYMOUS will be ignored while checking for Authorization.
40
+ * @property
41
+ */
42
+ anonymousGqlOperations?: string[];
43
+ /**
44
+ * Any operations defined under IGNORE will not be logged as disabled operations
45
+ * as they are known to be intentionally removed.
46
+ * @property
47
+ */
48
+ ignoredGqlOperations?: string[];
49
+ /**
50
+ * Any operations that are omitted from the root level (i.e. by smart-tags), but are used either as
51
+ * a ForwardRelation or a BackwardRelation field in a nested level must be defined here,
52
+ * in addition to the respective permissions to which they belong to.
53
+ * This is to avoid the operations from being logged as being surplus.
54
+ * @property
55
+ */
56
+ additionalGqlOperations?: string[];
57
+ };
58
+ /**
59
+ * Map of service specific permissions.
60
+ * This is a permission array.
61
+ * This is specially useful in authorizing REST APIs where a route could be authorized if an access-token
62
+ * contains a specific permission, but there is no real need for mapping any GraphQL operations to that permission.
63
+ * @property
64
+ */
65
+ permissions: readonly Permission[];
66
+ }
67
+ //# sourceMappingURL=permission-definition.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission-definition.interface.d.ts","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/permission-definition.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE;QACX;;;WAGG;QACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;QAClC;;;;WAIG;QACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;QAChC;;;;;;WAMG;QACH,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;IAEF;;;;;;OAMG;IACH,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CACpC"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=operations-to-permission-mappings.interface.js.map
3
+ //# sourceMappingURL=permission-definition.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission-definition.interface.js","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/permission-definition.interface.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-id-utils",
3
- "version": "0.3.2-rc.3",
3
+ "version": "0.4.0",
4
4
  "description": "Shared types used by id-service for integration clients",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -23,7 +23,7 @@
23
23
  "test:ci": "jest --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura --coverageReporters=html"
24
24
  },
25
25
  "dependencies": {
26
- "@axinom/mosaic-core": "^0.0.12-rc.3"
26
+ "@axinom/mosaic-core": "^0.0.12"
27
27
  },
28
28
  "devDependencies": {
29
29
  "jest": "26.6.0",
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "30a5cceacde15746fcf22502f57c22c2f13643ea"
36
+ "gitHead": "de356e3d88414dc569d1291d00c21069c5e3556a"
37
37
  }
@@ -1,38 +0,0 @@
1
- /**
2
- * This interface represents the contract for defining mapping between
3
- * GraphQL operations and service permissions.
4
- * Except for service specific permission mappings, this contains three well-known
5
- * permission-mappings.
6
- *
7
- * @interface
8
- */
9
- export interface IOperationsToPermissionMappings {
10
- /**
11
- * Any operations defined under ANONYMOUS will be ignored while checking for Authorization.
12
- * @property
13
- */
14
- ANONYMOUS: string[];
15
- /**
16
- * Any operations defined under IGNORE will not be logged as disabled operations
17
- * as they are known to be intentionally removed.
18
- * @property
19
- */
20
- IGNORE: string[];
21
- /**
22
- * Any operations that are omitted from the root level (i.e. by smart-tags), but are used either as
23
- * a ForwardRelation or a BackwardRelation field in a nested level must be defined here,
24
- * in addition to the respective permissions to which they belong to.
25
- * This is to avoid the operations from being logged as being surplus.
26
- * @property
27
- */
28
- ADDITIONAL: string[];
29
- /**
30
- * Map of service specific permissions.
31
- * It's also possible to have a permission name with an empty array of operations.
32
- * This is specially useful in authorizing REST APIs where a route could be authorized if an access-token
33
- * contains a specific permission, but there is no real need for mapping any GraphQL operations to that permission.
34
- * @property
35
- */
36
- [key: string]: string[];
37
- }
38
- //# sourceMappingURL=operations-to-permission-mappings.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations-to-permission-mappings.interface.d.ts","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/operations-to-permission-mappings.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;OAMG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations-to-permission-mappings.interface.js","sourceRoot":"","sources":["../../src/operation-to-permission-mapping/operations-to-permission-mappings.interface.ts"],"names":[],"mappings":""}