@forklaunch/interfaces-iam 0.1.0 → 0.1.1

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/index.ts CHANGED
@@ -1,4 +1,2 @@
1
- export * from './interfaces/organization.service.interface';
2
- export * from './interfaces/permission.service.interface';
3
- export * from './interfaces/role.service.interface';
4
- export * from './interfaces/user.service.interface';
1
+ export * from './interfaces';
2
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export * from './organization.service.interface';
2
+ export * from './permission.service.interface';
3
+ export * from './role.service.interface';
4
+ export * from './user.service.interface';
@@ -1,28 +1,5 @@
1
- import { IdDto, RecordTimingDto } from '@forklaunch/common';
2
1
  import { EntityManager } from '@mikro-orm/core';
3
- import { UserDto } from './user.service.interface';
4
-
5
- export type CreateOrganizationDto = {
6
- name: string;
7
- domain: string;
8
- subscription: string;
9
- logoUrl?: string;
10
- extraFields?: unknown;
11
- };
12
- export type UpdateOrganizationDto = IdDto & Partial<CreateOrganizationDto>;
13
- export type OrganizationDto<OrganizationStatus> = IdDto &
14
- CreateOrganizationDto &
15
- Partial<RecordTimingDto> & {
16
- users: UserDto[];
17
- status: OrganizationStatus[keyof OrganizationStatus];
18
- };
19
-
20
- export type OrganizationServiceParameters<OrganizationStatus> = {
21
- CreateOrganizationDto: CreateOrganizationDto;
22
- OrganizationDto: OrganizationDto<OrganizationStatus>;
23
- UpdateOrganizationDto: UpdateOrganizationDto;
24
- IdDto: IdDto;
25
- };
2
+ import { OrganizationServiceParameters } from '../types/organization.service.types';
26
3
 
27
4
  export interface OrganizationService<
28
5
  OrganizationStatus,
@@ -1,27 +1,5 @@
1
- import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
1
  import { EntityManager } from '@mikro-orm/core';
3
-
4
- export type CreatePermissionDto = {
5
- slug: string;
6
- addToRolesIds?: string[];
7
- extraFields?: unknown;
8
- };
9
- export type UpdatePermissionDto = IdDto &
10
- Partial<CreatePermissionDto> & {
11
- removeFromRolesIds?: string[];
12
- };
13
- export type PermissionDto = IdDto &
14
- Partial<RecordTimingDto> & {
15
- slug: string;
16
- };
17
-
18
- export type PermissionServiceParameters = {
19
- CreatePermissionDto: CreatePermissionDto;
20
- PermissionDto: PermissionDto;
21
- UpdatePermissionDto: UpdatePermissionDto;
22
- IdDto: IdDto;
23
- IdsDto: IdsDto;
24
- };
2
+ import { PermissionServiceParameters } from '../types/permission.service.types';
25
3
 
26
4
  export interface PermissionService<
27
5
  Params extends PermissionServiceParameters = PermissionServiceParameters
@@ -1,26 +1,5 @@
1
- import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
1
  import { EntityManager } from '@mikro-orm/core';
3
- import { PermissionDto } from './permission.service.interface';
4
-
5
- export type CreateRoleDto = {
6
- name: string;
7
- permissionsIds?: PermissionDto[];
8
- extraFields?: unknown;
9
- };
10
- export type UpdateRoleDto = IdDto & Partial<CreateRoleDto>;
11
- export type RoleDto = IdDto &
12
- Omit<CreateRoleDto, 'permissionsIds'> &
13
- Partial<RecordTimingDto> & {
14
- permissions: PermissionDto[];
15
- };
16
-
17
- export type RoleServiceParameters = {
18
- CreateRoleDto: CreateRoleDto;
19
- RoleDto: RoleDto;
20
- UpdateRoleDto: UpdateRoleDto;
21
- IdDto: IdDto;
22
- IdsDto: IdsDto;
23
- };
2
+ import { RoleServiceParameters } from '../types/role.service.types';
24
3
 
25
4
  export interface RoleService<
26
5
  Params extends RoleServiceParameters = RoleServiceParameters
@@ -1,34 +1,5 @@
1
- import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
1
  import { EntityManager } from '@mikro-orm/core';
3
- import { RoleDto } from './role.service.interface';
4
-
5
- export type CreateUserDto = {
6
- email: string;
7
- password: string;
8
- firstName: string;
9
- lastName: string;
10
- organizationId: string;
11
- roleIds: string[];
12
- phoneNumber?: string;
13
- subscription?: string;
14
- extraFields?: unknown;
15
- };
16
- export type UpdateUserDto = IdDto &
17
- Partial<Omit<CreateUserDto, 'organizationId'>>;
18
-
19
- export type UserDto = IdDto &
20
- Omit<CreateUserDto, 'roleIds' | 'password' | 'organizationId'> &
21
- Partial<RecordTimingDto> & {
22
- roles: RoleDto[];
23
- };
24
-
25
- export type UserServiceParameters = {
26
- CreateUserDto: CreateUserDto;
27
- UserDto: UserDto;
28
- UpdateUserDto: UpdateUserDto;
29
- IdDto: IdDto;
30
- IdsDto: IdsDto;
31
- };
2
+ import { UserServiceParameters } from '../types/user.service.types';
32
3
 
33
4
  export interface UserService<
34
5
  Params extends UserServiceParameters = UserServiceParameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/interfaces-iam",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "IAM interfaces for forklaunch",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -12,7 +12,6 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Forklift Technologies, Inc.",
15
- "main": "server.ts",
16
15
  "dependencies": {
17
16
  "@forklaunch/common": "^0.2.5",
18
17
  "@mikro-orm/core": "^6.4.11"
@@ -29,12 +28,13 @@
29
28
  ]
30
29
  },
31
30
  "scripts": {
32
- "build": "tsc",
33
- "clean": "rm -rf dist pnpm.lock.yaml node_modules",
31
+ "build": "tsc && pnpm package:eject",
32
+ "clean": "rm -rf lib pnpm.lock.yaml node_modules",
34
33
  "docs": "typedoc --out docs *",
35
34
  "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
36
35
  "lint": "eslint . -c eslint.config.mjs",
37
36
  "lint:fix": "eslint . -c eslint.config.mjs --fix",
37
+ "package:eject": "mkdir -p lib/eject && cp -r interfaces lib/eject/interfaces && cp -r types lib/eject/types",
38
38
  "start": "ENV_FILE_PATH=.env.local NODE_OPTIONS='--import=tsx' node dist/server.js",
39
39
  "start:bun": "bun run migrate:up && bun dist/server.js",
40
40
  "test": "vitest --passWithNoTests"
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "outDir": "dist"
4
+ "outDir": "lib"
5
5
  },
6
- "exclude": ["node_modules", "dist", "eslint.config.mjs"]
6
+ "exclude": ["node_modules", "lib", "eslint.config.mjs"]
7
7
  }
package/types/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './organization.service.types';
2
+ export * from './permission.service.types';
3
+ export * from './role.service.types';
4
+ export * from './user.service.types';
@@ -0,0 +1,24 @@
1
+ import { IdDto, RecordTimingDto } from '@forklaunch/common';
2
+ import { UserDto } from './user.service.types';
3
+
4
+ export type CreateOrganizationDto = {
5
+ name: string;
6
+ domain: string;
7
+ subscription: string;
8
+ logoUrl?: string;
9
+ extraFields?: unknown;
10
+ };
11
+ export type UpdateOrganizationDto = IdDto & Partial<CreateOrganizationDto>;
12
+ export type OrganizationDto<OrganizationStatus> = IdDto &
13
+ CreateOrganizationDto &
14
+ Partial<RecordTimingDto> & {
15
+ users: UserDto[];
16
+ status: OrganizationStatus[keyof OrganizationStatus];
17
+ };
18
+
19
+ export type OrganizationServiceParameters<OrganizationStatus> = {
20
+ CreateOrganizationDto: CreateOrganizationDto;
21
+ OrganizationDto: OrganizationDto<OrganizationStatus>;
22
+ UpdateOrganizationDto: UpdateOrganizationDto;
23
+ IdDto: IdDto;
24
+ };
@@ -0,0 +1,23 @@
1
+ import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
+
3
+ export type CreatePermissionDto = {
4
+ slug: string;
5
+ addToRolesIds?: string[];
6
+ extraFields?: unknown;
7
+ };
8
+ export type UpdatePermissionDto = IdDto &
9
+ Partial<CreatePermissionDto> & {
10
+ removeFromRolesIds?: string[];
11
+ };
12
+ export type PermissionDto = IdDto &
13
+ Partial<RecordTimingDto> & {
14
+ slug: string;
15
+ };
16
+
17
+ export type PermissionServiceParameters = {
18
+ CreatePermissionDto: CreatePermissionDto;
19
+ PermissionDto: PermissionDto;
20
+ UpdatePermissionDto: UpdatePermissionDto;
21
+ IdDto: IdDto;
22
+ IdsDto: IdsDto;
23
+ };
@@ -0,0 +1,22 @@
1
+ import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
+ import { PermissionDto } from './permission.service.types';
3
+
4
+ export type CreateRoleDto = {
5
+ name: string;
6
+ permissionsIds?: PermissionDto[];
7
+ extraFields?: unknown;
8
+ };
9
+ export type UpdateRoleDto = IdDto & Partial<CreateRoleDto>;
10
+ export type RoleDto = IdDto &
11
+ Omit<CreateRoleDto, 'permissionsIds'> &
12
+ Partial<RecordTimingDto> & {
13
+ permissions: PermissionDto[];
14
+ };
15
+
16
+ export type RoleServiceParameters = {
17
+ CreateRoleDto: CreateRoleDto;
18
+ RoleDto: RoleDto;
19
+ UpdateRoleDto: UpdateRoleDto;
20
+ IdDto: IdDto;
21
+ IdsDto: IdsDto;
22
+ };
@@ -0,0 +1,30 @@
1
+ import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
+ import { RoleDto } from './role.service.types';
3
+
4
+ export type CreateUserDto = {
5
+ email: string;
6
+ password: string;
7
+ firstName: string;
8
+ lastName: string;
9
+ organizationId: string;
10
+ roleIds: string[];
11
+ phoneNumber?: string;
12
+ subscription?: string;
13
+ extraFields?: unknown;
14
+ };
15
+ export type UpdateUserDto = IdDto &
16
+ Partial<Omit<CreateUserDto, 'organizationId'>>;
17
+
18
+ export type UserDto = IdDto &
19
+ Omit<CreateUserDto, 'roleIds' | 'password' | 'organizationId'> &
20
+ Partial<RecordTimingDto> & {
21
+ roles: RoleDto[];
22
+ };
23
+
24
+ export type UserServiceParameters = {
25
+ CreateUserDto: CreateUserDto;
26
+ UserDto: UserDto;
27
+ UpdateUserDto: UpdateUserDto;
28
+ IdDto: IdDto;
29
+ IdsDto: IdsDto;
30
+ };