@anzusystems/common-admin 0.0.4 → 0.0.5

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.
@@ -12,17 +12,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
12
12
  props: any;
13
13
  emit: (e: 'change', data?: Grant) => void;
14
14
  selectedGrant: import("vue").WritableComputedRef<Grant | undefined>;
15
- getGrantOption: (value: Grant) => {
16
- value: Grant;
17
- title: string;
18
- color?: string | undefined;
19
- active?: false | undefined;
20
- } | undefined;
21
- t: import("vue-i18n").ComposerTranslation<{
22
- [x: string]: import("@intlify/core-base").LocaleMessage<import("vue-i18n").VueMessageType>;
23
- }, string, import("@intlify/core-base").RemoveIndexSignature<{
24
- [x: string]: import("vue-i18n").LocaleMessageValue<import("vue-i18n").VueMessageType>;
25
- }>, never, string, string>;
15
+ getGrantOption: (value: Grant) => import("../../lib").ValueObjectOption<Grant>;
26
16
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
27
17
  availableGrants: {
28
18
  type: ArrayConstructor;
@@ -11,30 +11,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
11
11
  };
12
12
  }, {
13
13
  props: any;
14
- getGrantOption: (value: Grant) => {
15
- value: Grant;
16
- title: string;
17
- color?: string | undefined;
18
- active?: false | undefined;
19
- } | undefined;
20
- grantOption: import("vue").ComputedRef<{
21
- value: Grant;
22
- title: string;
23
- color?: string | undefined;
24
- active?: false | undefined;
25
- } | undefined>;
26
- getGrantOriginOption: (value: GrantOrigin) => {
27
- value: GrantOrigin;
28
- title: string;
29
- color?: string | undefined;
30
- active?: false | undefined;
31
- } | undefined;
32
- grantOriginOption: import("vue").ComputedRef<{
33
- value: GrantOrigin;
34
- title: string;
35
- color?: string | undefined;
36
- active?: false | undefined;
37
- } | undefined>;
14
+ getGrantOption: (value: Grant) => import("../../lib").ValueObjectOption<Grant>;
15
+ grantOption: import("vue").ComputedRef<import("../../lib").ValueObjectOption<Grant>>;
16
+ getGrantOriginOption: (value: GrantOrigin) => import("../../lib").ValueObjectOption<GrantOrigin>;
17
+ grantOriginOption: import("vue").ComputedRef<import("../../lib").ValueObjectOption<GrantOrigin>>;
38
18
  readonly GrantOrigin: typeof GrantOrigin;
39
19
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
40
20
  grant: {
package/dist/lib.d.ts CHANGED
@@ -10,14 +10,19 @@ import { currentTimestamp, DATETIME_MAX, DATETIME_MIN, dateTimeEndOfDay, dateTim
10
10
  import { Grant, useGrant } from './model/valueObject/Grant';
11
11
  import { GrantOrigin, useGrantOrigin } from './model/valueObject/GrantOrigin';
12
12
  import { useAnzuUserFactory } from './model/factory/AnzuUserFactory';
13
+ import { usePermissionConfigFactory } from './model/factory/PermissionConfigFactory';
14
+ import { usePermissionGroupFactory } from './model/factory/PermissionGroupFactory';
13
15
  import type { IntegerId, DatetimeUTC, DatetimeUTCNullable, DocId, DocIdNullable, IntegerIdNullable } from './types/common';
14
16
  import type { Filter, FilterBag, FilterVariant } from './types/Filter';
15
17
  import type { Pagination } from './types/Pagination';
16
18
  import type { OwnerAware } from './types/OwnerAware';
17
19
  import { isOwnerAware } from './types/OwnerAware';
18
- import type { AnzuUserAndTimeTrackingAware, AnzuUserCreatedByAware, AnzuUser } from './types/AnzuUser';
19
- import { isAnzuUserCreatedByAware } from './types/AnzuUser';
20
+ import type { AnzuUser } from './types/AnzuUser';
20
21
  import type { ValueObjectOption } from './types/ValueObject';
22
+ import type { PermissionConfig, PermissionTranslationGroup } from './types/PermissionConfig';
23
+ import { type AnzuUserAndTimeTrackingAware } from './types/AnzuUserAndTimeTrackingAware';
24
+ import type { PermissionGroup, PermissionGroupMinimal } from './types/PermissionGroup';
25
+ import { type CreatedByAware, isCreatedByAware } from './types/CreatedByAware';
21
26
  export { // | | | | |
22
27
  ARow, // | | | | |
23
28
  ABooleanValue, // | | | | |
@@ -32,17 +37,23 @@ DocIdNullable, // | | | | |
32
37
  DatetimeUTCNullable, // | | | | |
33
38
  DatetimeUTC, // | | | | |
34
39
  AnzuUser, // | | | | |
35
- AnzuUserCreatedByAware, // | | | | |
36
40
  AnzuUserAndTimeTrackingAware, // | | | | |
37
- isAnzuUserCreatedByAware, // | | | | |
38
41
  ValueObjectOption, // | | | | |
39
42
  Pagination, // | | | | |
40
43
  OwnerAware, // | | | | |
41
44
  isOwnerAware, // | | | | |
45
+ CreatedByAware, // | | | | |
46
+ isCreatedByAware, // | | | | |
42
47
  Filter, // | | | | |
43
48
  FilterBag, // | | | | |
44
49
  FilterVariant, // | | | | |
50
+ PermissionConfig, // | | | | |
51
+ PermissionTranslationGroup, // | | | | |
52
+ PermissionGroup, // | | | | |
53
+ PermissionGroupMinimal, // | | | | |
45
54
  useAnzuUserFactory, // | | | | |
55
+ usePermissionConfigFactory, // | | | | |
56
+ usePermissionGroupFactory, // | | | | |
46
57
  isEmpty, // | | | | |
47
58
  isEmptyObject, // | | | | |
48
59
  isObject, // | | | | |
@@ -0,0 +1,4 @@
1
+ import { PermissionConfig } from '../../types/PermissionConfig';
2
+ export declare function usePermissionConfigFactory(): {
3
+ createPermissionConfig: () => PermissionConfig;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { PermissionGroup } from '../../types/PermissionGroup';
2
+ export declare function usePermissionGroupFactory(): {
3
+ createPermissionGroup: () => PermissionGroup;
4
+ };
@@ -1,3 +1,4 @@
1
+ import type { ValueObjectOption } from '../../types/ValueObject';
1
2
  export declare enum Grant {
2
3
  Deny = 0,
3
4
  AllowOwner = 1,
@@ -11,10 +12,5 @@ export declare function useGrant(): {
11
12
  color?: string | undefined;
12
13
  active?: false | undefined;
13
14
  }[]>;
14
- getGrantOption: (value: Grant) => {
15
- value: Grant;
16
- title: string;
17
- color?: string | undefined;
18
- active?: false | undefined;
19
- } | undefined;
15
+ getGrantOption: (value: Grant) => ValueObjectOption<Grant>;
20
16
  };
@@ -1,3 +1,4 @@
1
+ import type { ValueObjectOption } from '../../types/ValueObject';
1
2
  export declare enum GrantOrigin {
2
3
  Role = "role",
3
4
  Group = "group",
@@ -12,10 +13,5 @@ export declare function useGrantOrigin(): {
12
13
  color?: string | undefined;
13
14
  active?: false | undefined;
14
15
  }[]>;
15
- getGrantOriginOption: (value: GrantOrigin) => {
16
- value: GrantOrigin;
17
- title: string;
18
- color?: string | undefined;
19
- active?: false | undefined;
20
- } | undefined;
16
+ getGrantOriginOption: (value: GrantOrigin) => ValueObjectOption<GrantOrigin>;
21
17
  };
@@ -1,5 +1,6 @@
1
- import type { IntegerId, DatetimeUTC, IntegerIdNullable } from '../types/common';
1
+ import type { IntegerId } from '../types/common';
2
2
  import type { Permissions } from '../types/Permission';
3
+ import { AnzuUserAndTimeTrackingAware } from '../types/AnzuUserAndTimeTrackingAware';
3
4
  export interface AnzuUser extends AnzuUserAndTimeTrackingAware {
4
5
  id: IntegerId;
5
6
  email: string;
@@ -11,12 +12,3 @@ export interface AnzuUser extends AnzuUserAndTimeTrackingAware {
11
12
  _resourceName: string;
12
13
  _system: string;
13
14
  }
14
- export interface AnzuUserAndTimeTrackingAware extends AnzuUserCreatedByAware {
15
- createdAt: DatetimeUTC;
16
- modifiedAt: DatetimeUTC;
17
- modifiedBy: IntegerIdNullable;
18
- }
19
- export interface AnzuUserCreatedByAware {
20
- createdBy: IntegerIdNullable;
21
- }
22
- export declare const isAnzuUserCreatedByAware: (value: object) => value is AnzuUserCreatedByAware;
@@ -0,0 +1,7 @@
1
+ import type { DatetimeUTC, IntegerIdNullable } from '../types/common';
2
+ import { CreatedByAware } from '../types/CreatedByAware';
3
+ export interface AnzuUserAndTimeTrackingAware extends CreatedByAware {
4
+ createdAt: DatetimeUTC;
5
+ modifiedAt: DatetimeUTC;
6
+ modifiedBy: IntegerIdNullable;
7
+ }
@@ -0,0 +1,5 @@
1
+ import { IntegerIdNullable } from '../types/common';
2
+ export interface CreatedByAware {
3
+ createdBy: IntegerIdNullable;
4
+ }
5
+ export declare const isCreatedByAware: (value: object) => value is CreatedByAware;
@@ -12,4 +12,4 @@ export interface Filter {
12
12
  mandatory: boolean;
13
13
  exclude: boolean;
14
14
  }
15
- export declare type FilterVariant = 'lt' | 'in' | 'notIn' | 'endsWith' | 'startsWith' | 'memberOf' | 'contains' | 'neq' | 'gte' | 'gt' | 'eq' | 'lte';
15
+ export type FilterVariant = 'lt' | 'in' | 'notIn' | 'endsWith' | 'startsWith' | 'memberOf' | 'contains' | 'neq' | 'gte' | 'gt' | 'eq' | 'lte';
@@ -1,5 +1,6 @@
1
1
  import type { Grant } from '../model/valueObject/Grant';
2
- export declare type AclValue = string;
3
- export declare type Permissions = {
2
+ export type AclKey = string;
3
+ export type AclValue = string;
4
+ export type Permissions = {
4
5
  [key in AclValue]?: Grant;
5
6
  };
@@ -0,0 +1,30 @@
1
+ import { Grant } from '../model/valueObject/Grant';
2
+ export interface PermissionConfig {
3
+ roles: string[];
4
+ defaultGrants: Grant[];
5
+ config: {
6
+ [subject: string]: {
7
+ [action: string]: {
8
+ grants?: Grant[];
9
+ };
10
+ };
11
+ };
12
+ translation: {
13
+ subjects: {
14
+ [subject: string]: {
15
+ [lang: string]: string;
16
+ };
17
+ };
18
+ actions: {
19
+ [action: string]: {
20
+ [lang: string]: string;
21
+ };
22
+ };
23
+ roles: {
24
+ [role: string]: {
25
+ [lang: string]: string;
26
+ };
27
+ };
28
+ };
29
+ }
30
+ export type PermissionTranslationGroup = 'subjects' | 'actions' | 'roles';
@@ -0,0 +1,13 @@
1
+ import type { IntegerId } from '../types/common';
2
+ import type { Permissions } from '../types/Permission';
3
+ import { AnzuUserAndTimeTrackingAware } from '../types/AnzuUserAndTimeTrackingAware';
4
+ export interface PermissionGroupMinimal {
5
+ id: IntegerId;
6
+ title: string;
7
+ permissions: Permissions;
8
+ }
9
+ export interface PermissionGroup extends PermissionGroupMinimal, AnzuUserAndTimeTrackingAware {
10
+ description: string;
11
+ _system: string;
12
+ _resourceName: 'permissionGroup';
13
+ }
@@ -1,6 +1,6 @@
1
- export declare type DatetimeUTC = string;
2
- export declare type DatetimeUTCNullable = string | null;
3
- export declare type IntegerId = number;
4
- export declare type IntegerIdNullable = number | null;
5
- export declare type DocId = string;
6
- export declare type DocIdNullable = string | null;
1
+ export type DatetimeUTC = string;
2
+ export type DatetimeUTCNullable = string | null;
3
+ export type IntegerId = number;
4
+ export type IntegerIdNullable = number | null;
5
+ export type DocId = string;
6
+ export type DocIdNullable = string | null;
package/package.json CHANGED
@@ -13,31 +13,42 @@
13
13
  "require": "./dist/common-admin.umd.js"
14
14
  }
15
15
  },
16
- "version": "0.0.4",
16
+ "version": "0.0.5",
17
17
  "type": "module",
18
18
  "license": "Apache-2.0",
19
19
  "scripts": {
20
20
  "dev": "vite",
21
21
  "build": "vite build",
22
+ "lint": "yarn lint:tsc ; yarn lint:eslint",
23
+ "lint:tsc": "vue-tsc --noEmit -p tsconfig.json --composite false",
24
+ "lint:eslint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
25
+ "lint:eslint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
22
26
  "test": "exit 0"
23
27
  },
24
28
  "devDependencies": {
25
29
  "@intlify/unplugin-vue-i18n": "^0.8.1",
26
30
  "@mdi/font": "^7.1.96",
31
+ "@rushstack/eslint-patch": "^1.2.0",
27
32
  "@types/node": "^18.11.18",
33
+ "@typescript-eslint/parser": "^5.49.0",
28
34
  "@vitejs/plugin-vue": "^4.0.0",
29
- "axios": "^1.2.3",
35
+ "@vue/eslint-config-prettier": "^7.0.0",
36
+ "@vue/eslint-config-typescript": "^11.0.2",
37
+ "axios": "^1.2.4",
30
38
  "dayjs": "^1.11.7",
39
+ "eslint": "^8.32.0",
40
+ "eslint-plugin-vue": "^9.9.0",
31
41
  "pinia": "^2.0.29",
42
+ "prettier": "^2.8.3",
32
43
  "sass": "^1.57.1",
33
- "typescript": "^4.9.3",
34
- "vite": "^4.0.0",
44
+ "typescript": "^4.9.4",
45
+ "vite": "^4.0.4",
35
46
  "vite-plugin-dts": "^1.7.1",
36
47
  "vite-plugin-vuetify": "^1.0.1",
37
48
  "vue": "^3.2.45",
38
49
  "vue-i18n": "^9.2.2",
39
50
  "vue-router": "^4.1.6",
40
51
  "vue-tsc": "^1.0.24",
41
- "vuetify": "^3.1.1"
52
+ "vuetify": "^3.1.2"
42
53
  }
43
54
  }