@23blocks/block-company 3.1.0 → 3.2.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/dist/index.esm.js CHANGED
@@ -35,6 +35,17 @@ import { decodeOne, decodePageResult, decodeMany } from '@23blocks/jsonapi-codec
35
35
  }
36
36
  return false;
37
37
  }
38
+ /**
39
+ * Parse an array of strings
40
+ */ function parseStringArray(value) {
41
+ if (value === null || value === undefined) {
42
+ return undefined;
43
+ }
44
+ if (Array.isArray(value)) {
45
+ return value.map(String);
46
+ }
47
+ return undefined;
48
+ }
38
49
  /**
39
50
  * Parse a number value
40
51
  */ function parseNumber(value) {
@@ -44,6 +55,15 @@ import { decodeOne, decodePageResult, decodeMany } from '@23blocks/jsonapi-codec
44
55
  const num = Number(value);
45
56
  return isNaN(num) ? 0 : num;
46
57
  }
58
+ /**
59
+ * Parse an optional number value
60
+ */ function parseOptionalNumber(value) {
61
+ if (value === null || value === undefined) {
62
+ return undefined;
63
+ }
64
+ const num = Number(value);
65
+ return isNaN(num) ? undefined : num;
66
+ }
47
67
  /**
48
68
  * Parse entity status
49
69
  */ function parseStatus(value) {
@@ -426,13 +446,181 @@ function createQuartersService(transport, _config) {
426
446
  };
427
447
  }
428
448
 
449
+ const positionMapper = {
450
+ type: 'Position',
451
+ map: (resource)=>({
452
+ id: resource.id,
453
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
454
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
455
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
456
+ code: parseString(resource.attributes['code']) || '',
457
+ name: parseString(resource.attributes['name']) || '',
458
+ description: parseString(resource.attributes['description']),
459
+ departmentUniqueId: parseString(resource.attributes['department_unique_id']),
460
+ level: parseNumber(resource.attributes['level']),
461
+ reportsToUniqueId: parseString(resource.attributes['reports_to_unique_id']),
462
+ status: parseStatus(resource.attributes['status']),
463
+ enabled: parseBoolean(resource.attributes['enabled']),
464
+ payload: resource.attributes['payload']
465
+ })
466
+ };
467
+
468
+ function createPositionsService(transport, _config) {
469
+ return {
470
+ async list (params) {
471
+ const queryParams = {};
472
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
473
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
474
+ if (params == null ? void 0 : params.departmentUniqueId) queryParams['department_unique_id'] = params.departmentUniqueId;
475
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
476
+ if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
477
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
478
+ const response = await transport.get('/positions', {
479
+ params: queryParams
480
+ });
481
+ return decodePageResult(response, positionMapper);
482
+ },
483
+ async get (uniqueId) {
484
+ const response = await transport.get(`/positions/${uniqueId}`);
485
+ return decodeOne(response, positionMapper);
486
+ },
487
+ async create (data) {
488
+ const response = await transport.post('/positions', {
489
+ position: {
490
+ code: data.code,
491
+ name: data.name,
492
+ description: data.description,
493
+ department_unique_id: data.departmentUniqueId,
494
+ level: data.level,
495
+ reports_to_unique_id: data.reportsToUniqueId,
496
+ payload: data.payload
497
+ }
498
+ });
499
+ return decodeOne(response, positionMapper);
500
+ },
501
+ async update (uniqueId, data) {
502
+ const response = await transport.put(`/positions/${uniqueId}`, {
503
+ position: {
504
+ name: data.name,
505
+ description: data.description,
506
+ department_unique_id: data.departmentUniqueId,
507
+ level: data.level,
508
+ reports_to_unique_id: data.reportsToUniqueId,
509
+ enabled: data.enabled,
510
+ status: data.status,
511
+ payload: data.payload
512
+ }
513
+ });
514
+ return decodeOne(response, positionMapper);
515
+ },
516
+ async delete (uniqueId) {
517
+ await transport.delete(`/positions/${uniqueId}`);
518
+ },
519
+ async listByDepartment (departmentUniqueId) {
520
+ const response = await transport.get(`/departments/${departmentUniqueId}/positions`);
521
+ return decodeMany(response, positionMapper);
522
+ }
523
+ };
524
+ }
525
+
526
+ const employeeAssignmentMapper = {
527
+ type: 'EmployeeAssignment',
528
+ map: (resource)=>{
529
+ var _parseBoolean;
530
+ return {
531
+ id: resource.id,
532
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
533
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
534
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
535
+ userUniqueId: parseString(resource.attributes['user_unique_id']) || '',
536
+ positionUniqueId: parseString(resource.attributes['position_unique_id']) || '',
537
+ departmentUniqueId: parseString(resource.attributes['department_unique_id']),
538
+ teamUniqueId: parseString(resource.attributes['team_unique_id']),
539
+ startDate: parseDate(resource.attributes['start_date']),
540
+ endDate: parseDate(resource.attributes['end_date']),
541
+ isPrimary: (_parseBoolean = parseBoolean(resource.attributes['is_primary'])) != null ? _parseBoolean : false,
542
+ status: parseStatus(resource.attributes['status']),
543
+ enabled: parseBoolean(resource.attributes['enabled']),
544
+ payload: resource.attributes['payload']
545
+ };
546
+ }
547
+ };
548
+
549
+ function createEmployeeAssignmentsService(transport, _config) {
550
+ return {
551
+ async list (params) {
552
+ const queryParams = {};
553
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
554
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
555
+ if (params == null ? void 0 : params.userUniqueId) queryParams['user_unique_id'] = params.userUniqueId;
556
+ if (params == null ? void 0 : params.positionUniqueId) queryParams['position_unique_id'] = params.positionUniqueId;
557
+ if (params == null ? void 0 : params.departmentUniqueId) queryParams['department_unique_id'] = params.departmentUniqueId;
558
+ if (params == null ? void 0 : params.teamUniqueId) queryParams['team_unique_id'] = params.teamUniqueId;
559
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
560
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
561
+ const response = await transport.get('/employee_assignments', {
562
+ params: queryParams
563
+ });
564
+ return decodePageResult(response, employeeAssignmentMapper);
565
+ },
566
+ async get (uniqueId) {
567
+ const response = await transport.get(`/employee_assignments/${uniqueId}`);
568
+ return decodeOne(response, employeeAssignmentMapper);
569
+ },
570
+ async create (data) {
571
+ const response = await transport.post('/employee_assignments', {
572
+ employee_assignment: {
573
+ user_unique_id: data.userUniqueId,
574
+ position_unique_id: data.positionUniqueId,
575
+ department_unique_id: data.departmentUniqueId,
576
+ team_unique_id: data.teamUniqueId,
577
+ start_date: data.startDate,
578
+ end_date: data.endDate,
579
+ is_primary: data.isPrimary,
580
+ payload: data.payload
581
+ }
582
+ });
583
+ return decodeOne(response, employeeAssignmentMapper);
584
+ },
585
+ async update (uniqueId, data) {
586
+ const response = await transport.put(`/employee_assignments/${uniqueId}`, {
587
+ employee_assignment: {
588
+ position_unique_id: data.positionUniqueId,
589
+ department_unique_id: data.departmentUniqueId,
590
+ team_unique_id: data.teamUniqueId,
591
+ start_date: data.startDate,
592
+ end_date: data.endDate,
593
+ is_primary: data.isPrimary,
594
+ enabled: data.enabled,
595
+ status: data.status,
596
+ payload: data.payload
597
+ }
598
+ });
599
+ return decodeOne(response, employeeAssignmentMapper);
600
+ },
601
+ async delete (uniqueId) {
602
+ await transport.delete(`/employee_assignments/${uniqueId}`);
603
+ },
604
+ async listByUser (userUniqueId) {
605
+ const response = await transport.get(`/users/${userUniqueId}/employee_assignments`);
606
+ return decodeMany(response, employeeAssignmentMapper);
607
+ },
608
+ async listByPosition (positionUniqueId) {
609
+ const response = await transport.get(`/positions/${positionUniqueId}/employee_assignments`);
610
+ return decodeMany(response, employeeAssignmentMapper);
611
+ }
612
+ };
613
+ }
614
+
429
615
  function createCompanyBlock(transport, config) {
430
616
  return {
431
617
  companies: createCompaniesService(transport),
432
618
  departments: createDepartmentsService(transport),
433
619
  teams: createTeamsService(transport),
434
620
  teamMembers: createTeamMembersService(transport),
435
- quarters: createQuartersService(transport)
621
+ quarters: createQuartersService(transport),
622
+ positions: createPositionsService(transport),
623
+ employeeAssignments: createEmployeeAssignmentsService(transport)
436
624
  };
437
625
  }
438
626
  const companyBlockMetadata = {
@@ -444,8 +632,10 @@ const companyBlockMetadata = {
444
632
  'Department',
445
633
  'Team',
446
634
  'TeamMember',
447
- 'Quarter'
635
+ 'Quarter',
636
+ 'Position',
637
+ 'EmployeeAssignment'
448
638
  ]
449
639
  };
450
640
 
451
- export { companyBlockMetadata, companyMapper, createCompaniesService, createCompanyBlock, createDepartmentsService, createQuartersService, createTeamMembersService, createTeamsService, departmentMapper, quarterMapper, teamMapper, teamMemberMapper };
641
+ export { companyBlockMetadata, companyMapper, createCompaniesService, createCompanyBlock, createDepartmentsService, createEmployeeAssignmentsService, createPositionsService, createQuartersService, createTeamMembersService, createTeamsService, departmentMapper, employeeAssignmentMapper, parseBoolean, parseDate, parseNumber, parseOptionalNumber, parseStatus, parseString, parseStringArray, positionMapper, quarterMapper, teamMapper, teamMemberMapper };
@@ -1,7 +1,6 @@
1
1
  export { createCompanyBlock, companyBlockMetadata } from './lib/company.block';
2
2
  export type { CompanyBlock, CompanyBlockConfig } from './lib/company.block';
3
- export type { Company, CreateCompanyRequest, UpdateCompanyRequest, ListCompaniesParams, Department, DepartmentHierarchy, CreateDepartmentRequest, UpdateDepartmentRequest, ListDepartmentsParams, Team, CreateTeamRequest, UpdateTeamRequest, ListTeamsParams, TeamMember, AddTeamMemberRequest, UpdateTeamMemberRequest, ListTeamMembersParams, Quarter, CreateQuarterRequest, UpdateQuarterRequest, ListQuartersParams, } from './lib/types';
4
- export type { CompaniesService, DepartmentsService, TeamsService, TeamMembersService, QuartersService, } from './lib/services';
5
- export { createCompaniesService, createDepartmentsService, createTeamsService, createTeamMembersService, createQuartersService, } from './lib/services';
6
- export { companyMapper, departmentMapper, teamMapper, teamMemberMapper, quarterMapper, } from './lib/mappers';
3
+ export * from './lib/types';
4
+ export * from './lib/services';
5
+ export * from './lib/mappers';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG5E,YAAY,EAEV,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EAEnB,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EAErB,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAEf,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EAErB,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,aAAa,GACd,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG5E,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,eAAe,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';
2
- import { type CompaniesService, type DepartmentsService, type TeamsService, type TeamMembersService, type QuartersService } from './services';
2
+ import { type CompaniesService, type DepartmentsService, type TeamsService, type TeamMembersService, type QuartersService, type PositionsService, type EmployeeAssignmentsService } from './services';
3
3
  export interface CompanyBlockConfig extends BlockConfig {
4
4
  appId: string;
5
5
  tenantId?: string;
@@ -10,6 +10,8 @@ export interface CompanyBlock {
10
10
  teams: TeamsService;
11
11
  teamMembers: TeamMembersService;
12
12
  quarters: QuartersService;
13
+ positions: PositionsService;
14
+ employeeAssignments: EmployeeAssignmentsService;
13
15
  }
14
16
  export declare function createCompanyBlock(transport: Transport, config: CompanyBlockConfig): CompanyBlock;
15
17
  export declare const companyBlockMetadata: BlockMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"company.block.d.ts","sourceRoot":"","sources":["../../../src/lib/company.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,kBAAkB,GACzB,YAAY,CAQd;AAED,eAAO,MAAM,oBAAoB,EAAE,aAWlC,CAAC"}
1
+ {"version":3,"file":"company.block.d.ts","sourceRoot":"","sources":["../../../src/lib/company.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAChC,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,mBAAmB,EAAE,0BAA0B,CAAC;CACjD;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,kBAAkB,GACzB,YAAY,CAUd;AAED,eAAO,MAAM,oBAAoB,EAAE,aAalC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ResourceMapper } from '@23blocks/jsonapi-codec';
2
+ import type { EmployeeAssignment } from '../types/employee-assignment';
3
+ export declare const employeeAssignmentMapper: ResourceMapper<EmployeeAssignment>;
4
+ //# sourceMappingURL=employee-assignment.mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"employee-assignment.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/employee-assignment.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,kBAAkB,CAmBvE,CAAC"}
@@ -3,5 +3,7 @@ export * from './department.mapper';
3
3
  export * from './team.mapper';
4
4
  export * from './team-member.mapper';
5
5
  export * from './quarter.mapper';
6
+ export * from './position.mapper';
7
+ export * from './employee-assignment.mapper';
6
8
  export * from './utils';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ResourceMapper } from '@23blocks/jsonapi-codec';
2
+ import type { Position } from '../types/position';
3
+ export declare const positionMapper: ResourceMapper<Position>;
4
+ //# sourceMappingURL=position.mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/position.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,QAAQ,CAkBnD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Transport, PageResult } from '@23blocks/contracts';
2
+ import type { EmployeeAssignment, CreateEmployeeAssignmentRequest, UpdateEmployeeAssignmentRequest, ListEmployeeAssignmentsParams } from '../types/employee-assignment';
3
+ export interface EmployeeAssignmentsService {
4
+ list(params?: ListEmployeeAssignmentsParams): Promise<PageResult<EmployeeAssignment>>;
5
+ get(uniqueId: string): Promise<EmployeeAssignment>;
6
+ create(data: CreateEmployeeAssignmentRequest): Promise<EmployeeAssignment>;
7
+ update(uniqueId: string, data: UpdateEmployeeAssignmentRequest): Promise<EmployeeAssignment>;
8
+ delete(uniqueId: string): Promise<void>;
9
+ listByUser(userUniqueId: string): Promise<EmployeeAssignment[]>;
10
+ listByPosition(positionUniqueId: string): Promise<EmployeeAssignment[]>;
11
+ }
12
+ export declare function createEmployeeAssignmentsService(transport: Transport, _config: {
13
+ appId: string;
14
+ }): EmployeeAssignmentsService;
15
+ //# sourceMappingURL=employee-assignments.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"employee-assignments.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/employee-assignments.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC9B,MAAM,8BAA8B,CAAC;AAGtC,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,MAAM,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACtF,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnD,MAAM,CAAC,IAAI,EAAE,+BAA+B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC3E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,+BAA+B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7F,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAChE,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CACzE;AAED,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,0BAA0B,CAqE7H"}
@@ -3,4 +3,6 @@ export * from './departments.service';
3
3
  export * from './teams.service';
4
4
  export * from './team-members.service';
5
5
  export * from './quarters.service';
6
+ export * from './positions.service';
7
+ export * from './employee-assignments.service';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Transport, PageResult } from '@23blocks/contracts';
2
+ import type { Position, CreatePositionRequest, UpdatePositionRequest, ListPositionsParams } from '../types/position';
3
+ export interface PositionsService {
4
+ list(params?: ListPositionsParams): Promise<PageResult<Position>>;
5
+ get(uniqueId: string): Promise<Position>;
6
+ create(data: CreatePositionRequest): Promise<Position>;
7
+ update(uniqueId: string, data: UpdatePositionRequest): Promise<Position>;
8
+ delete(uniqueId: string): Promise<void>;
9
+ listByDepartment(departmentUniqueId: string): Promise<Position[]>;
10
+ }
11
+ export declare function createPositionsService(transport: Transport, _config: {
12
+ appId: string;
13
+ }): PositionsService;
14
+ //# sourceMappingURL=positions.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positions.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/positions.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CACnE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CA4DzG"}
@@ -0,0 +1,46 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ export interface EmployeeAssignment extends IdentityCore {
3
+ userUniqueId: string;
4
+ positionUniqueId: string;
5
+ departmentUniqueId?: string;
6
+ teamUniqueId?: string;
7
+ startDate?: Date;
8
+ endDate?: Date;
9
+ isPrimary: boolean;
10
+ status: EntityStatus;
11
+ enabled: boolean;
12
+ payload?: Record<string, unknown>;
13
+ }
14
+ export interface CreateEmployeeAssignmentRequest {
15
+ userUniqueId: string;
16
+ positionUniqueId: string;
17
+ departmentUniqueId?: string;
18
+ teamUniqueId?: string;
19
+ startDate?: string;
20
+ endDate?: string;
21
+ isPrimary?: boolean;
22
+ payload?: Record<string, unknown>;
23
+ }
24
+ export interface UpdateEmployeeAssignmentRequest {
25
+ positionUniqueId?: string;
26
+ departmentUniqueId?: string;
27
+ teamUniqueId?: string;
28
+ startDate?: string;
29
+ endDate?: string;
30
+ isPrimary?: boolean;
31
+ enabled?: boolean;
32
+ status?: EntityStatus;
33
+ payload?: Record<string, unknown>;
34
+ }
35
+ export interface ListEmployeeAssignmentsParams {
36
+ page?: number;
37
+ perPage?: number;
38
+ userUniqueId?: string;
39
+ positionUniqueId?: string;
40
+ departmentUniqueId?: string;
41
+ teamUniqueId?: string;
42
+ status?: EntityStatus;
43
+ sortBy?: string;
44
+ sortOrder?: 'asc' | 'desc';
45
+ }
46
+ //# sourceMappingURL=employee-assignment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"employee-assignment.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/employee-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,+BAA+B;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
@@ -3,4 +3,6 @@ export * from './department';
3
3
  export * from './team';
4
4
  export * from './team-member';
5
5
  export * from './quarter';
6
+ export * from './position';
7
+ export * from './employee-assignment';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ export interface Position extends IdentityCore {
3
+ code: string;
4
+ name: string;
5
+ description?: string;
6
+ departmentUniqueId?: string;
7
+ level?: number;
8
+ reportsToUniqueId?: string;
9
+ status: EntityStatus;
10
+ enabled: boolean;
11
+ payload?: Record<string, unknown>;
12
+ }
13
+ export interface CreatePositionRequest {
14
+ code: string;
15
+ name: string;
16
+ description?: string;
17
+ departmentUniqueId?: string;
18
+ level?: number;
19
+ reportsToUniqueId?: string;
20
+ payload?: Record<string, unknown>;
21
+ }
22
+ export interface UpdatePositionRequest {
23
+ name?: string;
24
+ description?: string;
25
+ departmentUniqueId?: string;
26
+ level?: number;
27
+ reportsToUniqueId?: string;
28
+ enabled?: boolean;
29
+ status?: EntityStatus;
30
+ payload?: Record<string, unknown>;
31
+ }
32
+ export interface ListPositionsParams {
33
+ page?: number;
34
+ perPage?: number;
35
+ departmentUniqueId?: string;
36
+ status?: EntityStatus;
37
+ search?: string;
38
+ sortBy?: string;
39
+ sortOrder?: 'asc' | 'desc';
40
+ }
41
+ //# sourceMappingURL=position.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@23blocks/block-company",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "description": "Company block for 23blocks SDK - organizational structure, departments, teams, and quarters",
5
5
  "license": "MIT",
6
6
  "author": "23blocks <hello@23blocks.com>",