@nu-art/permissions-shared 0.400.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.
Files changed (63) hide show
  1. package/_entity/permission-access-level/api-def.d.ts +5 -0
  2. package/_entity/permission-access-level/api-def.js +3 -0
  3. package/_entity/permission-access-level/db-def.d.ts +3 -0
  4. package/_entity/permission-access-level/db-def.js +31 -0
  5. package/_entity/permission-access-level/index.d.ts +3 -0
  6. package/_entity/permission-access-level/index.js +4 -0
  7. package/_entity/permission-access-level/types.d.ts +27 -0
  8. package/_entity/permission-access-level/types.js +1 -0
  9. package/_entity/permission-api/api-def.d.ts +5 -0
  10. package/_entity/permission-api/api-def.js +3 -0
  11. package/_entity/permission-api/db-def.d.ts +3 -0
  12. package/_entity/permission-api/db-def.js +39 -0
  13. package/_entity/permission-api/index.d.ts +3 -0
  14. package/_entity/permission-api/index.js +4 -0
  15. package/_entity/permission-api/types.d.ts +29 -0
  16. package/_entity/permission-api/types.js +1 -0
  17. package/_entity/permission-domain/api-def.d.ts +5 -0
  18. package/_entity/permission-domain/api-def.js +3 -0
  19. package/_entity/permission-domain/db-def.d.ts +3 -0
  20. package/_entity/permission-domain/db-def.js +31 -0
  21. package/_entity/permission-domain/index.d.ts +3 -0
  22. package/_entity/permission-domain/index.js +4 -0
  23. package/_entity/permission-domain/types.d.ts +19 -0
  24. package/_entity/permission-domain/types.js +1 -0
  25. package/_entity/permission-group/api-def.d.ts +5 -0
  26. package/_entity/permission-group/api-def.js +3 -0
  27. package/_entity/permission-group/db-def.d.ts +3 -0
  28. package/_entity/permission-group/db-def.js +37 -0
  29. package/_entity/permission-group/index.d.ts +3 -0
  30. package/_entity/permission-group/index.js +4 -0
  31. package/_entity/permission-group/types.d.ts +31 -0
  32. package/_entity/permission-group/types.js +1 -0
  33. package/_entity/permission-project/api-def.d.ts +5 -0
  34. package/_entity/permission-project/api-def.js +3 -0
  35. package/_entity/permission-project/db-def.d.ts +3 -0
  36. package/_entity/permission-project/db-def.js +23 -0
  37. package/_entity/permission-project/index.d.ts +3 -0
  38. package/_entity/permission-project/index.js +4 -0
  39. package/_entity/permission-project/types.d.ts +15 -0
  40. package/_entity/permission-project/types.js +1 -0
  41. package/_entity/permission-user/api-def.d.ts +12 -0
  42. package/_entity/permission-user/api-def.js +6 -0
  43. package/_entity/permission-user/db-def.d.ts +3 -0
  44. package/_entity/permission-user/db-def.js +31 -0
  45. package/_entity/permission-user/index.d.ts +3 -0
  46. package/_entity/permission-user/index.js +4 -0
  47. package/_entity/permission-user/types.d.ts +22 -0
  48. package/_entity/permission-user/types.js +1 -0
  49. package/_entity.d.ts +6 -0
  50. package/_entity.js +6 -0
  51. package/apis.d.ts +75 -0
  52. package/apis.js +42 -0
  53. package/consts.d.ts +80 -0
  54. package/consts.js +60 -0
  55. package/index.d.ts +10 -0
  56. package/index.js +28 -0
  57. package/package.json +80 -0
  58. package/permission-keys.d.ts +3 -0
  59. package/permission-keys.js +3 -0
  60. package/types.d.ts +48 -0
  61. package/types.js +1 -0
  62. package/validators.d.ts +6 -0
  63. package/validators.js +25 -0
@@ -0,0 +1,5 @@
1
+ import { ApiDefResolver } from '@nu-art/thunderstorm-shared';
2
+ export type ApiStruct_PermissionAccessLevel = {
3
+ _v1: {};
4
+ };
5
+ export declare const ApiDef_PermissionAccessLevel: ApiDefResolver<ApiStruct_PermissionAccessLevel>;
@@ -0,0 +1,3 @@
1
+ export const ApiDef_PermissionAccessLevel = {
2
+ _v1: {}
3
+ };
@@ -0,0 +1,3 @@
1
+ import { DBDef_V3 } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionAccessLevel } from './types.js';
3
+ export declare const DBDef_PermissionAccessLevel: DBDef_V3<DBProto_PermissionAccessLevel>;
@@ -0,0 +1,31 @@
1
+ import { tsValidateIsInRange, tsValidateString, tsValidateStringWithDashes, tsValidateUniqueId } from '@nu-art/ts-common';
2
+ import { PermissionDBGroup } from '../../consts.js';
3
+ const Validator_ModifiableProps = {
4
+ domainId: tsValidateUniqueId,
5
+ name: tsValidateStringWithDashes,
6
+ uiLabel: tsValidateString(),
7
+ value: tsValidateIsInRange([[0, 1000]]),
8
+ };
9
+ const Validator_GeneratedProps = {
10
+ _auditorId: tsValidateString()
11
+ };
12
+ export const DBDef_PermissionAccessLevel = {
13
+ modifiablePropsValidator: Validator_ModifiableProps,
14
+ generatedPropsValidator: Validator_GeneratedProps,
15
+ versions: ['1.0.1', '1.0.0'],
16
+ dbKey: 'permissions--level',
17
+ entityName: 'PermissionAccessLevel',
18
+ frontend: {
19
+ group: PermissionDBGroup,
20
+ name: 'level',
21
+ },
22
+ backend: {
23
+ name: 'permissions--level',
24
+ },
25
+ dependencies: {
26
+ domainId: {
27
+ dbKey: 'permissions--domain',
28
+ fieldType: 'string',
29
+ }
30
+ }
31
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './db-def.js';
3
+ export * from './api-def.js';
@@ -0,0 +1,4 @@
1
+ // Generated DB Item type: PermissionAccessLevel
2
+ export * from './types.js';
3
+ export * from './db-def.js';
4
+ export * from './api-def.js';
@@ -0,0 +1,27 @@
1
+ import { AuditableV2, DB_Object, DBProto, Proto_DB_Object, VersionsDeclaration } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionDomain } from '../permission-domain/types.js';
3
+ type VersionTypes_PermissionAccessLevel = {
4
+ '1.0.0': DB_PermissionAccessLevel;
5
+ '1.0.1': DB_PermissionAccessLevel;
6
+ };
7
+ type Versions = VersionsDeclaration<['1.0.1', '1.0.0'], VersionTypes_PermissionAccessLevel>;
8
+ type Dependencies = {
9
+ domainId: DBProto_PermissionDomain;
10
+ };
11
+ type UniqueKeys = '_id';
12
+ type GeneratedProps = '_auditorId';
13
+ type Proto = Proto_DB_Object<DB_PermissionAccessLevel, 'permissions--level', GeneratedProps, Versions, UniqueKeys, Dependencies>;
14
+ export type DBProto_PermissionAccessLevel = DBProto<Proto>;
15
+ export type UI_PermissionAccessLevel = DBProto_PermissionAccessLevel['uiType'];
16
+ export type Base_AccessLevel = {
17
+ domainId: string;
18
+ value: number;
19
+ };
20
+ export type DB_PermissionAccessLevel = DB_Object & Base_AccessLevel & AuditableV2 & {
21
+ name: string;
22
+ uiLabel: string;
23
+ };
24
+ export type DB_PermissionAccessLevel_1_0_0 = DB_Object & Base_AccessLevel & AuditableV2 & {
25
+ name: string;
26
+ };
27
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ApiDefResolver } from '@nu-art/thunderstorm-shared';
2
+ export type ApiStruct_PermissionAPI = {
3
+ _v1: {};
4
+ };
5
+ export declare const ApiDef_PermissionAPI: ApiDefResolver<ApiStruct_PermissionAPI>;
@@ -0,0 +1,3 @@
1
+ export const ApiDef_PermissionAPI = {
2
+ _v1: {}
3
+ };
@@ -0,0 +1,3 @@
1
+ import { DBDef_V3 } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionAPI } from './types.js';
3
+ export declare const DBDef_PermissionAPI: DBDef_V3<DBProto_PermissionAPI>;
@@ -0,0 +1,39 @@
1
+ import { tsValidateArray, tsValidateBoolean, tsValidateDynamicObject, tsValidateNumber, tsValidateString, tsValidateUniqueId } from '@nu-art/ts-common';
2
+ import { PermissionDBGroup } from '../../consts.js';
3
+ import { tsValidateStringWithDashesAndSlash, validateProjectId } from '../../validators.js';
4
+ const Validator_ModifiableProps = {
5
+ projectId: validateProjectId,
6
+ path: tsValidateStringWithDashesAndSlash,
7
+ accessLevelIds: tsValidateArray(tsValidateUniqueId, false),
8
+ deprecated: tsValidateBoolean(false),
9
+ onlyForApplication: tsValidateBoolean(false),
10
+ };
11
+ const Validator_GeneratedProps = {
12
+ _auditorId: tsValidateString(),
13
+ _accessLevels: tsValidateDynamicObject(tsValidateNumber(), tsValidateString(), false),
14
+ };
15
+ export const DBDef_PermissionAPI = {
16
+ modifiablePropsValidator: Validator_ModifiableProps,
17
+ generatedPropsValidator: Validator_GeneratedProps,
18
+ versions: ['1.0.1', '1.0.0'],
19
+ dbKey: 'permissions--api',
20
+ frontend: {
21
+ group: PermissionDBGroup,
22
+ name: 'api',
23
+ },
24
+ backend: {
25
+ name: 'permissions--api',
26
+ },
27
+ entityName: 'PermissionsAPI',
28
+ uniqueKeys: ['projectId', 'path'],
29
+ dependencies: {
30
+ projectId: {
31
+ dbKey: 'permissions--project',
32
+ fieldType: 'string'
33
+ },
34
+ accessLevelIds: {
35
+ dbKey: 'permissions--level',
36
+ fieldType: 'string[]'
37
+ }
38
+ }
39
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './db-def.js';
3
+ export * from './api-def.js';
@@ -0,0 +1,4 @@
1
+ // Generated DB Item type: PermissionAPI
2
+ export * from './types.js';
3
+ export * from './db-def.js';
4
+ export * from './api-def.js';
@@ -0,0 +1,29 @@
1
+ import { AuditableV2, DB_Object, DBProto, Proto_DB_Object, UniqueId, VersionsDeclaration } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionProject } from '../permission-project/index.js';
3
+ import { DBProto_PermissionAccessLevel } from '../permission-access-level/index.js';
4
+ type VersionTypes_PermissionAPI = {
5
+ '1.0.0': DB_PermissionAPI;
6
+ '1.0.1': DB_PermissionAPI;
7
+ };
8
+ type Versions = VersionsDeclaration<['1.0.1', '1.0.0'], VersionTypes_PermissionAPI>;
9
+ type Dependencies = {
10
+ projectId: DBProto_PermissionProject;
11
+ accessLevelIds: DBProto_PermissionAccessLevel;
12
+ };
13
+ type UniqueKeys = 'projectId' | 'path';
14
+ type GeneratedProps = '_auditorId' | '_accessLevels';
15
+ type Proto = Proto_DB_Object<DB_PermissionAPI, 'permissions--api', GeneratedProps, Versions, UniqueKeys, Dependencies>;
16
+ export type DBProto_PermissionAPI = DBProto<Proto>;
17
+ export type UI_PermissionAPI = DBProto_PermissionAPI['uiType'];
18
+ export type DB_PermissionAPI = DB_Object & AuditableV2 & {
19
+ projectId: string;
20
+ path: string;
21
+ accessLevelIds?: string[];
22
+ deprecated?: boolean;
23
+ onlyForApplication?: boolean;
24
+ _accessLevels?: DomainToLevelValueMap;
25
+ };
26
+ export type DomainToLevelValueMap = {
27
+ [domainId: UniqueId]: number;
28
+ };
29
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ApiDefResolver } from '@nu-art/thunderstorm-shared';
2
+ export type ApiStruct_PermissionDomain = {
3
+ _v1: {};
4
+ };
5
+ export declare const ApiDef_PermissionDomain: ApiDefResolver<ApiStruct_PermissionDomain>;
@@ -0,0 +1,3 @@
1
+ export const ApiDef_PermissionDomain = {
2
+ _v1: {}
3
+ };
@@ -0,0 +1,3 @@
1
+ import { DBDef_V3 } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionDomain } from './types.js';
3
+ export declare const DBDef_PermissionDomain: DBDef_V3<DBProto_PermissionDomain>;
@@ -0,0 +1,31 @@
1
+ import { tsValidateString } from '@nu-art/ts-common';
2
+ import { validateProjectId } from '../../validators.js';
3
+ import { PermissionDBGroup } from '../../consts.js';
4
+ const Validator_ModifiableProps = {
5
+ projectId: validateProjectId,
6
+ namespace: tsValidateString(50),
7
+ };
8
+ const Validator_GeneratedProps = {
9
+ _auditorId: tsValidateString()
10
+ };
11
+ export const DBDef_PermissionDomain = {
12
+ modifiablePropsValidator: Validator_ModifiableProps,
13
+ generatedPropsValidator: Validator_GeneratedProps,
14
+ versions: ['1.0.0'],
15
+ dbKey: 'permissions--domain',
16
+ frontend: {
17
+ group: PermissionDBGroup,
18
+ name: 'domain',
19
+ },
20
+ backend: {
21
+ name: 'permissions--domain',
22
+ },
23
+ entityName: 'PermissionDomain',
24
+ lockKeys: ['projectId'],
25
+ dependencies: {
26
+ projectId: {
27
+ fieldType: 'string',
28
+ dbKey: 'permissions--project',
29
+ }
30
+ }
31
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './db-def.js';
3
+ export * from './api-def.js';
@@ -0,0 +1,4 @@
1
+ // Generated DB Item type: PermissionDomain
2
+ export * from './types.js';
3
+ export * from './db-def.js';
4
+ export * from './api-def.js';
@@ -0,0 +1,19 @@
1
+ import { AuditableV2, DB_Object, DBProto, Proto_DB_Object, VersionsDeclaration } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionProject } from '../permission-project/index.js';
3
+ type VersionTypes_PermissionDomain = {
4
+ '1.0.0': DB_PermissionDomain;
5
+ };
6
+ type Versions = VersionsDeclaration<['1.0.0'], VersionTypes_PermissionDomain>;
7
+ type Dependencies = {
8
+ projectId: DBProto_PermissionProject;
9
+ };
10
+ type UniqueKeys = '_id';
11
+ type GeneratedProps = '_auditorId';
12
+ type Proto = Proto_DB_Object<DB_PermissionDomain, 'permissions--domain', GeneratedProps, Versions, UniqueKeys, Dependencies>;
13
+ export type DBProto_PermissionDomain = DBProto<Proto>;
14
+ export type UI_PermissionDomain = DBProto_PermissionDomain['uiType'];
15
+ export type DB_PermissionDomain = DB_Object & AuditableV2 & {
16
+ projectId: string;
17
+ namespace: string;
18
+ };
19
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ApiDefResolver } from '@nu-art/thunderstorm-shared';
2
+ export type ApiStruct_PermissionGroup = {
3
+ _v1: {};
4
+ };
5
+ export declare const ApiDef_PermissionGroup: ApiDefResolver<ApiStruct_PermissionGroup>;
@@ -0,0 +1,3 @@
1
+ export const ApiDef_PermissionGroup = {
2
+ _v1: {}
3
+ };
@@ -0,0 +1,3 @@
1
+ import { DBDef_V3 } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionGroup } from './types.js';
3
+ export declare const DBDef_PermissionGroup: DBDef_V3<DBProto_PermissionGroup>;
@@ -0,0 +1,37 @@
1
+ import { tsValidateArray, tsValidateDynamicObject, tsValidateNumber, tsValidateOptionalId, tsValidateString, tsValidateUniqueId } from '@nu-art/ts-common';
2
+ import { PermissionDBGroup } from '../../consts.js';
3
+ import { validateGroupLabel } from '../../validators.js';
4
+ const Validator_ModifiableProps = {
5
+ label: validateGroupLabel,
6
+ uiLabel: tsValidateString(),
7
+ projectId: tsValidateOptionalId,
8
+ accessLevelIds: tsValidateArray(tsValidateUniqueId, false),
9
+ };
10
+ const Validator_GeneratedProps = {
11
+ _levelsMap: tsValidateDynamicObject(tsValidateNumber(), tsValidateString(), false),
12
+ _auditorId: tsValidateString(),
13
+ };
14
+ export const DBDef_PermissionGroup = {
15
+ modifiablePropsValidator: Validator_ModifiableProps,
16
+ generatedPropsValidator: Validator_GeneratedProps,
17
+ versions: ['1.0.1', '1.0.0'],
18
+ dbKey: 'permissions--group',
19
+ entityName: 'PermissionGroup',
20
+ frontend: {
21
+ group: PermissionDBGroup,
22
+ name: 'group',
23
+ },
24
+ backend: {
25
+ name: 'permissions--group'
26
+ },
27
+ dependencies: {
28
+ projectId: {
29
+ dbKey: 'permissions--project',
30
+ fieldType: 'string',
31
+ },
32
+ accessLevelIds: {
33
+ dbKey: 'permissions--level',
34
+ fieldType: 'string[]',
35
+ }
36
+ }
37
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './db-def.js';
3
+ export * from './api-def.js';
@@ -0,0 +1,4 @@
1
+ // Generated DB Item type: PermissionGroup
2
+ export * from './types.js';
3
+ export * from './db-def.js';
4
+ export * from './api-def.js';
@@ -0,0 +1,31 @@
1
+ import { AuditableV2, DB_Object, DBProto, Proto_DB_Object, TypedMap, VersionsDeclaration } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionProject } from '../permission-project/index.js';
3
+ import { DBProto_PermissionAccessLevel } from '../permission-access-level/index.js';
4
+ type VersionTypes_PermissionGroup = {
5
+ '1.0.0': DB_PermissionGroup;
6
+ '1.0.1': DB_PermissionGroup;
7
+ };
8
+ type Versions = VersionsDeclaration<['1.0.1', '1.0.0'], VersionTypes_PermissionGroup>;
9
+ type Dependencies = {
10
+ projectId: DBProto_PermissionProject;
11
+ accessLevelIds: DBProto_PermissionAccessLevel;
12
+ };
13
+ type UniqueKeys = '_id';
14
+ type GeneratedProps = '_levelsMap' | '_auditorId';
15
+ type Proto = Proto_DB_Object<DB_PermissionGroup, 'permissions--group', GeneratedProps, Versions, UniqueKeys, Dependencies>;
16
+ export type DBProto_PermissionGroup = DBProto<Proto>;
17
+ export type UI_PermissionGroup = DBProto_PermissionGroup['uiType'];
18
+ export type DB_PermissionGroup = DB_Object & AuditableV2 & {
19
+ projectId?: string;
20
+ label: string;
21
+ uiLabel: string;
22
+ accessLevelIds: string[];
23
+ _levelsMap?: TypedMap<number>;
24
+ };
25
+ export type DB_PermissionGroup_1_0_0 = DB_Object & AuditableV2 & {
26
+ projectId?: string;
27
+ label: string;
28
+ accessLevelIds: string[];
29
+ _levelsMap?: TypedMap<number>;
30
+ };
31
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ApiDefResolver } from '@nu-art/thunderstorm-shared';
2
+ export type ApiStruct_PermissionProject = {
3
+ _v1: {};
4
+ };
5
+ export declare const ApiDef_PermissionProject: ApiDefResolver<ApiStruct_PermissionProject>;
@@ -0,0 +1,3 @@
1
+ export const ApiDef_PermissionProject = {
2
+ _v1: {}
3
+ };
@@ -0,0 +1,3 @@
1
+ import { DBDef_V3 } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionProject } from './types.js';
3
+ export declare const DBDef_PermissionProject: DBDef_V3<DBProto_PermissionProject>;
@@ -0,0 +1,23 @@
1
+ import { tsValidateString } from '@nu-art/ts-common';
2
+ import { PermissionDBGroup } from '../../consts.js';
3
+ import { validateProjectName } from '../../validators.js';
4
+ const Validator_ModifiableProps = {
5
+ name: validateProjectName,
6
+ };
7
+ const Validator_GeneratedProps = {
8
+ _auditorId: tsValidateString()
9
+ };
10
+ export const DBDef_PermissionProject = {
11
+ modifiablePropsValidator: Validator_ModifiableProps,
12
+ generatedPropsValidator: Validator_GeneratedProps,
13
+ versions: ['1.0.0'],
14
+ dbKey: 'permissions--project',
15
+ entityName: 'PermissionsProject',
16
+ frontend: {
17
+ group: PermissionDBGroup,
18
+ name: 'project',
19
+ },
20
+ backend: {
21
+ name: 'permissions--project'
22
+ }
23
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './db-def.js';
3
+ export * from './api-def.js';
@@ -0,0 +1,4 @@
1
+ // Generated DB Item type: PermissionProject
2
+ export * from './types.js';
3
+ export * from './db-def.js';
4
+ export * from './api-def.js';
@@ -0,0 +1,15 @@
1
+ import { AuditableV2, DB_Object, DBProto, Proto_DB_Object, VersionsDeclaration } from '@nu-art/ts-common';
2
+ type VersionTypes_PermissionProject = {
3
+ '1.0.0': DB_PermissionProject;
4
+ };
5
+ type Versions = VersionsDeclaration<['1.0.0'], VersionTypes_PermissionProject>;
6
+ type Dependencies = {};
7
+ type UniqueKeys = '_id';
8
+ type GeneratedProps = '_auditorId';
9
+ type Proto = Proto_DB_Object<DB_PermissionProject, 'permissions--project', GeneratedProps, Versions, UniqueKeys, Dependencies>;
10
+ export type DBProto_PermissionProject = DBProto<Proto>;
11
+ export type UI_PermissionProject = DBProto_PermissionProject['uiType'];
12
+ export type DB_PermissionProject = DB_Object & AuditableV2 & {
13
+ name: string;
14
+ };
15
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { ApiDefResolver, BodyApi } from '@nu-art/thunderstorm-shared';
2
+ export type Request_AssignPermissions = {
3
+ projectId?: string;
4
+ permissionGroupIds: string[];
5
+ targetAccountIds: string[];
6
+ };
7
+ export type ApiStruct_PermissionUser = {
8
+ _v1: {
9
+ assignPermissions: BodyApi<void, Request_AssignPermissions>;
10
+ };
11
+ };
12
+ export declare const ApiDef_PermissionUser: ApiDefResolver<ApiStruct_PermissionUser>;
@@ -0,0 +1,6 @@
1
+ import { HttpMethod } from '@nu-art/thunderstorm-shared';
2
+ export const ApiDef_PermissionUser = {
3
+ _v1: {
4
+ assignPermissions: { method: HttpMethod.POST, path: '/pah/permissions/assign/app-permissions' }
5
+ }
6
+ };
@@ -0,0 +1,3 @@
1
+ import { DBDef_V3 } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionUser } from './types.js';
3
+ export declare const DBDef_PermissionUser: DBDef_V3<DBProto_PermissionUser>;
@@ -0,0 +1,31 @@
1
+ import { tsValidateArray, tsValidateString, tsValidateStringAndNumbersWithDashes } from '@nu-art/ts-common';
2
+ import { PermissionDBGroup } from '../../consts.js';
3
+ const Validator_ModifiableProps = {
4
+ groups: tsValidateArray({
5
+ groupId: tsValidateStringAndNumbersWithDashes,
6
+ }, false),
7
+ };
8
+ const Validator_GeneratedProps = {
9
+ __groupIds: tsValidateArray(tsValidateStringAndNumbersWithDashes, false),
10
+ _auditorId: tsValidateString()
11
+ };
12
+ export const DBDef_PermissionUser = {
13
+ modifiablePropsValidator: Validator_ModifiableProps,
14
+ generatedPropsValidator: Validator_GeneratedProps,
15
+ versions: ['1.0.0'],
16
+ dbKey: 'permissions--user',
17
+ entityName: 'PermissionUser',
18
+ frontend: {
19
+ group: PermissionDBGroup,
20
+ name: 'user',
21
+ },
22
+ backend: {
23
+ name: 'permissions--user'
24
+ },
25
+ dependencies: {
26
+ '__groupIds': {
27
+ fieldType: 'string[]',
28
+ dbKey: 'permissions--group',
29
+ }
30
+ }
31
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './db-def.js';
3
+ export * from './api-def.js';
@@ -0,0 +1,4 @@
1
+ // Generated DB Item type: PermissionUser
2
+ export * from './types.js';
3
+ export * from './db-def.js';
4
+ export * from './api-def.js';
@@ -0,0 +1,22 @@
1
+ import { AuditableV2, DB_Object, DBProto, Proto_DB_Object, VersionsDeclaration } from '@nu-art/ts-common';
2
+ import { DBProto_PermissionGroup } from '../permission-group/index.js';
3
+ type VersionTypes_PermissionUser = {
4
+ '1.0.0': DB_PermissionUser;
5
+ };
6
+ type Versions = VersionsDeclaration<['1.0.0'], VersionTypes_PermissionUser>;
7
+ type Dependencies = {
8
+ '__groupIds': DBProto_PermissionGroup;
9
+ };
10
+ type UniqueKeys = '_id';
11
+ type GeneratedProps = '__groupIds' | '_auditorId';
12
+ type Proto = Proto_DB_Object<DB_PermissionUser, 'permissions--user', GeneratedProps, Versions, UniqueKeys, Dependencies>;
13
+ export type DBProto_PermissionUser = DBProto<Proto>;
14
+ export type UI_PermissionUser = DBProto_PermissionUser['uiType'];
15
+ export type User_Group = {
16
+ groupId: string;
17
+ };
18
+ export type DB_PermissionUser = DB_Object & AuditableV2 & {
19
+ groups: User_Group[];
20
+ __groupIds?: string[];
21
+ };
22
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/_entity.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './_entity/permission-access-level/index.js';
2
+ export * from './_entity/permission-api/index.js';
3
+ export * from './_entity/permission-project/index.js';
4
+ export * from './_entity/permission-domain/index.js';
5
+ export * from './_entity/permission-group/index.js';
6
+ export * from './_entity/permission-user/index.js';
package/_entity.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './_entity/permission-access-level/index.js';
2
+ export * from './_entity/permission-api/index.js';
3
+ export * from './_entity/permission-project/index.js';
4
+ export * from './_entity/permission-domain/index.js';
5
+ export * from './_entity/permission-group/index.js';
6
+ export * from './_entity/permission-user/index.js';
package/apis.d.ts ADDED
@@ -0,0 +1,75 @@
1
+ import { ApiDefResolver, BodyApi, QueryApi } from '@nu-art/thunderstorm-shared';
2
+ import { PreDB, StringMap } from '@nu-art/ts-common';
3
+ import { DB_PermissionProject } from './_entity.js';
4
+ export type UserUrlsPermissions = {
5
+ [url: string]: boolean;
6
+ };
7
+ export type Request_AssertApiForUser = {
8
+ projectId: string;
9
+ path: string;
10
+ };
11
+ export type Request_UserUrlsPermissions = {
12
+ projectId: string;
13
+ urls: UserUrlsPermissions;
14
+ };
15
+ export type Request_UserCFsByShareGroups = {
16
+ groupsIds: string[];
17
+ };
18
+ export type Request_UsersCFsByShareGroups = Request_UserCFsByShareGroups & {
19
+ usersEmails: string[];
20
+ };
21
+ export type Response_UsersCFsByShareGroups = {
22
+ [userEmail: string]: StringMap[];
23
+ };
24
+ export type Request_AssignAppPermissions<T extends StringMap = StringMap> = {
25
+ projectId: string;
26
+ groupsToRemove: PredefinedGroup[];
27
+ group: PredefinedGroup;
28
+ customField: T;
29
+ assertKeys?: (keyof T)[];
30
+ customKey: string;
31
+ sharedUserIds?: string[];
32
+ appAccountId?: string;
33
+ };
34
+ export type AssignAppPermissions = Request_AssignAppPermissions & {
35
+ granterUserId: string;
36
+ };
37
+ export type PredefinedGroup = {
38
+ _id: string;
39
+ key: string;
40
+ label: string;
41
+ customKeys?: string[];
42
+ };
43
+ export type PredefinedUser = {
44
+ accountId: string;
45
+ _id: string;
46
+ groups: PredefinedGroup[];
47
+ };
48
+ export type Request_RegisterProject = {
49
+ project: PreDB<DB_PermissionProject>;
50
+ routes: string[];
51
+ predefinedGroups?: PredefinedGroup[];
52
+ predefinedUser?: PredefinedUser;
53
+ };
54
+ export type Response_User = {
55
+ userId: string;
56
+ };
57
+ export type _ApiStruct_PermissionsUser = {
58
+ pah: {
59
+ assignAppPermissions: BodyApi<void, Request_AssignAppPermissions>;
60
+ };
61
+ };
62
+ export declare const _ApiDef_PermissionUser: ApiDefResolver<_ApiStruct_PermissionsUser>;
63
+ export type ApiStruct_PermissionsAssert = {
64
+ vv1: {
65
+ assertUserPermissions: BodyApi<Response_User, Request_AssertApiForUser>;
66
+ };
67
+ };
68
+ export declare const ApiDef_PermissionsAssert: ApiDefResolver<ApiStruct_PermissionsAssert>;
69
+ export type ApiStruct_Permissions = {
70
+ v1: {
71
+ toggleStrictMode: QueryApi<void>;
72
+ createProject: QueryApi<void>;
73
+ };
74
+ };
75
+ export declare const ApiDef_Permissions: ApiDefResolver<ApiStruct_Permissions>;
package/apis.js ADDED
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Permissions management system, define access level for each of
3
+ * your server apis, and restrict users by giving them access levels
4
+ *
5
+ * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ import { HttpMethod } from '@nu-art/thunderstorm-shared';
20
+ import { Minute } from '@nu-art/ts-common';
21
+ export const _ApiDef_PermissionUser = {
22
+ pah: {
23
+ assignAppPermissions: { method: HttpMethod.POST, path: '/v1/permissions/assign/app-permissions' }
24
+ }
25
+ };
26
+ export const ApiDef_PermissionsAssert = {
27
+ vv1: {
28
+ assertUserPermissions: { method: HttpMethod.POST, path: 'v1/permissions/assert-user-access' }
29
+ }
30
+ };
31
+ export const ApiDef_Permissions = {
32
+ v1: {
33
+ // getUserUrlsPermissions: {method: HttpMethod.POST, path: 'v1/permissions/user-urls-permissions'},
34
+ // getUserCFsByShareGroups: {method: HttpMethod.POST, path: 'v1/user-custom-fields/user-cf-by-share-groups'},
35
+ // getUsersCFsByShareGroups: {method: HttpMethod.POST, path: 'v1/user-custom-fields/users-cf-by-share-groups'},
36
+ // registerExternalProject: {method: HttpMethod.POST, path: 'v1/register/register-external-project'},
37
+ // registerProject: {method: HttpMethod.GET, path: 'v1/register/register-project'},
38
+ toggleStrictMode: { method: HttpMethod.GET, path: 'v1/permissions/toggle-strict-mode', timeout: Minute },
39
+ createProject: { method: HttpMethod.GET, path: 'v1/permissions/create-first-project', timeout: Minute },
40
+ // connectDomainToRoutes: {method: HttpMethod.POST, path: 'v1/permissions/connect-domain-to-routes'},
41
+ }
42
+ };
package/consts.d.ts ADDED
@@ -0,0 +1,80 @@
1
+ import { PreDBAccessLevel } from './types.js';
2
+ export declare const PermissionDBGroup = "permission";
3
+ export declare const Prefix_PermissionKey = "permission-key--";
4
+ export declare const DomainNamespace_PermissionAssignment = "Permissions Assignment";
5
+ export declare const DomainNamespace_PermissionManagement = "Permissions Management";
6
+ export declare const DefaultAccessLevel_NoAccess: Readonly<{
7
+ name: "No-Access";
8
+ value: 0;
9
+ }>;
10
+ export declare const DefaultAccessLevel_Read: Readonly<{
11
+ name: "Read";
12
+ value: 200;
13
+ }>;
14
+ export declare const DefaultAccessLevel_Write: Readonly<{
15
+ name: "Write";
16
+ value: 400;
17
+ }>;
18
+ export declare const DefaultAccessLevel_Delete: Readonly<{
19
+ name: "Delete";
20
+ value: 600;
21
+ }>;
22
+ export declare const DefaultAccessLevel_Admin: Readonly<{
23
+ name: "Admin";
24
+ value: 1000;
25
+ }>;
26
+ export declare const DefaultUIAccessLevel_NoAccess: Readonly<{
27
+ name: "Ui-No-Access";
28
+ value: 0;
29
+ }>;
30
+ export declare const DefaultUIAccessLevel_Beta: Readonly<{
31
+ name: "Beta";
32
+ value: 1;
33
+ }>;
34
+ export declare const DefaultUIAccessLevel_Release: Readonly<{
35
+ name: "Release";
36
+ value: 2;
37
+ }>;
38
+ export declare const defaultUIAccessLevels: (Readonly<{
39
+ name: "Ui-No-Access";
40
+ value: 0;
41
+ }> | Readonly<{
42
+ name: "Beta";
43
+ value: 1;
44
+ }> | Readonly<{
45
+ name: "Release";
46
+ value: 2;
47
+ }>)[];
48
+ export declare const defaultAccessLevels: (Readonly<{
49
+ name: "No-Access";
50
+ value: 0;
51
+ }> | Readonly<{
52
+ name: "Read";
53
+ value: 200;
54
+ }> | Readonly<{
55
+ name: "Write";
56
+ value: 400;
57
+ }> | Readonly<{
58
+ name: "Delete";
59
+ value: 600;
60
+ }> | Readonly<{
61
+ name: "Admin";
62
+ value: 1000;
63
+ }>)[];
64
+ export declare const DuplicateDefaultAccessLevels: (seed: string) => {
65
+ _id: string;
66
+ uiLabel: string;
67
+ name: string;
68
+ value: number;
69
+ }[];
70
+ export declare const CreateDefaultAccessLevels: (seed: string, accessLevels: PreDBAccessLevel[]) => {
71
+ _id: string;
72
+ uiLabel: string;
73
+ name: string;
74
+ value: number;
75
+ }[];
76
+ export declare const generateKeyNamesByAccessLevel: <AccessLevel extends PreDBAccessLevel>(namespace: string, accessLevels: AccessLevel[]) => { [key in AccessLevel["name"]]: string; };
77
+ export declare const defaultPermissionKeySuffix = "permission-key";
78
+ export declare const defaultLevelsRouteLookupWords: {
79
+ [k: string]: string;
80
+ };
package/consts.js ADDED
@@ -0,0 +1,60 @@
1
+ import { md5 } from '@nu-art/ts-common';
2
+ export const PermissionDBGroup = 'permission';
3
+ export const Prefix_PermissionKey = 'permission-key--';
4
+ export const DomainNamespace_PermissionAssignment = 'Permissions Assignment';
5
+ export const DomainNamespace_PermissionManagement = 'Permissions Management';
6
+ export const DefaultAccessLevel_NoAccess = Object.freeze({ name: 'No-Access', value: 0 });
7
+ export const DefaultAccessLevel_Read = Object.freeze({ name: 'Read', value: 200 });
8
+ export const DefaultAccessLevel_Write = Object.freeze({ name: 'Write', value: 400 });
9
+ export const DefaultAccessLevel_Delete = Object.freeze({ name: 'Delete', value: 600 });
10
+ export const DefaultAccessLevel_Admin = Object.freeze({ name: 'Admin', value: 1000 });
11
+ //UI access levels
12
+ export const DefaultUIAccessLevel_NoAccess = Object.freeze({ name: 'Ui-No-Access', value: 0 });
13
+ export const DefaultUIAccessLevel_Beta = Object.freeze({ name: 'Beta', value: 1 });
14
+ export const DefaultUIAccessLevel_Release = Object.freeze({ name: 'Release', value: 2 });
15
+ export const defaultUIAccessLevels = [
16
+ DefaultUIAccessLevel_NoAccess,
17
+ DefaultUIAccessLevel_Beta,
18
+ DefaultUIAccessLevel_Release
19
+ ];
20
+ export const defaultAccessLevels = [
21
+ DefaultAccessLevel_NoAccess,
22
+ DefaultAccessLevel_Read,
23
+ DefaultAccessLevel_Write,
24
+ DefaultAccessLevel_Delete,
25
+ DefaultAccessLevel_Admin,
26
+ ];
27
+ export const DuplicateDefaultAccessLevels = (seed) => {
28
+ return CreateDefaultAccessLevels(seed, [
29
+ { ...DefaultAccessLevel_NoAccess },
30
+ { ...DefaultAccessLevel_Read },
31
+ { ...DefaultAccessLevel_Write },
32
+ { ...DefaultAccessLevel_Delete },
33
+ { ...DefaultAccessLevel_Admin },
34
+ ]);
35
+ };
36
+ const generateDefaultKeyName = (namespace, accessLevelName) => {
37
+ return `${defaultPermissionKeySuffix}--${namespace}--${accessLevelName}`;
38
+ };
39
+ export const CreateDefaultAccessLevels = (seed, accessLevels) => {
40
+ return accessLevels.map(level => ({ ...level, _id: md5(`${seed}${level.name}`), uiLabel: level.name }));
41
+ };
42
+ export const generateKeyNamesByAccessLevel = (namespace, accessLevels) => {
43
+ return accessLevels.reduce((keyMapper, currentAccessLevel) => {
44
+ const currentKey = currentAccessLevel.name;
45
+ keyMapper[currentKey] = generateDefaultKeyName(namespace, currentAccessLevel.name);
46
+ return keyMapper;
47
+ }, {});
48
+ };
49
+ export const defaultPermissionKeySuffix = 'permission-key';
50
+ export const defaultLevelsRouteLookupWords = {
51
+ 'query': 'Read',
52
+ 'query-unique': 'Read',
53
+ 'sync': 'Read',
54
+ 'patch': 'Write',
55
+ 'upsert': 'Write',
56
+ 'upsert-all': 'Write',
57
+ 'delete': 'Delete',
58
+ 'delete-all': 'Delete',
59
+ 'delete-unique': 'Delete'
60
+ };
package/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from './_entity/permission-access-level/index.js';
2
+ export * from './_entity/permission-api/index.js';
3
+ export * from './_entity/permission-domain/index.js';
4
+ export * from './_entity/permission-group/index.js';
5
+ export * from './_entity/permission-project/index.js';
6
+ export * from './_entity/permission-user/index.js';
7
+ export * from './apis.js';
8
+ export * from './consts.js';
9
+ export * from './types.js';
10
+ export * from './permission-keys.js';
package/index.js ADDED
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Permissions management system, define access level for each of
3
+ * your server apis, and restrict users by giving them access levels
4
+ *
5
+ * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ export * from './_entity/permission-access-level/index.js';
20
+ export * from './_entity/permission-api/index.js';
21
+ export * from './_entity/permission-domain/index.js';
22
+ export * from './_entity/permission-group/index.js';
23
+ export * from './_entity/permission-project/index.js';
24
+ export * from './_entity/permission-user/index.js';
25
+ export * from './apis.js';
26
+ export * from './consts.js';
27
+ export * from './types.js';
28
+ export * from './permission-keys.js';
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@nu-art/permissions-shared",
3
+ "version": "0.400.5",
4
+ "description": "Permissions Shared",
5
+ "keywords": [
6
+ "TacB0sS",
7
+ "create account",
8
+ "express",
9
+ "infra",
10
+ "login",
11
+ "nu-art",
12
+ "permissions",
13
+ "saml",
14
+ "thunderstorm",
15
+ "typescript",
16
+ "user-account"
17
+ ],
18
+ "homepage": "https://github.com/nu-art-js/permissions",
19
+ "bugs": {
20
+ "url": "https://github.com/nu-art-js/permissions/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+ssh://git@github.com:nu-art-js/permissions.git"
25
+ },
26
+ "publishConfig": {
27
+ "directory": "dist",
28
+ "linkDirectory": true
29
+ },
30
+ "license": "Apache-2.0",
31
+ "author": "TacB0sS",
32
+ "scripts": {
33
+ "build": "tsc",
34
+ "run-tests": "firebase emulators:exec \"npm run test\"",
35
+ "test": "ts-mocha -w -p src/test/tsconfig.json --timeout 0 --inspect=8107 --watch-files '**/*.ts' src/test/__all-tests.ts"
36
+ },
37
+ "dependencies": {
38
+ "@nu-art/ts-common": "0.400.5",
39
+ "@nu-art/firebase-shared": "0.400.5",
40
+ "@nu-art/thunderstorm-shared": "0.400.5",
41
+ "@nu-art/user-account-shared": "0.400.5",
42
+ "@nu-art/ts-styles": "0.400.5",
43
+ "firebase": "^11.9.0",
44
+ "firebase-admin": "13.4.0",
45
+ "firebase-functions": "6.3.2",
46
+ "react": "^18.0.0",
47
+ "react-dom": "^18.0.0",
48
+ "react-router-dom": "^6.9.0",
49
+ "moment": "^2.29.4",
50
+ "saml2-js": "^4.0.1",
51
+ "express": "^4.18.2",
52
+ "request": "^2.88.0"
53
+ },
54
+ "devDependencies": {
55
+ "@types/react": "^18.0.0",
56
+ "@types/express": "^4.17.17",
57
+ "@types/react-dom": "^18.0.0",
58
+ "@types/react-router": "^5.1.20",
59
+ "@types/react-router-dom": "^5.3.3",
60
+ "@types/chai": "^4.3.4",
61
+ "@types/mocha": "^10.0.1",
62
+ "@types/history": "^4.7.2",
63
+ "@types/request": "^2.48.1",
64
+ "@types/saml2-js": "^1.6.8"
65
+ },
66
+ "unitConfig": {
67
+ "type": "typescript-lib"
68
+ },
69
+ "type": "module",
70
+ "exports": {
71
+ ".": {
72
+ "types": "./index.d.ts",
73
+ "import": "./index.js"
74
+ },
75
+ "./*": {
76
+ "types": "./*.d.ts",
77
+ "import": "./*.js"
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,3 @@
1
+ export declare const PermissionKey_DeveloperViewer = "permission-key--developer-viewer";
2
+ export declare const PermissionKey_DeveloperWriter = "permission-key--developer-editor";
3
+ export declare const PermissionKey_DeveloperAdmin = "permission-key--developer-admin";
@@ -0,0 +1,3 @@
1
+ export const PermissionKey_DeveloperViewer = 'permission-key--developer-viewer';
2
+ export const PermissionKey_DeveloperWriter = 'permission-key--developer-editor';
3
+ export const PermissionKey_DeveloperAdmin = 'permission-key--developer-admin';
package/types.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { TypedKeyValue, TypedMap, UniqueId } from '@nu-art/ts-common';
2
+ import { DomainToLevelValueMap } from './_entity/permission-api/index.js';
3
+ export type PermissionKey = string;
4
+ export declare const Const_PermissionKeyType = "permission-key";
5
+ export type PermissionKeyType = typeof Const_PermissionKeyType;
6
+ export type DefaultDef_Api = {
7
+ path: string;
8
+ accessLevel: string;
9
+ domainId?: string;
10
+ };
11
+ export type DefaultDef_GeneratedApi = {
12
+ domain: string;
13
+ collections: string[];
14
+ };
15
+ export type DB_PermissionKeyData = {
16
+ type: PermissionKeyType;
17
+ accessLevelIds: UniqueId[];
18
+ _accessLevels: DomainToLevelValueMap;
19
+ };
20
+ export type PreDBAccessLevel = {
21
+ name: string;
22
+ value: number;
23
+ };
24
+ export type DefaultDef_AccessLevel = {
25
+ _id: string;
26
+ name: string;
27
+ uiLabel: string;
28
+ value: number;
29
+ };
30
+ export type DefaultDef_Group = {
31
+ _id: string;
32
+ name: string;
33
+ uiLabel: string;
34
+ accessLevels: {
35
+ [domainName: string]: string;
36
+ };
37
+ };
38
+ export type SessionData_Permissions_Value = {
39
+ domainToValueMap: TypedMap<number>;
40
+ roles: {
41
+ key: string;
42
+ uiLabel: string;
43
+ }[];
44
+ };
45
+ export type SessionData_Permissions = TypedKeyValue<'permissions', SessionData_Permissions_Value>;
46
+ export type SessionData_StrictMode = TypedKeyValue<'strictMode', {
47
+ isStrictMode: boolean;
48
+ }>;
package/types.js ADDED
@@ -0,0 +1 @@
1
+ export const Const_PermissionKeyType = 'permission-key';
@@ -0,0 +1,6 @@
1
+ export declare const validateProjectId: import("@nu-art/ts-common").Validator<string>;
2
+ export declare const tsValidateStringWithDashesAndSlash: import("@nu-art/ts-common").Validator<string>;
3
+ export declare const validateProjectName: import("@nu-art/ts-common").Validator<string>;
4
+ export declare const validateUserUuid: import("@nu-art/ts-common").Validator<string>;
5
+ export declare const validateGroupLabel: import("@nu-art/ts-common").Validator<string>;
6
+ export declare const validateCustomFieldValues: import("@nu-art/ts-common").Validator<string>;
package/validators.js ADDED
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Permissions management system, define access level for each of
3
+ * your server apis, and restrict users by giving them access levels
4
+ *
5
+ * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ import { tsValidateRegexp, tsValidateUniqueId } from '@nu-art/ts-common';
20
+ export const validateProjectId = tsValidateUniqueId;
21
+ export const tsValidateStringWithDashesAndSlash = tsValidateRegexp(/^[0-9A-Za-z-/]+$/);
22
+ export const validateProjectName = tsValidateRegexp(/^[A-Za-z- ]{3,40}$/);
23
+ export const validateUserUuid = tsValidateRegexp(/^.{0,50}$/);
24
+ export const validateGroupLabel = tsValidateRegexp(/^[A-Za-z-0-9\._\/ ]+$/);
25
+ export const validateCustomFieldValues = tsValidateRegexp(/^.{0,500}$/);