@turndown/library 0.1.16 → 0.1.22

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.
Files changed (60) hide show
  1. package/dist/helpers/date/index.d.ts +113 -0
  2. package/dist/helpers/date/index.js +171 -0
  3. package/dist/helpers/index.d.ts +3 -1
  4. package/dist/helpers/index.js +2 -1
  5. package/dist/helpers/object/index.d.ts +160 -75
  6. package/dist/helpers/object/index.js +355 -168
  7. package/dist/helpers/string/index.d.ts +227 -74
  8. package/dist/helpers/string/index.js +448 -114
  9. package/dist/types/api/index.d.ts +22 -11
  10. package/dist/types/api/index.js +9 -2
  11. package/dist/types/auth/index.d.ts +56 -18
  12. package/dist/types/auth/index.js +7 -0
  13. package/dist/types/auth/routes.d.ts +76 -47
  14. package/dist/types/auth/routes.js +0 -1
  15. package/dist/types/base/index.d.ts +200 -69
  16. package/dist/types/base/index.js +116 -0
  17. package/dist/types/base/paging.types.d.ts +11 -11
  18. package/dist/types/checklist-template/index.d.ts +8 -8
  19. package/dist/types/checklist-template/routes.d.ts +57 -28
  20. package/dist/types/checklist-template/routes.js +0 -1
  21. package/dist/types/company/index.d.ts +5 -5
  22. package/dist/types/company/routes.d.ts +81 -33
  23. package/dist/types/company/routes.js +0 -1
  24. package/dist/types/damage-report/index.d.ts +9 -9
  25. package/dist/types/damage-report/routes.d.ts +128 -51
  26. package/dist/types/damage-report/routes.js +0 -1
  27. package/dist/types/errors/index.d.ts +15 -16
  28. package/dist/types/errors/index.js +17 -7
  29. package/dist/types/health/index.d.ts +20 -0
  30. package/dist/types/health/index.js +1 -0
  31. package/dist/types/health/routes.d.ts +10 -0
  32. package/dist/types/health/routes.js +1 -0
  33. package/dist/types/image/index.d.ts +34 -0
  34. package/dist/types/image/index.js +11 -0
  35. package/dist/types/image/routes.d.ts +32 -0
  36. package/dist/types/image/routes.js +1 -0
  37. package/dist/types/index.d.ts +3 -0
  38. package/dist/types/index.js +3 -0
  39. package/dist/types/inventory/index.d.ts +13 -87
  40. package/dist/types/inventory/routes.d.ts +73 -36
  41. package/dist/types/inventory/routes.js +0 -1
  42. package/dist/types/job/index.d.ts +7 -0
  43. package/dist/types/job/index.js +1 -0
  44. package/dist/types/property/index.d.ts +88 -29
  45. package/dist/types/property/index.js +23 -23
  46. package/dist/types/property/routes.d.ts +40 -14
  47. package/dist/types/property/routes.js +0 -1
  48. package/dist/types/room/index.d.ts +4 -4
  49. package/dist/types/room/routes.d.ts +27 -8
  50. package/dist/types/room/routes.js +0 -1
  51. package/dist/types/room-checklist/index.d.ts +9 -9
  52. package/dist/types/room-checklist/routes.d.ts +50 -28
  53. package/dist/types/room-checklist/routes.js +0 -1
  54. package/dist/types/user/index.d.ts +12 -12
  55. package/dist/types/user/routes.d.ts +26 -16
  56. package/dist/types/user/routes.js +0 -1
  57. package/dist/types/work-session/index.d.ts +12 -12
  58. package/dist/types/work-session/routes.d.ts +55 -34
  59. package/dist/types/work-session/routes.js +0 -1
  60. package/package.json +14 -5
@@ -1,6 +1,6 @@
1
- import { MetaData, ObjectValues } from "../index";
1
+ import { IMetaData, TRecordValue } from "../index";
2
2
  export * from "./routes";
3
- export interface User extends MetaData {
3
+ export interface IUser extends IMetaData {
4
4
  id: string;
5
5
  firstName: string;
6
6
  lastName?: string;
@@ -14,15 +14,15 @@ export interface User extends MetaData {
14
14
  passwordLastReset?: string;
15
15
  passwordResetRequired?: boolean;
16
16
  lastLogin?: string;
17
- accountType: AccountType;
18
- status: AccountStatus;
17
+ accountType: TAccountType;
18
+ status: TAccountStatus;
19
19
  phoneNumber?: string;
20
20
  phoneFormat?: string;
21
- preferredLanguage?: Language;
21
+ preferredLanguage?: TLanguage;
22
22
  companyId?: string;
23
23
  biometrics?: string;
24
24
  }
25
- export interface UserSafe extends Omit<User, "passwordHash" | "loginAttempts" | "biometrics"> {
25
+ export interface IUserSafe extends Omit<IUser, "passwordHash" | "loginAttempts" | "biometrics"> {
26
26
  }
27
27
  export declare const ACCOUNT_TYPE: {
28
28
  readonly TURNDOWN_ADMIN: "TURNDOWN_ADMIN";
@@ -32,29 +32,29 @@ export declare const ACCOUNT_TYPE: {
32
32
  readonly CLEANER: "CLEANER";
33
33
  readonly GUEST: "GUEST";
34
34
  };
35
- export type AccountType = ObjectValues<typeof ACCOUNT_TYPE>;
35
+ export type TAccountType = TRecordValue<typeof ACCOUNT_TYPE>;
36
36
  export declare const ACCOUNT_STATUS: {
37
37
  readonly ACTIVE: "ACTIVE";
38
38
  readonly INACTIVE: "INACTIVE";
39
39
  readonly SUSPENDED: "SUSPENDED";
40
40
  readonly PENDING: "PENDING";
41
41
  };
42
- export type AccountStatus = ObjectValues<typeof ACCOUNT_STATUS>;
42
+ export type TAccountStatus = TRecordValue<typeof ACCOUNT_STATUS>;
43
43
  export declare const LANGUAGE: {
44
44
  readonly ENGLISH: "ENGLISH";
45
45
  readonly FRENCH: "FRENCH";
46
46
  readonly SPANISH: "SPANISH";
47
47
  readonly GERMAN: "GERMAN";
48
48
  };
49
- export type Language = ObjectValues<typeof LANGUAGE>;
50
- export interface DeviceInfo {
49
+ export type TLanguage = TRecordValue<typeof LANGUAGE>;
50
+ export interface IDeviceInfo {
51
51
  userAgent?: string;
52
52
  ip?: string;
53
53
  deviceName?: string;
54
54
  }
55
- export interface UserSession {
55
+ export interface IUserSession {
56
56
  id: number;
57
- deviceInfo?: DeviceInfo | null;
57
+ deviceInfo?: IDeviceInfo | null;
58
58
  createdAt: string;
59
59
  lastUsedAt: string;
60
60
  }
@@ -1,22 +1,29 @@
1
- import { Language, UserSafe } from "..";
2
- export interface GetUserResponse {
3
- user: UserSafe | null;
1
+ import type { TAccountType, TLanguage, IUserSafe } from ".";
2
+ export interface IUserIdParams {
3
+ id: string;
4
4
  }
5
- export interface GetCurrentUserRequest {
5
+ export interface IGetUserResponse {
6
+ user: IUserSafe | null;
6
7
  }
7
- export interface GetCurrentUserResponse extends GetUserResponse {
8
+ export interface IGetCurrentUserRequest {
8
9
  }
9
- export interface GetUserByIdRequest {
10
- userId: string;
10
+ export interface IGetCurrentUserResponse extends IGetUserResponse {
11
11
  }
12
- export interface GetUserByIdResponse extends GetUserResponse {
12
+ export interface IGetUserByIdRequest extends IUserIdParams {
13
13
  }
14
- export interface GetUserByEmailRequest {
14
+ export interface IGetUserByIdResponse extends IGetUserResponse {
15
+ }
16
+ export interface IGetUserByEmailRequest {
15
17
  email: string;
16
18
  }
17
- export interface GetUserByEmailResponse extends GetUserResponse {
19
+ export interface IGetUserByEmailResponse extends IGetUserResponse {
20
+ }
21
+ export interface IGetCleanersRequest {
18
22
  }
19
- export interface UpdateUserRequest {
23
+ export interface IGetCleanersResponse {
24
+ cleaners: IUserSafe[];
25
+ }
26
+ export interface IUpdateUserRequest {
20
27
  firstName?: string;
21
28
  lastName?: string;
22
29
  mi?: string;
@@ -24,13 +31,16 @@ export interface UpdateUserRequest {
24
31
  email?: string;
25
32
  phoneNumber?: string;
26
33
  phoneFormat?: string;
27
- preferredLanguage?: Language;
34
+ preferredLanguage?: TLanguage;
28
35
  }
29
- export interface UpdateUserResponse {
30
- user: UserSafe;
36
+ export interface IUpdateUserResponse {
37
+ user: IUserSafe;
31
38
  }
32
- export interface DeleteUserRequest {
39
+ export interface IDeleteUserRequest {
33
40
  }
34
- export interface DeleteUserResponse {
41
+ export interface IDeleteUserResponse {
35
42
  message: string;
36
43
  }
44
+ export interface IGetUsersByAccountTypeRequest {
45
+ accountType: TAccountType;
46
+ }
@@ -1,2 +1 @@
1
- // user.interfaces.ts
2
1
  export {};
@@ -1,4 +1,4 @@
1
- import { ObjectValues } from "../base";
1
+ import { TRecordValue } from "../base";
2
2
  export * from "./routes";
3
3
  /**
4
4
  * Work session status enum
@@ -8,7 +8,7 @@ export declare const WORK_SESSION_STATUS: {
8
8
  COMPLETED: string;
9
9
  CANCELLED: string;
10
10
  };
11
- export type WorkSessionStatus = ObjectValues<typeof WORK_SESSION_STATUS>;
11
+ export type TWorkSessionStatus = TRecordValue<typeof WORK_SESSION_STATUS>;
12
12
  /**
13
13
  * Checklist execution status enum
14
14
  */
@@ -18,16 +18,16 @@ export declare const CHECKLIST_EXECUTION_STATUS: {
18
18
  COMPLETED: string;
19
19
  SKIPPED: string;
20
20
  };
21
- export type ChecklistExecutionStatus = ObjectValues<typeof CHECKLIST_EXECUTION_STATUS>;
21
+ export type TChecklistExecutionStatus = TRecordValue<typeof CHECKLIST_EXECUTION_STATUS>;
22
22
  /**
23
23
  * Work session
24
24
  */
25
- export interface WorkSession {
25
+ export interface IWorkSession {
26
26
  id: string;
27
27
  propertyId: string;
28
28
  serviceProviderCompanyId: string;
29
29
  performedBy: string;
30
- status: WorkSessionStatus;
30
+ status: TWorkSessionStatus;
31
31
  scheduledDate: Date | null;
32
32
  startedAt: Date;
33
33
  completedAt: Date | null;
@@ -39,13 +39,13 @@ export interface WorkSession {
39
39
  /**
40
40
  * Checklist execution
41
41
  */
42
- export interface ChecklistExecution {
42
+ export interface IChecklistExecution {
43
43
  id: string;
44
44
  workSessionId: string;
45
45
  roomChecklistId: string;
46
46
  roomId: string;
47
47
  workerId: string;
48
- status: ChecklistExecutionStatus;
48
+ status: TChecklistExecutionStatus;
49
49
  startedAt: Date | null;
50
50
  completedAt: Date | null;
51
51
  timeSpentMinutes: number | null;
@@ -56,7 +56,7 @@ export interface ChecklistExecution {
56
56
  /**
57
57
  * Checklist item completion
58
58
  */
59
- export interface ChecklistItemCompletion {
59
+ export interface IChecklistItemCompletion {
60
60
  id: string;
61
61
  checklistExecutionId: string;
62
62
  roomChecklistItemId: string;
@@ -71,13 +71,13 @@ export interface ChecklistItemCompletion {
71
71
  /**
72
72
  * Work session with executions
73
73
  */
74
- export interface WorkSessionWithExecutions extends WorkSession {
75
- executions: ChecklistExecution[];
74
+ export interface IWorkSessionWithExecutions extends IWorkSession {
75
+ executions: IChecklistExecution[];
76
76
  }
77
77
  /**
78
78
  * Input for creating a work session
79
79
  */
80
- export interface CreateWorkSessionInput {
80
+ export interface ICreateWorkSessionInput {
81
81
  propertyId: string;
82
82
  serviceProviderCompanyId: string;
83
83
  performedBy: string;
@@ -87,7 +87,7 @@ export interface CreateWorkSessionInput {
87
87
  /**
88
88
  * Input for completing a checklist item
89
89
  */
90
- export interface CompleteChecklistItemInput {
90
+ export interface ICompleteChecklistItemInput {
91
91
  roomChecklistItemId: string;
92
92
  completedBy: string;
93
93
  photoId?: string;
@@ -1,68 +1,89 @@
1
- export interface CreateWorkSessionRequest {
1
+ import type { IChecklistExecution, IChecklistItemCompletion, ICompleteChecklistItemInput, ICreateWorkSessionInput, IWorkSession, IWorkSessionWithExecutions } from ".";
2
+ export interface IWorkSessionRouteParams {
3
+ sessionId: string;
2
4
  }
3
- export interface CreateWorkSessionResponse {
5
+ export interface IWorkSessionPropertyRouteParams {
6
+ propertyId: string;
4
7
  }
5
- export interface GetWorkSessionByIdRequest {
8
+ export interface IWorkSessionUserRouteParams {
9
+ userId: string;
6
10
  }
7
- export interface GetWorkSessionByIdResponse {
11
+ export interface IWorkSessionExecutionRouteParams {
12
+ executionId: string;
8
13
  }
9
- export interface GetWorkSessionWithExecutionsRequest {
14
+ export interface ILimitQuery {
15
+ limit?: string;
10
16
  }
11
- export interface GetWorkSessionWithExecutionsResponse {
17
+ export interface ICreateWorkSessionRequest extends Omit<ICreateWorkSessionInput, "propertyId"> {
18
+ serviceProviderCompanyId: string;
19
+ performedBy: string;
12
20
  }
13
- export interface UpdateWorkSessionRequest {
21
+ export interface ICreateWorkSessionResponse extends IWorkSession {
14
22
  }
15
- export interface UpdateWorkSessionResponse {
23
+ export interface IGetWorkSessionByIdRequest extends IWorkSessionRouteParams {
16
24
  }
17
- export interface CompleteWorkSessionRequest {
25
+ export interface IGetWorkSessionByIdResponse extends IWorkSession {
18
26
  }
19
- export interface CompleteWorkSessionResponse {
27
+ export interface IGetWorkSessionWithExecutionsRequest extends IWorkSessionRouteParams {
20
28
  }
21
- export interface CancelWorkSessionRequest {
29
+ export interface IGetWorkSessionWithExecutionsResponse extends IWorkSessionWithExecutions {
22
30
  }
23
- export interface CancelWorkSessionResponse {
31
+ export interface IUpdateWorkSessionRequest extends Partial<IWorkSession> {
24
32
  }
25
- export interface GetWorkSessionsByPropertyIdRequest {
33
+ export interface IUpdateWorkSessionResponse extends IWorkSession {
26
34
  }
27
- export interface GetWorkSessionsByPropertyIdResponse {
35
+ export interface ICompleteWorkSessionRequest extends IWorkSessionRouteParams {
28
36
  }
29
- export interface GetActiveWorkSessionRequest {
37
+ export interface ICompleteWorkSessionResponse extends IWorkSession {
30
38
  }
31
- export interface GetActiveWorkSessionResponse {
39
+ export interface ICancelWorkSessionRequest extends IWorkSessionRouteParams {
32
40
  }
33
- export interface GetWorkSessionsByUserIdRequest {
41
+ export interface ICancelWorkSessionResponse extends IWorkSession {
34
42
  }
35
- export interface GetWorkSessionsByUserIdResponse {
43
+ export interface IGetWorkSessionsByPropertyIdRequest extends IWorkSessionPropertyRouteParams {
36
44
  }
37
- export interface GetChecklistExecutionsRequest {
45
+ export type IGetWorkSessionsByPropertyIdResponse = IWorkSession[];
46
+ export interface IGetActiveWorkSessionRequest extends IWorkSessionPropertyRouteParams {
38
47
  }
39
- export interface GetChecklistExecutionsResponse {
48
+ export interface IGetActiveWorkSessionResponse extends IWorkSession {
40
49
  }
41
- export interface GetChecklistExecutionByIdRequest {
50
+ export interface IGetWorkSessionsByUserIdRequest extends IWorkSessionUserRouteParams {
42
51
  }
43
- export interface GetChecklistExecutionByIdResponse {
52
+ export type IGetWorkSessionsByUserIdResponse = IWorkSession[];
53
+ export interface IGetChecklistExecutionsRequest extends IWorkSessionRouteParams {
44
54
  }
45
- export interface StartChecklistExecutionRequest {
55
+ export type IGetChecklistExecutionsResponse = IChecklistExecution[];
56
+ export interface IGetChecklistExecutionByIdRequest extends IWorkSessionExecutionRouteParams {
46
57
  }
47
- export interface StartChecklistExecutionResponse {
58
+ export interface IGetChecklistExecutionByIdResponse extends IChecklistExecution {
48
59
  }
49
- export interface CompleteChecklistExecutionRequest {
60
+ export interface IStartChecklistExecutionRequest extends IWorkSessionExecutionRouteParams {
50
61
  }
51
- export interface CompleteChecklistExecutionResponse {
62
+ export interface IStartChecklistExecutionResponse extends IChecklistExecution {
52
63
  }
53
- export interface SkipChecklistExecutionRequest {
64
+ export interface ICompleteChecklistExecutionRequest {
65
+ notes?: string;
54
66
  }
55
- export interface SkipChecklistExecutionResponse {
67
+ export interface ICompleteChecklistExecutionResponse extends IChecklistExecution {
56
68
  }
57
- export interface GetExecutionProgressRequest {
69
+ export interface ISkipChecklistExecutionRequest {
70
+ notes?: string;
58
71
  }
59
- export interface GetExecutionProgressResponse {
72
+ export interface ISkipChecklistExecutionResponse extends IChecklistExecution {
60
73
  }
61
- export interface GetExecutionItemsRequest {
74
+ export interface IGetExecutionProgressRequest extends IWorkSessionExecutionRouteParams {
62
75
  }
63
- export interface GetExecutionItemsResponse {
76
+ export interface IGetExecutionProgressResponse {
77
+ totalItems: number;
78
+ completedItems: number;
79
+ skippedItems: number;
80
+ progressPercentage: number;
64
81
  }
65
- export interface CompleteExecutionItemRequest {
82
+ export interface IGetExecutionItemsRequest extends IWorkSessionExecutionRouteParams {
66
83
  }
67
- export interface CompleteExecutionItemResponse {
84
+ export type IGetExecutionItemsResponse = IChecklistItemCompletion[];
85
+ export interface ICompleteExecutionItemRequest extends ICompleteChecklistItemInput {
86
+ roomChecklistItemId: string;
87
+ }
88
+ export interface ICompleteExecutionItemResponse extends IChecklistItemCompletion {
68
89
  }
@@ -1,2 +1 @@
1
- // work-session.interfaces.ts
2
1
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turndown/library",
3
- "version": "0.1.16",
3
+ "version": "0.1.22",
4
4
  "description": "Shared TypeScript library for the Turndown suite.",
5
5
  "keywords": [
6
6
  "types",
@@ -19,8 +19,8 @@
19
19
  "exports": {
20
20
  ".": {
21
21
  "types": "./dist/index.d.ts",
22
- "import": "./dist/index.ts",
23
- "default": "./dist/index.ts"
22
+ "import": "./dist/index.js",
23
+ "default": "./dist/index.js"
24
24
  },
25
25
  "./package.json": "./package.json"
26
26
  },
@@ -33,11 +33,20 @@
33
33
  "scripts": {
34
34
  "clean": "rimraf dist",
35
35
  "build": "npm run clean && tsc -p .",
36
- "dev": "tsc -w -p ."
36
+ "dev": "tsc -w -p .",
37
+ "test": "jest",
38
+ "test:watch": "jest --watch",
39
+ "test:coverage": "jest --coverage"
37
40
  },
38
41
  "devDependencies": {
39
- "@types/node": "^24.6.1",
42
+ "@types/jest": "^30.0.0",
43
+ "@types/node": "^24.12.4",
44
+ "jest": "^30.4.2",
40
45
  "rimraf": "^6.0.1",
46
+ "ts-jest": "^29.4.9",
41
47
  "typescript": "^5.9.3"
48
+ },
49
+ "dependencies": {
50
+ "dayjs": "^1.11.20"
42
51
  }
43
52
  }