@kernhq/module-hr 0.1.0
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/LICENSE +662 -0
- package/README.md +71 -0
- package/dist/contract/capabilities.d.ts +45 -0
- package/dist/contract/capabilities.d.ts.map +1 -0
- package/dist/contract/capabilities.js +114 -0
- package/dist/contract/capabilities.js.map +1 -0
- package/dist/contract/events.d.ts +74 -0
- package/dist/contract/events.d.ts.map +1 -0
- package/dist/contract/events.js +63 -0
- package/dist/contract/events.js.map +1 -0
- package/dist/contract/index.d.ts +15 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +15 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/models.d.ts +457 -0
- package/dist/contract/models.d.ts.map +1 -0
- package/dist/contract/models.js +381 -0
- package/dist/contract/models.js.map +1 -0
- package/dist/contract/permissions.d.ts +174 -0
- package/dist/contract/permissions.d.ts.map +1 -0
- package/dist/contract/permissions.js +209 -0
- package/dist/contract/permissions.js.map +1 -0
- package/dist/contract/router.d.ts +2720 -0
- package/dist/contract/router.d.ts.map +1 -0
- package/dist/contract/router.js +520 -0
- package/dist/contract/router.js.map +1 -0
- package/dist/contract/settings.d.ts +20 -0
- package/dist/contract/settings.d.ts.map +1 -0
- package/dist/contract/settings.js +34 -0
- package/dist/contract/settings.js.map +1 -0
- package/dist/policy/calendar.d.ts +64 -0
- package/dist/policy/calendar.d.ts.map +1 -0
- package/dist/policy/calendar.js +113 -0
- package/dist/policy/calendar.js.map +1 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +141 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/packs/index.d.ts +50 -0
- package/dist/server/packs/index.d.ts.map +1 -0
- package/dist/server/packs/index.js +121 -0
- package/dist/server/packs/index.js.map +1 -0
- package/dist/server/router.d.ts +3095 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +1537 -0
- package/dist/server/router.js.map +1 -0
- package/dist/server/schema.d.ts +2828 -0
- package/dist/server/schema.d.ts.map +1 -0
- package/dist/server/schema.js +313 -0
- package/dist/server/schema.js.map +1 -0
- package/dist/server/services/db.d.ts +22 -0
- package/dist/server/services/db.d.ts.map +1 -0
- package/dist/server/services/db.js +23 -0
- package/dist/server/services/db.js.map +1 -0
- package/dist/server/services/people.d.ts +110 -0
- package/dist/server/services/people.d.ts.map +1 -0
- package/dist/server/services/people.js +182 -0
- package/dist/server/services/people.js.map +1 -0
- package/dist/server/services/resolve.d.ts +66 -0
- package/dist/server/services/resolve.d.ts.map +1 -0
- package/dist/server/services/resolve.js +145 -0
- package/dist/server/services/resolve.js.map +1 -0
- package/migrations/0000_init.sql +223 -0
- package/migrations/0001_rls.sql +141 -0
- package/migrations/meta/0000_snapshot.json +1715 -0
- package/migrations/meta/_journal.json +20 -0
- package/package.json +59 -0
- package/src/client/index.ts +62 -0
- package/src/contract/capabilities.ts +117 -0
- package/src/contract/events.ts +84 -0
- package/src/contract/index.ts +14 -0
- package/src/contract/models.ts +437 -0
- package/src/contract/permissions.ts +217 -0
- package/src/contract/router.ts +611 -0
- package/src/contract/settings.ts +35 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Lowercase, 2-32 characters. Names the API prefix, the Postgres schema `mod_hr` and every event. */
|
|
3
|
+
export declare const MODULE_ID = "hr";
|
|
4
|
+
/** A calendar date with no time and no zone: `2026-08-24`. */
|
|
5
|
+
export declare const IsoDate: z.ZodISODate;
|
|
6
|
+
export type IsoDate = z.infer<typeof IsoDate>;
|
|
7
|
+
/**
|
|
8
|
+
* An IANA zone name, never an offset.
|
|
9
|
+
*
|
|
10
|
+
* `+03:00` is a fact about one instant; `Europe/Istanbul` is a fact about a place, and only the
|
|
11
|
+
* second survives a daylight-saving transition. Everything in this module that has to turn a wall
|
|
12
|
+
* clock into an instant reads one of these.
|
|
13
|
+
*/
|
|
14
|
+
export declare const TimeZone: z.ZodString;
|
|
15
|
+
/** ISO 3166-1 alpha-2, upper case: `TR`, `NL`, `DE`. */
|
|
16
|
+
export declare const CountryCode: z.ZodString;
|
|
17
|
+
/** ISO 3166-2 subdivision, without the country prefix: `34` for Istanbul, `BY` for Bavaria. */
|
|
18
|
+
export declare const RegionCode: z.ZodString;
|
|
19
|
+
/** `09:00` — a wall clock reading, meaningless until a date and a zone are supplied. */
|
|
20
|
+
export declare const WallClock: z.ZodString;
|
|
21
|
+
export declare const PersonStatus: z.ZodEnum<{
|
|
22
|
+
onboarding: "onboarding";
|
|
23
|
+
active: "active";
|
|
24
|
+
on_leave: "on_leave";
|
|
25
|
+
offboarding: "offboarding";
|
|
26
|
+
terminated: "terminated";
|
|
27
|
+
}>;
|
|
28
|
+
export type PersonStatus = z.infer<typeof PersonStatus>;
|
|
29
|
+
export declare const Person: z.ZodObject<{
|
|
30
|
+
userId: z.ZodNullable<z.ZodUUID>;
|
|
31
|
+
employeeNo: z.ZodNullable<z.ZodString>;
|
|
32
|
+
displayName: z.ZodString;
|
|
33
|
+
workEmail: z.ZodNullable<z.ZodEmail>;
|
|
34
|
+
personalEmail: z.ZodNullable<z.ZodEmail>;
|
|
35
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
36
|
+
photoFileId: z.ZodNullable<z.ZodUUID>;
|
|
37
|
+
status: z.ZodEnum<{
|
|
38
|
+
onboarding: "onboarding";
|
|
39
|
+
active: "active";
|
|
40
|
+
on_leave: "on_leave";
|
|
41
|
+
offboarding: "offboarding";
|
|
42
|
+
terminated: "terminated";
|
|
43
|
+
}>;
|
|
44
|
+
hiredOn: z.ZodNullable<z.ZodISODate>;
|
|
45
|
+
terminatedOn: z.ZodNullable<z.ZodISODate>;
|
|
46
|
+
timezone: z.ZodNullable<z.ZodString>;
|
|
47
|
+
custom: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
48
|
+
createdAt: z.ZodISODateTime;
|
|
49
|
+
updatedAt: z.ZodISODateTime;
|
|
50
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
51
|
+
id: z.ZodUUID;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type Person = z.infer<typeof Person>;
|
|
54
|
+
/**
|
|
55
|
+
* The fields that need a second permission.
|
|
56
|
+
*
|
|
57
|
+
* A separate shape, not optional fields on `Person`, because optional fields get returned by
|
|
58
|
+
* accident. Somebody with `hr.person.view` can read the directory; reading a national identity
|
|
59
|
+
* number takes `hr.person.view_sensitive`, and the two never travel in the same object.
|
|
60
|
+
*/
|
|
61
|
+
export declare const PersonSensitive: z.ZodObject<{
|
|
62
|
+
nationalId: z.ZodNullable<z.ZodString>;
|
|
63
|
+
birthDate: z.ZodNullable<z.ZodISODate>;
|
|
64
|
+
iban: z.ZodNullable<z.ZodString>;
|
|
65
|
+
emergencyContact: z.ZodNullable<z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
relationship: z.ZodOptional<z.ZodString>;
|
|
68
|
+
phone: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
71
|
+
personId: z.ZodUUID;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type PersonSensitive = z.infer<typeof PersonSensitive>;
|
|
74
|
+
export declare const EmploymentType: z.ZodEnum<{
|
|
75
|
+
full_time: "full_time";
|
|
76
|
+
part_time: "part_time";
|
|
77
|
+
contract: "contract";
|
|
78
|
+
intern: "intern";
|
|
79
|
+
temporary: "temporary";
|
|
80
|
+
freelance: "freelance";
|
|
81
|
+
}>;
|
|
82
|
+
export type EmploymentType = z.infer<typeof EmploymentType>;
|
|
83
|
+
/**
|
|
84
|
+
* One row per period a person's job was a given shape. Never updated in place.
|
|
85
|
+
*
|
|
86
|
+
* Titles, managers, departments and hours all change, and a system that overwrites them cannot
|
|
87
|
+
* answer "who did she report to in March", which is the question a leave approval from March needs.
|
|
88
|
+
* A change closes the current row (`effectiveTo`) and opens a new one; `effectiveTo === null` is the
|
|
89
|
+
* present. The database refuses overlaps.
|
|
90
|
+
*
|
|
91
|
+
* **Office is deliberately not here.** People change desks and change jobs on different days, and
|
|
92
|
+
* folding the two together forces a fake promotion every time somebody relocates. See
|
|
93
|
+
* `OfficeAssignment`.
|
|
94
|
+
*/
|
|
95
|
+
export declare const Employment: z.ZodObject<{
|
|
96
|
+
personId: z.ZodUUID;
|
|
97
|
+
effectiveFrom: z.ZodISODate;
|
|
98
|
+
effectiveTo: z.ZodNullable<z.ZodISODate>;
|
|
99
|
+
orgUnitId: z.ZodNullable<z.ZodUUID>;
|
|
100
|
+
positionId: z.ZodNullable<z.ZodUUID>;
|
|
101
|
+
legalEntityId: z.ZodNullable<z.ZodUUID>;
|
|
102
|
+
costCenterId: z.ZodNullable<z.ZodUUID>;
|
|
103
|
+
managerPersonId: z.ZodNullable<z.ZodUUID>;
|
|
104
|
+
employmentType: z.ZodEnum<{
|
|
105
|
+
full_time: "full_time";
|
|
106
|
+
part_time: "part_time";
|
|
107
|
+
contract: "contract";
|
|
108
|
+
intern: "intern";
|
|
109
|
+
temporary: "temporary";
|
|
110
|
+
freelance: "freelance";
|
|
111
|
+
}>;
|
|
112
|
+
fte: z.ZodNumber;
|
|
113
|
+
contractHoursWeek: z.ZodNullable<z.ZodNumber>;
|
|
114
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
115
|
+
createdAt: z.ZodISODateTime;
|
|
116
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
117
|
+
id: z.ZodUUID;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
export type Employment = z.infer<typeof Employment>;
|
|
120
|
+
export declare const OrgUnit: z.ZodObject<{
|
|
121
|
+
parentId: z.ZodNullable<z.ZodUUID>;
|
|
122
|
+
path: z.ZodString;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
code: z.ZodNullable<z.ZodString>;
|
|
125
|
+
headPersonId: z.ZodNullable<z.ZodUUID>;
|
|
126
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
127
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
128
|
+
id: z.ZodUUID;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
export type OrgUnit = z.infer<typeof OrgUnit>;
|
|
131
|
+
export declare const Position: z.ZodObject<{
|
|
132
|
+
title: z.ZodString;
|
|
133
|
+
code: z.ZodNullable<z.ZodString>;
|
|
134
|
+
jobFamily: z.ZodNullable<z.ZodString>;
|
|
135
|
+
level: z.ZodNullable<z.ZodString>;
|
|
136
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
137
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
138
|
+
id: z.ZodUUID;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export type Position = z.infer<typeof Position>;
|
|
141
|
+
export declare const OfficeKind: z.ZodEnum<{
|
|
142
|
+
head_office: "head_office";
|
|
143
|
+
branch: "branch";
|
|
144
|
+
site: "site";
|
|
145
|
+
warehouse: "warehouse";
|
|
146
|
+
store: "store";
|
|
147
|
+
remote: "remote";
|
|
148
|
+
}>;
|
|
149
|
+
export type OfficeKind = z.infer<typeof OfficeKind>;
|
|
150
|
+
/**
|
|
151
|
+
* A place the company operates, and the thing a person inherits from.
|
|
152
|
+
*
|
|
153
|
+
* One workspace, many offices: a head office in Istanbul, a branch in Amsterdam, two sites in the
|
|
154
|
+
* same city, and the remote people. Each carries what differs by geography — country, timezone,
|
|
155
|
+
* working week, holidays — so "which days am I off" has a local answer without a workspace per
|
|
156
|
+
* country.
|
|
157
|
+
*
|
|
158
|
+
* A workspace always has exactly one office even when the `offices` capability is off; it is created
|
|
159
|
+
* from the workspace country and never shown. That is what lets the capability be a *reveal* rather
|
|
160
|
+
* than a migration, and it is why nothing in this module has a "no office" branch.
|
|
161
|
+
*/
|
|
162
|
+
export declare const Office: z.ZodObject<{
|
|
163
|
+
name: z.ZodString;
|
|
164
|
+
code: z.ZodNullable<z.ZodString>;
|
|
165
|
+
kind: z.ZodEnum<{
|
|
166
|
+
head_office: "head_office";
|
|
167
|
+
branch: "branch";
|
|
168
|
+
site: "site";
|
|
169
|
+
warehouse: "warehouse";
|
|
170
|
+
store: "store";
|
|
171
|
+
remote: "remote";
|
|
172
|
+
}>;
|
|
173
|
+
parentOfficeId: z.ZodNullable<z.ZodUUID>;
|
|
174
|
+
legalEntityId: z.ZodNullable<z.ZodUUID>;
|
|
175
|
+
country: z.ZodString;
|
|
176
|
+
region: z.ZodNullable<z.ZodString>;
|
|
177
|
+
city: z.ZodNullable<z.ZodString>;
|
|
178
|
+
timezone: z.ZodString;
|
|
179
|
+
calendarId: z.ZodNullable<z.ZodUUID>;
|
|
180
|
+
address: z.ZodNullable<z.ZodObject<{
|
|
181
|
+
line1: z.ZodOptional<z.ZodString>;
|
|
182
|
+
line2: z.ZodOptional<z.ZodString>;
|
|
183
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>>;
|
|
185
|
+
isDefault: z.ZodBoolean;
|
|
186
|
+
headPersonId: z.ZodNullable<z.ZodUUID>;
|
|
187
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
188
|
+
createdAt: z.ZodISODateTime;
|
|
189
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
190
|
+
id: z.ZodUUID;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type Office = z.infer<typeof Office>;
|
|
193
|
+
/**
|
|
194
|
+
* Who works where, over time.
|
|
195
|
+
*
|
|
196
|
+
* A person may hold several of these at once — somebody splitting the week between two sites — but
|
|
197
|
+
* **exactly one is primary at any date, and only the primary decides.** Non-primary offices grant
|
|
198
|
+
* presence: the person appears in that office's directory, its local HR can see them, and later its
|
|
199
|
+
* geofence will accept their punch. They never decide which holidays apply, which policy applies, or
|
|
200
|
+
* which timezone the person's day is attributed in.
|
|
201
|
+
*
|
|
202
|
+
* Any other rule turns "how many days off do I have" into a question with two answers, which is not
|
|
203
|
+
* a thing an employee or an auditor will accept.
|
|
204
|
+
*/
|
|
205
|
+
export declare const OfficeAssignment: z.ZodObject<{
|
|
206
|
+
personId: z.ZodUUID;
|
|
207
|
+
officeId: z.ZodUUID;
|
|
208
|
+
isPrimary: z.ZodBoolean;
|
|
209
|
+
effectiveFrom: z.ZodISODate;
|
|
210
|
+
effectiveTo: z.ZodNullable<z.ZodISODate>;
|
|
211
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
212
|
+
createdAt: z.ZodISODateTime;
|
|
213
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
214
|
+
id: z.ZodUUID;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
export type OfficeAssignment = z.infer<typeof OfficeAssignment>;
|
|
217
|
+
/**
|
|
218
|
+
* Who actually employs somebody.
|
|
219
|
+
*
|
|
220
|
+
* Distinct from the office: two Turkish offices can share one entity, and one office can host two.
|
|
221
|
+
* It exists because payroll is filed per legal employer, never per workspace — so a group with a
|
|
222
|
+
* Dutch B.V. and a Turkish A.Ş. closes two different payrolls out of one Kern workspace.
|
|
223
|
+
*/
|
|
224
|
+
export declare const LegalEntity: z.ZodObject<{
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
registrationNo: z.ZodNullable<z.ZodString>;
|
|
227
|
+
taxNo: z.ZodNullable<z.ZodString>;
|
|
228
|
+
country: z.ZodString;
|
|
229
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
230
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
231
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
232
|
+
id: z.ZodUUID;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
export type LegalEntity = z.infer<typeof LegalEntity>;
|
|
235
|
+
export declare const CostCenter: z.ZodObject<{
|
|
236
|
+
code: z.ZodString;
|
|
237
|
+
name: z.ZodString;
|
|
238
|
+
officeId: z.ZodNullable<z.ZodUUID>;
|
|
239
|
+
orgUnitId: z.ZodNullable<z.ZodUUID>;
|
|
240
|
+
legalEntityId: z.ZodNullable<z.ZodUUID>;
|
|
241
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
242
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
243
|
+
id: z.ZodUUID;
|
|
244
|
+
}, z.core.$strip>;
|
|
245
|
+
export type CostCenter = z.infer<typeof CostCenter>;
|
|
246
|
+
export declare const FieldType: z.ZodEnum<{
|
|
247
|
+
number: "number";
|
|
248
|
+
boolean: "boolean";
|
|
249
|
+
date: "date";
|
|
250
|
+
text: "text";
|
|
251
|
+
select: "select";
|
|
252
|
+
multi_select: "multi_select";
|
|
253
|
+
url: "url";
|
|
254
|
+
}>;
|
|
255
|
+
export declare const CustomFieldDef: z.ZodObject<{
|
|
256
|
+
key: z.ZodString;
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
type: z.ZodEnum<{
|
|
259
|
+
number: "number";
|
|
260
|
+
boolean: "boolean";
|
|
261
|
+
date: "date";
|
|
262
|
+
text: "text";
|
|
263
|
+
select: "select";
|
|
264
|
+
multi_select: "multi_select";
|
|
265
|
+
url: "url";
|
|
266
|
+
}>;
|
|
267
|
+
options: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
268
|
+
value: z.ZodString;
|
|
269
|
+
label: z.ZodString;
|
|
270
|
+
}, z.core.$strip>>>;
|
|
271
|
+
required: z.ZodBoolean;
|
|
272
|
+
sensitive: z.ZodBoolean;
|
|
273
|
+
section: z.ZodEnum<{
|
|
274
|
+
profile: "profile";
|
|
275
|
+
employment: "employment";
|
|
276
|
+
other: "other";
|
|
277
|
+
}>;
|
|
278
|
+
order: z.ZodNumber;
|
|
279
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
280
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
281
|
+
id: z.ZodUUID;
|
|
282
|
+
}, z.core.$strip>;
|
|
283
|
+
export type CustomFieldDef = z.infer<typeof CustomFieldDef>;
|
|
284
|
+
export declare const PersonDocument: z.ZodObject<{
|
|
285
|
+
personId: z.ZodUUID;
|
|
286
|
+
fileId: z.ZodUUID;
|
|
287
|
+
name: z.ZodString;
|
|
288
|
+
kind: z.ZodString;
|
|
289
|
+
issuedOn: z.ZodNullable<z.ZodISODate>;
|
|
290
|
+
expiresOn: z.ZodNullable<z.ZodISODate>;
|
|
291
|
+
uploadedBy: z.ZodNullable<z.ZodUUID>;
|
|
292
|
+
createdAt: z.ZodISODateTime;
|
|
293
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
294
|
+
id: z.ZodUUID;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
export type PersonDocument = z.infer<typeof PersonDocument>;
|
|
297
|
+
export declare const CalendarDayKind: z.ZodEnum<{
|
|
298
|
+
public_holiday: "public_holiday";
|
|
299
|
+
religious: "religious";
|
|
300
|
+
company_closure: "company_closure";
|
|
301
|
+
half_day: "half_day";
|
|
302
|
+
working_override: "working_override";
|
|
303
|
+
bridge: "bridge";
|
|
304
|
+
}>;
|
|
305
|
+
export type CalendarDayKind = z.infer<typeof CalendarDayKind>;
|
|
306
|
+
/** Which weekdays are worked, and how much of each. Iran is `{fri: 0}` with a half Thursday. */
|
|
307
|
+
export declare const WorkingWeek: z.ZodObject<{
|
|
308
|
+
mon: z.ZodDefault<z.ZodNumber>;
|
|
309
|
+
tue: z.ZodDefault<z.ZodNumber>;
|
|
310
|
+
wed: z.ZodDefault<z.ZodNumber>;
|
|
311
|
+
thu: z.ZodDefault<z.ZodNumber>;
|
|
312
|
+
fri: z.ZodDefault<z.ZodNumber>;
|
|
313
|
+
sat: z.ZodDefault<z.ZodNumber>;
|
|
314
|
+
sun: z.ZodDefault<z.ZodNumber>;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
export type WorkingWeek = z.infer<typeof WorkingWeek>;
|
|
317
|
+
/**
|
|
318
|
+
* A set of non-working days, composed rather than copied.
|
|
319
|
+
*
|
|
320
|
+
* `extendsId` points at a country pack, and this calendar's own days sit on top: *"Amsterdam = the
|
|
321
|
+
* NL pack, plus our two company closures, minus the one we work through"*. Copying the pack into
|
|
322
|
+
* every office instead would mean a yearly pack refresh reconciling N copies against N sets of local
|
|
323
|
+
* edits, which is exactly the problem per-day `source` exists to avoid.
|
|
324
|
+
*/
|
|
325
|
+
export declare const Calendar: z.ZodObject<{
|
|
326
|
+
name: z.ZodString;
|
|
327
|
+
extendsId: z.ZodNullable<z.ZodUUID>;
|
|
328
|
+
country: z.ZodNullable<z.ZodString>;
|
|
329
|
+
region: z.ZodNullable<z.ZodString>;
|
|
330
|
+
workingWeek: z.ZodObject<{
|
|
331
|
+
mon: z.ZodDefault<z.ZodNumber>;
|
|
332
|
+
tue: z.ZodDefault<z.ZodNumber>;
|
|
333
|
+
wed: z.ZodDefault<z.ZodNumber>;
|
|
334
|
+
thu: z.ZodDefault<z.ZodNumber>;
|
|
335
|
+
fri: z.ZodDefault<z.ZodNumber>;
|
|
336
|
+
sat: z.ZodDefault<z.ZodNumber>;
|
|
337
|
+
sun: z.ZodDefault<z.ZodNumber>;
|
|
338
|
+
}, z.core.$strip>;
|
|
339
|
+
source: z.ZodEnum<{
|
|
340
|
+
custom: "custom";
|
|
341
|
+
pack: "pack";
|
|
342
|
+
}>;
|
|
343
|
+
packKey: z.ZodNullable<z.ZodString>;
|
|
344
|
+
packVersion: z.ZodNullable<z.ZodString>;
|
|
345
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
346
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
347
|
+
id: z.ZodUUID;
|
|
348
|
+
}, z.core.$strip>;
|
|
349
|
+
export type Calendar = z.infer<typeof Calendar>;
|
|
350
|
+
export declare const CalendarDay: z.ZodObject<{
|
|
351
|
+
calendarId: z.ZodUUID;
|
|
352
|
+
date: z.ZodISODate;
|
|
353
|
+
kind: z.ZodEnum<{
|
|
354
|
+
public_holiday: "public_holiday";
|
|
355
|
+
religious: "religious";
|
|
356
|
+
company_closure: "company_closure";
|
|
357
|
+
half_day: "half_day";
|
|
358
|
+
working_override: "working_override";
|
|
359
|
+
bridge: "bridge";
|
|
360
|
+
}>;
|
|
361
|
+
name: z.ZodString;
|
|
362
|
+
workingFraction: z.ZodNumber;
|
|
363
|
+
source: z.ZodEnum<{
|
|
364
|
+
custom: "custom";
|
|
365
|
+
pack: "pack";
|
|
366
|
+
}>;
|
|
367
|
+
paid: z.ZodBoolean;
|
|
368
|
+
note: z.ZodNullable<z.ZodString>;
|
|
369
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
370
|
+
id: z.ZodUUID;
|
|
371
|
+
}, z.core.$strip>;
|
|
372
|
+
export type CalendarDay = z.infer<typeof CalendarDay>;
|
|
373
|
+
/** A day as the composed calendar sees it, with where it came from. */
|
|
374
|
+
export declare const ResolvedCalendarDay: z.ZodObject<{
|
|
375
|
+
calendarId: z.ZodUUID;
|
|
376
|
+
date: z.ZodISODate;
|
|
377
|
+
kind: z.ZodEnum<{
|
|
378
|
+
public_holiday: "public_holiday";
|
|
379
|
+
religious: "religious";
|
|
380
|
+
company_closure: "company_closure";
|
|
381
|
+
half_day: "half_day";
|
|
382
|
+
working_override: "working_override";
|
|
383
|
+
bridge: "bridge";
|
|
384
|
+
}>;
|
|
385
|
+
name: z.ZodString;
|
|
386
|
+
workingFraction: z.ZodNumber;
|
|
387
|
+
source: z.ZodEnum<{
|
|
388
|
+
custom: "custom";
|
|
389
|
+
pack: "pack";
|
|
390
|
+
}>;
|
|
391
|
+
paid: z.ZodBoolean;
|
|
392
|
+
note: z.ZodNullable<z.ZodString>;
|
|
393
|
+
workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
|
|
394
|
+
id: z.ZodUUID;
|
|
395
|
+
fromCalendarId: z.ZodUUID;
|
|
396
|
+
fromCalendarName: z.ZodString;
|
|
397
|
+
overrides: z.ZodBoolean;
|
|
398
|
+
}, z.core.$strip>;
|
|
399
|
+
export type ResolvedCalendarDay = z.infer<typeof ResolvedCalendarDay>;
|
|
400
|
+
export declare const ResolutionRung: z.ZodEnum<{
|
|
401
|
+
person: "person";
|
|
402
|
+
office: "office";
|
|
403
|
+
legal_entity: "legal_entity";
|
|
404
|
+
org_unit: "org_unit";
|
|
405
|
+
position: "position";
|
|
406
|
+
workspace: "workspace";
|
|
407
|
+
}>;
|
|
408
|
+
export type ResolutionRung = z.infer<typeof ResolutionRung>;
|
|
409
|
+
/**
|
|
410
|
+
* What actually applies to one person on one date, and which rung answered.
|
|
411
|
+
*
|
|
412
|
+
* The ladder is `person → primary office → org unit → workspace`, nearest wins, and it decides both
|
|
413
|
+
* the calendar and every policy. Exposing *which rung answered* is not a nicety: "why does Ayşe have
|
|
414
|
+
* different holidays from her team" is the support question this module will be asked most, and
|
|
415
|
+
* without this it is answered with a database session.
|
|
416
|
+
*/
|
|
417
|
+
export declare const PersonResolution: z.ZodObject<{
|
|
418
|
+
personId: z.ZodUUID;
|
|
419
|
+
on: z.ZodISODate;
|
|
420
|
+
primaryOfficeId: z.ZodNullable<z.ZodUUID>;
|
|
421
|
+
primaryOfficeName: z.ZodNullable<z.ZodString>;
|
|
422
|
+
otherOfficeIds: z.ZodArray<z.ZodUUID>;
|
|
423
|
+
country: z.ZodNullable<z.ZodString>;
|
|
424
|
+
timezone: z.ZodString;
|
|
425
|
+
timezoneFrom: z.ZodEnum<{
|
|
426
|
+
person: "person";
|
|
427
|
+
office: "office";
|
|
428
|
+
legal_entity: "legal_entity";
|
|
429
|
+
org_unit: "org_unit";
|
|
430
|
+
position: "position";
|
|
431
|
+
workspace: "workspace";
|
|
432
|
+
}>;
|
|
433
|
+
calendarId: z.ZodNullable<z.ZodUUID>;
|
|
434
|
+
calendarFrom: z.ZodNullable<z.ZodEnum<{
|
|
435
|
+
person: "person";
|
|
436
|
+
office: "office";
|
|
437
|
+
legal_entity: "legal_entity";
|
|
438
|
+
org_unit: "org_unit";
|
|
439
|
+
position: "position";
|
|
440
|
+
workspace: "workspace";
|
|
441
|
+
}>>;
|
|
442
|
+
workingWeek: z.ZodObject<{
|
|
443
|
+
mon: z.ZodDefault<z.ZodNumber>;
|
|
444
|
+
tue: z.ZodDefault<z.ZodNumber>;
|
|
445
|
+
wed: z.ZodDefault<z.ZodNumber>;
|
|
446
|
+
thu: z.ZodDefault<z.ZodNumber>;
|
|
447
|
+
fri: z.ZodDefault<z.ZodNumber>;
|
|
448
|
+
sat: z.ZodDefault<z.ZodNumber>;
|
|
449
|
+
sun: z.ZodDefault<z.ZodNumber>;
|
|
450
|
+
}, z.core.$strip>;
|
|
451
|
+
legalEntityId: z.ZodNullable<z.ZodUUID>;
|
|
452
|
+
orgUnitId: z.ZodNullable<z.ZodUUID>;
|
|
453
|
+
orgUnitPath: z.ZodNullable<z.ZodString>;
|
|
454
|
+
managerPersonId: z.ZodNullable<z.ZodUUID>;
|
|
455
|
+
}, z.core.$strip>;
|
|
456
|
+
export type PersonResolution = z.infer<typeof PersonResolution>;
|
|
457
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/contract/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,sGAAsG;AACtG,eAAO,MAAM,SAAS,OAAO,CAAA;AAE7B,8DAA8D;AAC9D,eAAO,MAAM,OAAO,cAAe,CAAA;AACnC,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAA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