rotacloud 2.2.4 → 2.2.6
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/endpoint.d.ts +5 -1
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/user-v2.interface.d.ts +26 -0
- package/dist/interfaces/user-v2.interface.js +1 -0
- package/dist/main.d.ts +11 -0
- package/dist/service.d.ts +12 -0
- package/dist/service.js +13 -0
- package/package.json +1 -1
- package/src/endpoint.ts +9 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/user-v2.interface.ts +30 -0
- package/src/service.ts +21 -0
package/dist/endpoint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Attendance, Auth, Availability, DailyBudgets, DailyRevenue, DayNote, DaysOff, Group, Leave, Role, Shift, TimeZone, Document, LeaveEmbargo, LeaveRequest, LeaveType, Location, Pin, Terminal, ToilAccrual, ToilAllowance, UserClockedIn, User, Settings, LogbookCategory, DayNoteV2, DayNoteV2QueryParameters } from './interfaces/index.js';
|
|
1
|
+
import { Account, Attendance, Auth, Availability, DailyBudgets, DailyRevenue, DayNote, DaysOff, Group, Leave, Role, Shift, TimeZone, Document, LeaveEmbargo, LeaveRequest, LeaveType, Location, Pin, Terminal, ToilAccrual, ToilAllowance, UserClockedIn, User, Settings, LogbookCategory, DayNoteV2, DayNoteV2QueryParameters, PartialUserV2 } from './interfaces/index.js';
|
|
2
2
|
import { LogbookEntry, LogbookQueryParameters } from './interfaces/logbook.interface.js';
|
|
3
3
|
import { Message } from './interfaces/message.interface.js';
|
|
4
4
|
import { AttendanceQueryParams, AvailabilityQueryParams, DailyBudgetsQueryParams, DailyRevenueQueryParams, DayNotesQueryParams, DaysOffQueryParams, DocumentsQueryParams, GroupsQueryParams, LeaveEmbargoesQueryParams, LeaveQueryParams, LeaveRequestsQueryParams, LocationsQueryParams, RolesQueryParams, SettingsQueryParams, ShiftsQueryParams, TerminalsQueryParams, ToilAccrualsQueryParams, ToilAllowanceQueryParams, UsersQueryParams } from './interfaces/query-params/index.js';
|
|
@@ -59,5 +59,9 @@ export interface EndpointEntityMap extends Record<EndpointVersion, Record<string
|
|
|
59
59
|
invoices: Endpoint<Invoice, InvoiceQueryParameters>;
|
|
60
60
|
dayNotes: Endpoint<DayNoteV2, DayNoteV2QueryParameters, 'title' | 'message' | 'startDate' | 'endDate' | 'locations' | 'visibleToEmployees'>;
|
|
61
61
|
'logbook/categories': Endpoint<LogbookCategory, undefined, Pick<LogbookCategory, 'name'>>;
|
|
62
|
+
users: Endpoint<User, undefined, {
|
|
63
|
+
users: RequirementsOf<PartialUserV2, 'firstName' | 'lastName' | 'roles'>[];
|
|
64
|
+
sendInvite?: boolean;
|
|
65
|
+
}>;
|
|
62
66
|
};
|
|
63
67
|
}
|
|
@@ -34,6 +34,7 @@ export * from './time-zone.interface.js';
|
|
|
34
34
|
export * from './toil-accrual.interface.js';
|
|
35
35
|
export * from './toil-allowance.interface.js';
|
|
36
36
|
export * from './user.interface.js';
|
|
37
|
+
export * from './user-v2.interface.js';
|
|
37
38
|
export * from './users-clocked-in.interface.js';
|
|
38
39
|
export * from './users-clocked-out.interface.js';
|
|
39
40
|
export * from './document.interface.js';
|
package/dist/interfaces/index.js
CHANGED
|
@@ -34,6 +34,7 @@ export * from './time-zone.interface.js';
|
|
|
34
34
|
export * from './toil-accrual.interface.js';
|
|
35
35
|
export * from './toil-allowance.interface.js';
|
|
36
36
|
export * from './user.interface.js';
|
|
37
|
+
export * from './user-v2.interface.js';
|
|
37
38
|
export * from './users-clocked-in.interface.js';
|
|
38
39
|
export * from './users-clocked-out.interface.js';
|
|
39
40
|
export * from './document.interface.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ManagerPermission } from './user.interface.js';
|
|
2
|
+
export interface CreateUserRequest extends PartialUserV2 {
|
|
3
|
+
permissions?: ManagerPermission[];
|
|
4
|
+
coverLocations?: number[];
|
|
5
|
+
managedLocations?: number[];
|
|
6
|
+
}
|
|
7
|
+
export interface CreateUserResponse extends PartialUserV2 {
|
|
8
|
+
id: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PartialUserV2 {
|
|
11
|
+
firstName: string;
|
|
12
|
+
lastName: string;
|
|
13
|
+
locations: number[];
|
|
14
|
+
roles: UserRole[];
|
|
15
|
+
email: string | null;
|
|
16
|
+
level: 'admin' | 'employee' | 'manager';
|
|
17
|
+
salary: number;
|
|
18
|
+
salaryType: 'annual' | 'hourly';
|
|
19
|
+
}
|
|
20
|
+
export interface UserRole {
|
|
21
|
+
id: number;
|
|
22
|
+
perShift?: number;
|
|
23
|
+
perHour?: number;
|
|
24
|
+
payCode?: string;
|
|
25
|
+
isDefault?: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/main.d.ts
CHANGED
|
@@ -239,4 +239,15 @@ export declare const createRotaCloudClient: (config: import("./interfaces/sdk-co
|
|
|
239
239
|
endpointVersion: "v1";
|
|
240
240
|
operations: ("get" | "delete" | "list" | "listAll" | "create" | "update")[];
|
|
241
241
|
};
|
|
242
|
+
userV2: {
|
|
243
|
+
endpoint: "users";
|
|
244
|
+
endpointVersion: "v2";
|
|
245
|
+
operations: "create"[];
|
|
246
|
+
customOperations: {
|
|
247
|
+
create: ({ request, service }: import("./ops.js").OperationContext, userSpec: {
|
|
248
|
+
users: import("./utils.js").RequirementsOf<import("./interfaces/user-v2.interface.js").CreateUserRequest, "firstName" | "lastName" | "roles">[];
|
|
249
|
+
sendInvite?: boolean;
|
|
250
|
+
}) => import("./ops.js").RequestConfig<typeof userSpec, import("./interfaces/user-v2.interface.js").CreateUserResponse>;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
242
253
|
}>;
|
package/dist/service.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ToilAllowanceQueryParams } from './interfaces/query-params/index.js';
|
|
|
10
10
|
import { LogbookEntry, LogbookQueryParameters } from './interfaces/logbook.interface.js';
|
|
11
11
|
import { Message } from './interfaces/message.interface.js';
|
|
12
12
|
import { Invoice, InvoiceDownload } from './interfaces/invoice.interface.js';
|
|
13
|
+
import { CreateUserRequest, CreateUserResponse } from './interfaces/user-v2.interface.js';
|
|
13
14
|
export type ServiceSpecification<CustomOp extends OpDef<unknown> = OpDef<any>> = {
|
|
14
15
|
/** Operations allowed and usable for the endpoint */
|
|
15
16
|
operations: Operation[];
|
|
@@ -282,4 +283,15 @@ export declare const SERVICES: {
|
|
|
282
283
|
endpointVersion: "v1";
|
|
283
284
|
operations: ("get" | "delete" | "list" | "listAll" | "create" | "update")[];
|
|
284
285
|
};
|
|
286
|
+
userV2: {
|
|
287
|
+
endpoint: "users";
|
|
288
|
+
endpointVersion: "v2";
|
|
289
|
+
operations: "create"[];
|
|
290
|
+
customOperations: {
|
|
291
|
+
create: ({ request, service }: OperationContext, userSpec: {
|
|
292
|
+
users: RequirementsOf<CreateUserRequest, "firstName" | "lastName" | "roles">[];
|
|
293
|
+
sendInvite?: boolean;
|
|
294
|
+
}) => RequestConfig<typeof userSpec, CreateUserResponse>;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
285
297
|
};
|
package/dist/service.js
CHANGED
|
@@ -381,4 +381,17 @@ export const SERVICES = {
|
|
|
381
381
|
endpointVersion: 'v1',
|
|
382
382
|
operations: ['create', 'get', 'list', 'listAll', 'update', 'delete'],
|
|
383
383
|
},
|
|
384
|
+
userV2: {
|
|
385
|
+
endpoint: 'users',
|
|
386
|
+
endpointVersion: 'v2',
|
|
387
|
+
operations: ['create'],
|
|
388
|
+
customOperations: {
|
|
389
|
+
create: ({ request, service }, userSpec) => ({
|
|
390
|
+
...request,
|
|
391
|
+
url: `${service.endpointVersion}/${service.endpoint}`,
|
|
392
|
+
method: 'POST',
|
|
393
|
+
data: userSpec,
|
|
394
|
+
}),
|
|
395
|
+
},
|
|
396
|
+
},
|
|
384
397
|
};
|
package/package.json
CHANGED
package/src/endpoint.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
LogbookCategory,
|
|
28
28
|
DayNoteV2,
|
|
29
29
|
DayNoteV2QueryParameters,
|
|
30
|
+
PartialUserV2,
|
|
30
31
|
} from './interfaces/index.js';
|
|
31
32
|
import { LogbookEntry, LogbookQueryParameters } from './interfaces/logbook.interface.js';
|
|
32
33
|
import { Message } from './interfaces/message.interface.js';
|
|
@@ -128,5 +129,13 @@ export interface EndpointEntityMap extends Record<EndpointVersion, Record<string
|
|
|
128
129
|
'title' | 'message' | 'startDate' | 'endDate' | 'locations' | 'visibleToEmployees'
|
|
129
130
|
>;
|
|
130
131
|
'logbook/categories': Endpoint<LogbookCategory, undefined, Pick<LogbookCategory, 'name'>>;
|
|
132
|
+
users: Endpoint<
|
|
133
|
+
User,
|
|
134
|
+
undefined,
|
|
135
|
+
{
|
|
136
|
+
users: RequirementsOf<PartialUserV2, 'firstName' | 'lastName' | 'roles'>[];
|
|
137
|
+
sendInvite?: boolean;
|
|
138
|
+
}
|
|
139
|
+
>;
|
|
131
140
|
};
|
|
132
141
|
}
|
package/src/interfaces/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ export * from './time-zone.interface.js';
|
|
|
34
34
|
export * from './toil-accrual.interface.js';
|
|
35
35
|
export * from './toil-allowance.interface.js';
|
|
36
36
|
export * from './user.interface.js';
|
|
37
|
+
export * from './user-v2.interface.js';
|
|
37
38
|
export * from './users-clocked-in.interface.js';
|
|
38
39
|
export * from './users-clocked-out.interface.js';
|
|
39
40
|
export * from './document.interface.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ManagerPermission } from './user.interface.js';
|
|
2
|
+
|
|
3
|
+
export interface CreateUserRequest extends PartialUserV2 {
|
|
4
|
+
permissions?: ManagerPermission[];
|
|
5
|
+
coverLocations?: number[];
|
|
6
|
+
managedLocations?: number[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CreateUserResponse extends PartialUserV2 {
|
|
10
|
+
id: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface PartialUserV2 {
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
locations: number[];
|
|
17
|
+
roles: UserRole[];
|
|
18
|
+
email: string | null;
|
|
19
|
+
level: 'admin' | 'employee' | 'manager';
|
|
20
|
+
salary: number;
|
|
21
|
+
salaryType: 'annual' | 'hourly';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UserRole {
|
|
25
|
+
id: number;
|
|
26
|
+
perShift?: number;
|
|
27
|
+
perHour?: number;
|
|
28
|
+
payCode?: string;
|
|
29
|
+
isDefault?: boolean;
|
|
30
|
+
}
|
package/src/service.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ShiftHistoryRecord,
|
|
10
10
|
Terminal,
|
|
11
11
|
ToilAllowance,
|
|
12
|
+
User,
|
|
12
13
|
UserBreak,
|
|
13
14
|
UserClockedIn,
|
|
14
15
|
UserClockedOut,
|
|
@@ -34,6 +35,7 @@ import { ToilAllowanceQueryParams } from './interfaces/query-params/index.js';
|
|
|
34
35
|
import { LogbookEntry, LogbookQueryParameters } from './interfaces/logbook.interface.js';
|
|
35
36
|
import { Message } from './interfaces/message.interface.js';
|
|
36
37
|
import { Invoice, InvoiceDownload } from './interfaces/invoice.interface.js';
|
|
38
|
+
import { CreateUserRequest, CreateUserResponse, PartialUserV2 } from './interfaces/user-v2.interface.js';
|
|
37
39
|
|
|
38
40
|
export type ServiceSpecification<CustomOp extends OpDef<unknown> = OpDef<any>> = {
|
|
39
41
|
/** Operations allowed and usable for the endpoint */
|
|
@@ -495,4 +497,23 @@ export const SERVICES = {
|
|
|
495
497
|
endpointVersion: 'v1',
|
|
496
498
|
operations: ['create', 'get', 'list', 'listAll', 'update', 'delete'],
|
|
497
499
|
},
|
|
500
|
+
userV2: {
|
|
501
|
+
endpoint: 'users',
|
|
502
|
+
endpointVersion: 'v2',
|
|
503
|
+
operations: ['create'],
|
|
504
|
+
customOperations: {
|
|
505
|
+
create: (
|
|
506
|
+
{ request, service },
|
|
507
|
+
userSpec: {
|
|
508
|
+
users: RequirementsOf<CreateUserRequest, 'firstName' | 'lastName' | 'roles'>[];
|
|
509
|
+
sendInvite?: boolean;
|
|
510
|
+
},
|
|
511
|
+
): RequestConfig<typeof userSpec, CreateUserResponse> => ({
|
|
512
|
+
...request,
|
|
513
|
+
url: `${service.endpointVersion}/${service.endpoint}`,
|
|
514
|
+
method: 'POST',
|
|
515
|
+
data: userSpec,
|
|
516
|
+
}),
|
|
517
|
+
},
|
|
518
|
+
},
|
|
498
519
|
} satisfies Record<string, ServiceSpecification>;
|