@23blocks/block-company 3.2.0 → 3.2.2
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 +28 -8
- package/dist/src/index.d.ts +3 -4
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
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) {
|
|
@@ -58,7 +78,7 @@ const companyMapper = {
|
|
|
58
78
|
type: 'Company',
|
|
59
79
|
map: (resource)=>({
|
|
60
80
|
id: resource.id,
|
|
61
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
81
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
62
82
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
63
83
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
64
84
|
code: parseString(resource.attributes['code']) || '',
|
|
@@ -136,7 +156,7 @@ const departmentMapper = {
|
|
|
136
156
|
type: 'Department',
|
|
137
157
|
map: (resource)=>({
|
|
138
158
|
id: resource.id,
|
|
139
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
159
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
140
160
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
141
161
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
142
162
|
companyUniqueId: parseString(resource.attributes['company_unique_id']) || '',
|
|
@@ -217,7 +237,7 @@ const teamMapper = {
|
|
|
217
237
|
type: 'Team',
|
|
218
238
|
map: (resource)=>({
|
|
219
239
|
id: resource.id,
|
|
220
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
240
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
221
241
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
222
242
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
223
243
|
departmentUniqueId: parseString(resource.attributes['department_unique_id']) || '',
|
|
@@ -290,7 +310,7 @@ const teamMemberMapper = {
|
|
|
290
310
|
type: 'TeamMember',
|
|
291
311
|
map: (resource)=>({
|
|
292
312
|
id: resource.id,
|
|
293
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
313
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
294
314
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
295
315
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
296
316
|
teamUniqueId: parseString(resource.attributes['team_unique_id']) || '',
|
|
@@ -358,7 +378,7 @@ const quarterMapper = {
|
|
|
358
378
|
type: 'Quarter',
|
|
359
379
|
map: (resource)=>({
|
|
360
380
|
id: resource.id,
|
|
361
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
381
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
362
382
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
363
383
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
364
384
|
companyUniqueId: parseString(resource.attributes['company_unique_id']) || '',
|
|
@@ -430,7 +450,7 @@ const positionMapper = {
|
|
|
430
450
|
type: 'Position',
|
|
431
451
|
map: (resource)=>({
|
|
432
452
|
id: resource.id,
|
|
433
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
453
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
434
454
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
435
455
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
436
456
|
code: parseString(resource.attributes['code']) || '',
|
|
@@ -509,7 +529,7 @@ const employeeAssignmentMapper = {
|
|
|
509
529
|
var _parseBoolean;
|
|
510
530
|
return {
|
|
511
531
|
id: resource.id,
|
|
512
|
-
uniqueId: parseString(resource.attributes['unique_id'])
|
|
532
|
+
uniqueId: parseString(resource.attributes['unique_id']),
|
|
513
533
|
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
514
534
|
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
515
535
|
userUniqueId: parseString(resource.attributes['user_unique_id']) || '',
|
|
@@ -618,4 +638,4 @@ const companyBlockMetadata = {
|
|
|
618
638
|
]
|
|
619
639
|
};
|
|
620
640
|
|
|
621
|
-
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 };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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
|
|
4
|
-
export
|
|
5
|
-
export
|
|
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
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/package.json
CHANGED