@turndown/library 0.1.22 → 0.1.24
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/helpers/object/index.js +9 -6
- package/dist/helpers/string/index.d.ts +5 -4
- package/dist/helpers/string/index.js +7 -6
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/index.js +1 -0
- package/dist/types/base/index.d.ts +60 -69
- package/dist/types/base/index.js +60 -67
- package/dist/types/company/index.d.ts +5 -5
- package/dist/types/company/routes.d.ts +4 -4
- package/dist/types/damage-report/index.d.ts +122 -15
- package/dist/types/damage-report/index.js +28 -0
- package/dist/types/damage-report/routes.d.ts +8 -49
- package/dist/types/image/index.d.ts +1 -0
- package/dist/types/image/index.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/property/index.d.ts +10 -9
- package/dist/types/subscription/index.d.ts +32 -0
- package/dist/types/subscription/index.js +16 -0
- package/dist/types/user/index.d.ts +2 -3
- package/dist/types/user/index.js +2 -3
- package/package.json +2 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const unsafePathSegments = new Set(["__proto__", "prototype", "constructor"]);
|
|
2
2
|
const isRecord = (value) => {
|
|
3
|
-
return typeof value === "object" &&
|
|
3
|
+
return (typeof value === "object" &&
|
|
4
|
+
value !== null &&
|
|
5
|
+
!Array.isArray(value) &&
|
|
6
|
+
!(value instanceof Date));
|
|
4
7
|
};
|
|
5
8
|
const isSafePathSegment = (segment) => {
|
|
6
9
|
return segment.length > 0 && !unsafePathSegments.has(segment);
|
|
@@ -272,9 +275,7 @@ export const resetPagination = (sort, filters) => {
|
|
|
272
275
|
export const formatPhoneNumber = (value) => {
|
|
273
276
|
const originalValue = value.toString();
|
|
274
277
|
const digits = originalValue.replace(/\D/g, "");
|
|
275
|
-
const normalizedDigits = digits.length === 11 && digits.startsWith("1")
|
|
276
|
-
? digits.slice(1)
|
|
277
|
-
: digits;
|
|
278
|
+
const normalizedDigits = digits.length === 11 && digits.startsWith("1") ? digits.slice(1) : digits;
|
|
278
279
|
if (normalizedDigits.length !== 10)
|
|
279
280
|
return originalValue;
|
|
280
281
|
const area = normalizedDigits.slice(0, 3);
|
|
@@ -422,7 +423,8 @@ export const getNestedValue = (value, path) => {
|
|
|
422
423
|
if (currentValue === null || currentValue === undefined) {
|
|
423
424
|
return undefined;
|
|
424
425
|
}
|
|
425
|
-
if (typeof currentValue !== "object" &&
|
|
426
|
+
if (typeof currentValue !== "object" &&
|
|
427
|
+
typeof currentValue !== "function") {
|
|
426
428
|
return undefined;
|
|
427
429
|
}
|
|
428
430
|
currentValue = currentValue[pathSegment];
|
|
@@ -445,7 +447,8 @@ export const getNestedValue = (value, path) => {
|
|
|
445
447
|
*/
|
|
446
448
|
export const setNestedValue = (objectToUpdate, path, value) => {
|
|
447
449
|
const pathSegments = getPathSegments(path);
|
|
448
|
-
if (pathSegments.length === 0 ||
|
|
450
|
+
if (pathSegments.length === 0 ||
|
|
451
|
+
pathSegments.some((pathSegment) => !isSafePathSegment(pathSegment))) {
|
|
449
452
|
return objectToUpdate;
|
|
450
453
|
}
|
|
451
454
|
let currentValue = objectToUpdate;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* String utilities for common text manipulation tasks.
|
|
3
3
|
*/
|
|
4
|
+
import { TUSStateCode } from "@/types";
|
|
4
5
|
/**
|
|
5
6
|
* Adds commas to a number for thousands separators.
|
|
6
7
|
*
|
|
@@ -248,10 +249,10 @@ export declare const containsAny: (str: string, ...substrings: string[]) => bool
|
|
|
248
249
|
*/
|
|
249
250
|
export declare const containsAll: (str: string, ...substrings: string[]) => boolean;
|
|
250
251
|
export interface IAddress {
|
|
251
|
-
addressLine1
|
|
252
|
+
addressLine1: string;
|
|
252
253
|
addressLine2?: string;
|
|
253
|
-
city
|
|
254
|
-
stateCode
|
|
255
|
-
postalCode
|
|
254
|
+
city: string;
|
|
255
|
+
stateCode: TUSStateCode;
|
|
256
|
+
postalCode: string;
|
|
256
257
|
}
|
|
257
258
|
export declare const formatAddress: (address: IAddress) => string;
|
|
@@ -65,10 +65,7 @@ export const toCamelCase = (str) => {
|
|
|
65
65
|
return "";
|
|
66
66
|
}
|
|
67
67
|
const [firstWord, ...remainingWords] = words;
|
|
68
|
-
return [
|
|
69
|
-
firstWord.toLowerCase(),
|
|
70
|
-
...remainingWords.map(capitalizeWord),
|
|
71
|
-
].join("");
|
|
68
|
+
return [firstWord.toLowerCase(), ...remainingWords.map(capitalizeWord)].join("");
|
|
72
69
|
};
|
|
73
70
|
export const camelCase = toCamelCase;
|
|
74
71
|
/**
|
|
@@ -78,7 +75,9 @@ export const camelCase = toCamelCase;
|
|
|
78
75
|
* @example toKebabCase('Hello_World') => 'hello-world'
|
|
79
76
|
*/
|
|
80
77
|
export const toKebabCase = (str) => {
|
|
81
|
-
return getWords(str)
|
|
78
|
+
return getWords(str)
|
|
79
|
+
.map((word) => word.toLowerCase())
|
|
80
|
+
.join("-");
|
|
82
81
|
};
|
|
83
82
|
export const kebabCase = toKebabCase;
|
|
84
83
|
/**
|
|
@@ -88,7 +87,9 @@ export const kebabCase = toKebabCase;
|
|
|
88
87
|
* @example toSnakeCase('hello-world') => 'hello_world'
|
|
89
88
|
*/
|
|
90
89
|
export const toSnakeCase = (str) => {
|
|
91
|
-
return getWords(str)
|
|
90
|
+
return getWords(str)
|
|
91
|
+
.map((word) => word.toLowerCase())
|
|
92
|
+
.join("_");
|
|
92
93
|
};
|
|
93
94
|
export const snakeCase = toSnakeCase;
|
|
94
95
|
/**
|
|
@@ -46,6 +46,7 @@ export declare const ERROR_CODES: {
|
|
|
46
46
|
readonly NOT_FOUND: "NOT_FOUND";
|
|
47
47
|
readonly CONFLICT: "CONFLICT";
|
|
48
48
|
readonly ALREADY_EXISTS: "ALREADY_EXISTS";
|
|
49
|
+
readonly RATE_LIMIT: "RATE_LIMIT";
|
|
49
50
|
readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
|
|
50
51
|
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
51
52
|
readonly DATABASE_ERROR: "DATABASE_ERROR";
|
package/dist/types/api/index.js
CHANGED
|
@@ -102,76 +102,67 @@ export declare const US_STATES_CODE: {
|
|
|
102
102
|
readonly AS: "AS";
|
|
103
103
|
readonly MP: "MP";
|
|
104
104
|
};
|
|
105
|
-
export type
|
|
106
|
-
export declare const
|
|
107
|
-
readonly
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
readonly
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
118
|
-
readonly
|
|
119
|
-
readonly
|
|
120
|
-
readonly
|
|
121
|
-
readonly
|
|
122
|
-
readonly
|
|
123
|
-
readonly
|
|
124
|
-
readonly
|
|
125
|
-
readonly
|
|
126
|
-
readonly
|
|
127
|
-
readonly
|
|
128
|
-
readonly
|
|
129
|
-
readonly
|
|
130
|
-
readonly
|
|
131
|
-
readonly
|
|
132
|
-
readonly
|
|
133
|
-
readonly
|
|
134
|
-
readonly
|
|
135
|
-
readonly
|
|
136
|
-
readonly
|
|
137
|
-
readonly
|
|
138
|
-
readonly
|
|
139
|
-
readonly
|
|
140
|
-
readonly
|
|
141
|
-
readonly
|
|
142
|
-
readonly
|
|
143
|
-
readonly
|
|
144
|
-
readonly
|
|
145
|
-
readonly
|
|
146
|
-
readonly
|
|
147
|
-
readonly
|
|
148
|
-
readonly
|
|
149
|
-
readonly
|
|
150
|
-
readonly
|
|
151
|
-
readonly
|
|
152
|
-
readonly
|
|
153
|
-
readonly
|
|
154
|
-
readonly
|
|
155
|
-
readonly
|
|
156
|
-
readonly
|
|
157
|
-
readonly
|
|
158
|
-
readonly
|
|
159
|
-
readonly
|
|
160
|
-
readonly
|
|
161
|
-
readonly
|
|
162
|
-
readonly
|
|
163
|
-
readonly UnitedStatesVirginIslands: "United States Virgin Islands";
|
|
164
|
-
readonly Utah: "Utah";
|
|
165
|
-
readonly Vermont: "Vermont";
|
|
166
|
-
readonly Virginia: "Virginia";
|
|
167
|
-
readonly WakeIsland: "Wake Island";
|
|
168
|
-
readonly Washington: "Washington";
|
|
169
|
-
readonly WestVirginia: "West Virginia";
|
|
170
|
-
readonly Wisconsin: "Wisconsin";
|
|
171
|
-
readonly Wyoming: "Wyoming";
|
|
105
|
+
export type TUSStateCode = TRecordValue<typeof US_STATES_CODE>;
|
|
106
|
+
export declare const US_JURISDICTIONS: {
|
|
107
|
+
readonly AL: "Alabama";
|
|
108
|
+
readonly AK: "Alaska";
|
|
109
|
+
readonly AZ: "Arizona";
|
|
110
|
+
readonly AR: "Arkansas";
|
|
111
|
+
readonly CA: "California";
|
|
112
|
+
readonly CO: "Colorado";
|
|
113
|
+
readonly CT: "Connecticut";
|
|
114
|
+
readonly DE: "Delaware";
|
|
115
|
+
readonly FL: "Florida";
|
|
116
|
+
readonly GA: "Georgia";
|
|
117
|
+
readonly HI: "Hawaii";
|
|
118
|
+
readonly ID: "Idaho";
|
|
119
|
+
readonly IL: "Illinois";
|
|
120
|
+
readonly IN: "Indiana";
|
|
121
|
+
readonly IA: "Iowa";
|
|
122
|
+
readonly KS: "Kansas";
|
|
123
|
+
readonly KY: "Kentucky";
|
|
124
|
+
readonly LA: "Louisiana";
|
|
125
|
+
readonly ME: "Maine";
|
|
126
|
+
readonly MD: "Maryland";
|
|
127
|
+
readonly MA: "Massachusetts";
|
|
128
|
+
readonly MI: "Michigan";
|
|
129
|
+
readonly MN: "Minnesota";
|
|
130
|
+
readonly MS: "Mississippi";
|
|
131
|
+
readonly MO: "Missouri";
|
|
132
|
+
readonly MT: "Montana";
|
|
133
|
+
readonly NE: "Nebraska";
|
|
134
|
+
readonly NV: "Nevada";
|
|
135
|
+
readonly NH: "New Hampshire";
|
|
136
|
+
readonly NJ: "New Jersey";
|
|
137
|
+
readonly NM: "New Mexico";
|
|
138
|
+
readonly NY: "New York";
|
|
139
|
+
readonly NC: "North Carolina";
|
|
140
|
+
readonly ND: "North Dakota";
|
|
141
|
+
readonly OH: "Ohio";
|
|
142
|
+
readonly OK: "Oklahoma";
|
|
143
|
+
readonly OR: "Oregon";
|
|
144
|
+
readonly PA: "Pennsylvania";
|
|
145
|
+
readonly RI: "Rhode Island";
|
|
146
|
+
readonly SC: "South Carolina";
|
|
147
|
+
readonly SD: "South Dakota";
|
|
148
|
+
readonly TN: "Tennessee";
|
|
149
|
+
readonly TX: "Texas";
|
|
150
|
+
readonly UT: "Utah";
|
|
151
|
+
readonly VT: "Vermont";
|
|
152
|
+
readonly VA: "Virginia";
|
|
153
|
+
readonly WA: "Washington";
|
|
154
|
+
readonly WV: "West Virginia";
|
|
155
|
+
readonly WI: "Wisconsin";
|
|
156
|
+
readonly WY: "Wyoming";
|
|
157
|
+
readonly DC: "District of Columbia";
|
|
158
|
+
readonly PR: "Puerto Rico";
|
|
159
|
+
readonly GU: "Guam";
|
|
160
|
+
readonly VI: "United States Virgin Islands";
|
|
161
|
+
readonly AS: "American Samoa";
|
|
162
|
+
readonly MP: "Northern Mariana Islands";
|
|
172
163
|
};
|
|
173
|
-
export type
|
|
174
|
-
export declare const UnitedStatesJurisdictionOptions: ISelectOption<
|
|
164
|
+
export type TUSJurisdiction = TRecordValue<typeof US_JURISDICTIONS>;
|
|
165
|
+
export declare const UnitedStatesJurisdictionOptions: ISelectOption<TUSJurisdiction>[];
|
|
175
166
|
export declare const STATUS: {
|
|
176
167
|
readonly Pending: "Pending";
|
|
177
168
|
readonly InProgress: "InProgress";
|
package/dist/types/base/index.js
CHANGED
|
@@ -65,74 +65,67 @@ export const US_STATES_CODE = {
|
|
|
65
65
|
AS: "AS",
|
|
66
66
|
MP: "MP",
|
|
67
67
|
};
|
|
68
|
-
export const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Vermont: "Vermont",
|
|
128
|
-
Virginia: "Virginia",
|
|
129
|
-
WakeIsland: "Wake Island",
|
|
130
|
-
Washington: "Washington",
|
|
131
|
-
WestVirginia: "West Virginia",
|
|
132
|
-
Wisconsin: "Wisconsin",
|
|
133
|
-
Wyoming: "Wyoming",
|
|
68
|
+
export const US_JURISDICTIONS = {
|
|
69
|
+
// 50 States
|
|
70
|
+
AL: "Alabama",
|
|
71
|
+
AK: "Alaska",
|
|
72
|
+
AZ: "Arizona",
|
|
73
|
+
AR: "Arkansas",
|
|
74
|
+
CA: "California",
|
|
75
|
+
CO: "Colorado",
|
|
76
|
+
CT: "Connecticut",
|
|
77
|
+
DE: "Delaware",
|
|
78
|
+
FL: "Florida",
|
|
79
|
+
GA: "Georgia",
|
|
80
|
+
HI: "Hawaii",
|
|
81
|
+
ID: "Idaho",
|
|
82
|
+
IL: "Illinois",
|
|
83
|
+
IN: "Indiana",
|
|
84
|
+
IA: "Iowa",
|
|
85
|
+
KS: "Kansas",
|
|
86
|
+
KY: "Kentucky",
|
|
87
|
+
LA: "Louisiana",
|
|
88
|
+
ME: "Maine",
|
|
89
|
+
MD: "Maryland",
|
|
90
|
+
MA: "Massachusetts",
|
|
91
|
+
MI: "Michigan",
|
|
92
|
+
MN: "Minnesota",
|
|
93
|
+
MS: "Mississippi",
|
|
94
|
+
MO: "Missouri",
|
|
95
|
+
MT: "Montana",
|
|
96
|
+
NE: "Nebraska",
|
|
97
|
+
NV: "Nevada",
|
|
98
|
+
NH: "New Hampshire",
|
|
99
|
+
NJ: "New Jersey",
|
|
100
|
+
NM: "New Mexico",
|
|
101
|
+
NY: "New York",
|
|
102
|
+
NC: "North Carolina",
|
|
103
|
+
ND: "North Dakota",
|
|
104
|
+
OH: "Ohio",
|
|
105
|
+
OK: "Oklahoma",
|
|
106
|
+
OR: "Oregon",
|
|
107
|
+
PA: "Pennsylvania",
|
|
108
|
+
RI: "Rhode Island",
|
|
109
|
+
SC: "South Carolina",
|
|
110
|
+
SD: "South Dakota",
|
|
111
|
+
TN: "Tennessee",
|
|
112
|
+
TX: "Texas",
|
|
113
|
+
UT: "Utah",
|
|
114
|
+
VT: "Vermont",
|
|
115
|
+
VA: "Virginia",
|
|
116
|
+
WA: "Washington",
|
|
117
|
+
WV: "West Virginia",
|
|
118
|
+
WI: "Wisconsin",
|
|
119
|
+
WY: "Wyoming",
|
|
120
|
+
// Territories
|
|
121
|
+
DC: "District of Columbia",
|
|
122
|
+
PR: "Puerto Rico",
|
|
123
|
+
GU: "Guam",
|
|
124
|
+
VI: "United States Virgin Islands",
|
|
125
|
+
AS: "American Samoa",
|
|
126
|
+
MP: "Northern Mariana Islands",
|
|
134
127
|
};
|
|
135
|
-
export const UnitedStatesJurisdictionOptions = Object.values(
|
|
128
|
+
export const UnitedStatesJurisdictionOptions = Object.values(US_JURISDICTIONS).map((jurisdiction) => ({
|
|
136
129
|
label: jurisdiction,
|
|
137
130
|
value: jurisdiction,
|
|
138
131
|
}));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IMetaData, TRecordValue,
|
|
1
|
+
import { IMetaData, TRecordValue, TUSStateCode } from "../index";
|
|
2
2
|
export * from "./routes";
|
|
3
3
|
export interface ICompany extends IMetaData {
|
|
4
4
|
id: string;
|
|
5
5
|
displayName: string;
|
|
6
|
-
addressLine1
|
|
6
|
+
addressLine1: string;
|
|
7
7
|
addressLine2?: string;
|
|
8
|
-
city
|
|
9
|
-
stateCode
|
|
8
|
+
city: string;
|
|
9
|
+
stateCode: TUSStateCode;
|
|
10
10
|
companyType: TCompanyType;
|
|
11
|
-
postalCode
|
|
11
|
+
postalCode: string;
|
|
12
12
|
country?: string;
|
|
13
13
|
timezone?: string;
|
|
14
14
|
photoUrl?: string;
|
|
@@ -19,11 +19,11 @@ export interface IGetCompaniesQuery {
|
|
|
19
19
|
}
|
|
20
20
|
export interface ICreateCompanyRequest {
|
|
21
21
|
displayName: string;
|
|
22
|
-
addressLine1
|
|
22
|
+
addressLine1: string;
|
|
23
23
|
addressLine2?: string;
|
|
24
|
-
city
|
|
25
|
-
stateCode
|
|
26
|
-
postalCode
|
|
24
|
+
city: string;
|
|
25
|
+
stateCode: string;
|
|
26
|
+
postalCode: string;
|
|
27
27
|
companyType: TCompanyType;
|
|
28
28
|
}
|
|
29
29
|
export interface ICreateCompanyResponse extends ICompany {
|
|
@@ -1,35 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { TRecordValue } from "../base";
|
|
2
|
+
export declare const DAMAGE_SEVERITY: {
|
|
3
|
+
readonly LOW: "LOW";
|
|
4
|
+
readonly MEDIUM: "MEDIUM";
|
|
5
|
+
readonly HIGH: "HIGH";
|
|
6
|
+
readonly CRITICAL: "CRITICAL";
|
|
7
|
+
};
|
|
8
|
+
export type TDamageSeverity = TRecordValue<typeof DAMAGE_SEVERITY>;
|
|
9
|
+
export declare const DAMAGE_STATUS: {
|
|
10
|
+
readonly OPEN: "OPEN";
|
|
11
|
+
readonly IN_REVIEW: "IN_REVIEW";
|
|
12
|
+
readonly ASSIGNED: "ASSIGNED";
|
|
13
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
14
|
+
readonly RESOLVED: "RESOLVED";
|
|
15
|
+
readonly CLOSED: "CLOSED";
|
|
16
|
+
readonly ESCALATED: "ESCALATED";
|
|
17
|
+
};
|
|
18
|
+
export type TDamageStatus = TRecordValue<typeof DAMAGE_STATUS>;
|
|
19
|
+
export declare const WORK_ORDER_PRIORITY: {
|
|
20
|
+
readonly LOW: "LOW";
|
|
21
|
+
readonly NORMAL: "NORMAL";
|
|
22
|
+
readonly HIGH: "HIGH";
|
|
23
|
+
readonly URGENT: "URGENT";
|
|
24
|
+
};
|
|
25
|
+
export type TWorkOrderPriority = TRecordValue<typeof WORK_ORDER_PRIORITY>;
|
|
26
|
+
export declare const WORK_ORDER_STATUS: {
|
|
27
|
+
readonly PENDING: "PENDING";
|
|
28
|
+
readonly SCHEDULED: "SCHEDULED";
|
|
29
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
30
|
+
readonly COMPLETED: "COMPLETED";
|
|
31
|
+
readonly CANCELLED: "CANCELLED";
|
|
32
|
+
};
|
|
33
|
+
export type TWorkOrderStatus = TRecordValue<typeof WORK_ORDER_STATUS>;
|
|
4
34
|
export interface IDamageReport {
|
|
5
35
|
id: string;
|
|
6
36
|
propertyId: string;
|
|
7
37
|
roomId: string;
|
|
38
|
+
workSessionId: string | null;
|
|
8
39
|
cleaningSessionId?: string;
|
|
9
40
|
reportedBy: string;
|
|
41
|
+
reportedAt: Date;
|
|
10
42
|
severity: TDamageSeverity;
|
|
11
43
|
status: TDamageStatus;
|
|
12
44
|
title: string;
|
|
13
45
|
description: string;
|
|
14
|
-
locationDetails
|
|
15
|
-
estimatedCost
|
|
16
|
-
actualCost
|
|
17
|
-
assignedTo
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
locationDetails: string | null;
|
|
47
|
+
estimatedCost: number | null;
|
|
48
|
+
actualCost: number | null;
|
|
49
|
+
assignedTo: string | null;
|
|
50
|
+
assignedAt: Date | null;
|
|
51
|
+
resolvedAt: Date | null;
|
|
52
|
+
resolvedBy: string | null;
|
|
53
|
+
resolutionNotes: string | null;
|
|
21
54
|
requiresProfessional: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
55
|
+
vendorInfo: string | null;
|
|
56
|
+
insuranceClaimNumber: string | null;
|
|
57
|
+
isTenantResponsible: boolean;
|
|
58
|
+
tenantChargeAmount: number | null;
|
|
59
|
+
createdAt: Date;
|
|
60
|
+
updatedAt: Date;
|
|
61
|
+
photos?: IDamagePhoto[];
|
|
62
|
+
comments?: IDamageComment[];
|
|
24
63
|
}
|
|
25
|
-
export interface
|
|
64
|
+
export interface IDamageReportPhoto {
|
|
26
65
|
id: string;
|
|
27
66
|
damageReportId: string;
|
|
28
67
|
photoId: string;
|
|
29
|
-
photoUrl
|
|
30
|
-
caption
|
|
68
|
+
photoUrl?: string;
|
|
69
|
+
caption: string | null;
|
|
31
70
|
isBeforePhoto: boolean;
|
|
32
71
|
displayOrder: number;
|
|
72
|
+
uploadedBy: string | null;
|
|
73
|
+
createdAt: Date;
|
|
74
|
+
}
|
|
75
|
+
export interface IDamagePhoto extends IDamageReportPhoto {
|
|
33
76
|
}
|
|
34
77
|
export interface IDamageComment {
|
|
35
78
|
id: string;
|
|
@@ -37,5 +80,69 @@ export interface IDamageComment {
|
|
|
37
80
|
userId: string;
|
|
38
81
|
userName?: string;
|
|
39
82
|
comment: string;
|
|
83
|
+
isInternal: boolean;
|
|
84
|
+
createdAt: Date;
|
|
85
|
+
updatedAt: Date;
|
|
86
|
+
}
|
|
87
|
+
export interface IDamageReportStatusHistory {
|
|
88
|
+
id: string;
|
|
89
|
+
damageReportId: string;
|
|
90
|
+
previousStatus: TDamageStatus | null;
|
|
91
|
+
newStatus: TDamageStatus;
|
|
92
|
+
changedBy: string;
|
|
93
|
+
reason: string | null;
|
|
94
|
+
createdAt: Date;
|
|
95
|
+
}
|
|
96
|
+
export interface IWorkOrder {
|
|
97
|
+
id: string;
|
|
98
|
+
damageReportId: string | null;
|
|
99
|
+
propertyId: string;
|
|
100
|
+
roomId: string | null;
|
|
101
|
+
workOrderNumber: string | null;
|
|
102
|
+
priority: TWorkOrderPriority;
|
|
103
|
+
category: string | null;
|
|
104
|
+
assignedTo: string | null;
|
|
105
|
+
assignedAt: Date | null;
|
|
106
|
+
scheduledDate: Date | null;
|
|
107
|
+
scheduledTimeStart: string | null;
|
|
108
|
+
scheduledTimeEnd: string | null;
|
|
109
|
+
startedAt: Date | null;
|
|
110
|
+
completedAt: Date | null;
|
|
111
|
+
completedBy: string | null;
|
|
112
|
+
description: string;
|
|
113
|
+
workPerformed: string | null;
|
|
114
|
+
materialsUsed: string | null;
|
|
115
|
+
laborHours: number | null;
|
|
116
|
+
laborCost: number | null;
|
|
117
|
+
materialsCost: number | null;
|
|
118
|
+
totalCost: number | null;
|
|
119
|
+
status: TWorkOrderStatus;
|
|
40
120
|
createdAt: Date;
|
|
121
|
+
updatedAt: Date;
|
|
122
|
+
}
|
|
123
|
+
export interface ICreateDamageReportInput {
|
|
124
|
+
propertyId: string;
|
|
125
|
+
roomId: string;
|
|
126
|
+
workSessionId?: string;
|
|
127
|
+
reportedBy: string;
|
|
128
|
+
severity: TDamageSeverity;
|
|
129
|
+
title: string;
|
|
130
|
+
description: string;
|
|
131
|
+
locationDetails?: string;
|
|
132
|
+
estimatedCost?: number;
|
|
133
|
+
requiresProfessional?: boolean;
|
|
134
|
+
isTenantResponsible?: boolean;
|
|
135
|
+
tenantChargeAmount?: number;
|
|
41
136
|
}
|
|
137
|
+
export interface ICreateWorkOrderInput {
|
|
138
|
+
damageReportId?: string;
|
|
139
|
+
propertyId: string;
|
|
140
|
+
roomId?: string;
|
|
141
|
+
priority?: TWorkOrderPriority;
|
|
142
|
+
category?: string;
|
|
143
|
+
description: string;
|
|
144
|
+
scheduledDate?: Date;
|
|
145
|
+
scheduledTimeStart?: string;
|
|
146
|
+
scheduledTimeEnd?: string;
|
|
147
|
+
}
|
|
148
|
+
export * from "./routes";
|
|
@@ -1 +1,29 @@
|
|
|
1
|
+
export const DAMAGE_SEVERITY = {
|
|
2
|
+
LOW: "LOW",
|
|
3
|
+
MEDIUM: "MEDIUM",
|
|
4
|
+
HIGH: "HIGH",
|
|
5
|
+
CRITICAL: "CRITICAL",
|
|
6
|
+
};
|
|
7
|
+
export const DAMAGE_STATUS = {
|
|
8
|
+
OPEN: "OPEN",
|
|
9
|
+
IN_REVIEW: "IN_REVIEW",
|
|
10
|
+
ASSIGNED: "ASSIGNED",
|
|
11
|
+
IN_PROGRESS: "IN_PROGRESS",
|
|
12
|
+
RESOLVED: "RESOLVED",
|
|
13
|
+
CLOSED: "CLOSED",
|
|
14
|
+
ESCALATED: "ESCALATED",
|
|
15
|
+
};
|
|
16
|
+
export const WORK_ORDER_PRIORITY = {
|
|
17
|
+
LOW: "LOW",
|
|
18
|
+
NORMAL: "NORMAL",
|
|
19
|
+
HIGH: "HIGH",
|
|
20
|
+
URGENT: "URGENT",
|
|
21
|
+
};
|
|
22
|
+
export const WORK_ORDER_STATUS = {
|
|
23
|
+
PENDING: "PENDING",
|
|
24
|
+
SCHEDULED: "SCHEDULED",
|
|
25
|
+
IN_PROGRESS: "IN_PROGRESS",
|
|
26
|
+
COMPLETED: "COMPLETED",
|
|
27
|
+
CANCELLED: "CANCELLED",
|
|
28
|
+
};
|
|
1
29
|
export * from "./routes";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IDamageComment, IDamagePhoto, IDamageReport, TDamageStatus } from ".";
|
|
1
|
+
import type { ICreateDamageReportInput, ICreateWorkOrderInput, IDamageComment, IDamagePhoto, IDamageReport, IDamageReportStatusHistory, IWorkOrder, TDamageStatus, TWorkOrderStatus } from ".";
|
|
2
2
|
export interface IDamageReportPropertyRouteParams {
|
|
3
3
|
propertyId: string;
|
|
4
4
|
}
|
|
@@ -14,13 +14,7 @@ export interface IDamageReportWorkOrderRouteParams {
|
|
|
14
14
|
export interface IIncludeResolvedQuery {
|
|
15
15
|
includeResolved?: string;
|
|
16
16
|
}
|
|
17
|
-
export interface ICreateDamageReportRequest extends
|
|
18
|
-
propertyId: string;
|
|
19
|
-
roomId: string;
|
|
20
|
-
reportedBy: string;
|
|
21
|
-
severity: IDamageReport["severity"];
|
|
22
|
-
title: string;
|
|
23
|
-
description: string;
|
|
17
|
+
export interface ICreateDamageReportRequest extends ICreateDamageReportInput {
|
|
24
18
|
}
|
|
25
19
|
export interface ICreateDamageReportResponse extends IDamageReport {
|
|
26
20
|
}
|
|
@@ -78,50 +72,10 @@ export interface IAddDamageReportCommentRequest {
|
|
|
78
72
|
}
|
|
79
73
|
export interface IAddDamageReportCommentResponse extends IDamageComment {
|
|
80
74
|
}
|
|
81
|
-
export interface IDamageReportStatusHistory {
|
|
82
|
-
id: string;
|
|
83
|
-
damageReportId: string;
|
|
84
|
-
previousStatus: TDamageStatus | null;
|
|
85
|
-
newStatus: TDamageStatus;
|
|
86
|
-
changedBy: string;
|
|
87
|
-
reason: string | null;
|
|
88
|
-
createdAt: Date;
|
|
89
|
-
}
|
|
90
75
|
export interface IGetDamageReportHistoryRequest extends IDamageReportRouteParams {
|
|
91
76
|
}
|
|
92
77
|
export type IGetDamageReportHistoryResponse = IDamageReportStatusHistory[];
|
|
93
|
-
export
|
|
94
|
-
export type TWorkOrderStatus = "PENDING" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED" | "CANCELLED";
|
|
95
|
-
export interface IWorkOrder {
|
|
96
|
-
id: string;
|
|
97
|
-
damageReportId: string | null;
|
|
98
|
-
propertyId: string;
|
|
99
|
-
roomId: string | null;
|
|
100
|
-
workOrderNumber: string | null;
|
|
101
|
-
priority: TWorkOrderPriority;
|
|
102
|
-
category: string | null;
|
|
103
|
-
assignedTo: string | null;
|
|
104
|
-
assignedAt: Date | null;
|
|
105
|
-
scheduledDate: Date | null;
|
|
106
|
-
scheduledTimeStart: string | null;
|
|
107
|
-
scheduledTimeEnd: string | null;
|
|
108
|
-
startedAt: Date | null;
|
|
109
|
-
completedAt: Date | null;
|
|
110
|
-
completedBy: string | null;
|
|
111
|
-
description: string;
|
|
112
|
-
workPerformed: string | null;
|
|
113
|
-
materialsUsed: string | null;
|
|
114
|
-
laborHours: number | null;
|
|
115
|
-
laborCost: number | null;
|
|
116
|
-
materialsCost: number | null;
|
|
117
|
-
totalCost: number | null;
|
|
118
|
-
status: TWorkOrderStatus;
|
|
119
|
-
createdAt: Date;
|
|
120
|
-
updatedAt: Date;
|
|
121
|
-
}
|
|
122
|
-
export interface ICreateWorkOrderRequest extends Partial<IWorkOrder> {
|
|
123
|
-
propertyId: string;
|
|
124
|
-
description: string;
|
|
78
|
+
export interface ICreateWorkOrderRequest extends ICreateWorkOrderInput {
|
|
125
79
|
}
|
|
126
80
|
export interface ICreateWorkOrderResponse extends IWorkOrder {
|
|
127
81
|
}
|
|
@@ -151,3 +105,8 @@ export interface ICompleteWorkOrderResponse extends IWorkOrder {
|
|
|
151
105
|
export interface IGetWorkOrdersByPropertyIdRequest extends IDamageReportPropertyRouteParams {
|
|
152
106
|
}
|
|
153
107
|
export type IGetWorkOrdersByPropertyIdResponse = IWorkOrder[];
|
|
108
|
+
export interface IUpdateWorkOrderStatusRequest {
|
|
109
|
+
status: TWorkOrderStatus;
|
|
110
|
+
}
|
|
111
|
+
export interface IUpdateWorkOrderStatusResponse extends IWorkOrder {
|
|
112
|
+
}
|
|
@@ -7,6 +7,7 @@ export declare const IMAGE_ENTITY_TYPE: {
|
|
|
7
7
|
readonly PROPERTY_ROOM: "PROPERTY_ROOM";
|
|
8
8
|
readonly MAINTENANCE_TICKET: "MAINTENANCE_TICKET";
|
|
9
9
|
readonly WORK_REPORT: "WORK_REPORT";
|
|
10
|
+
readonly CLEANING_REPORT: "CLEANING_REPORT";
|
|
10
11
|
readonly TURNDOWN_DEFAULT: "TURNDOWN_DEFAULT";
|
|
11
12
|
};
|
|
12
13
|
export type TStoredImageEntityType = (typeof IMAGE_ENTITY_TYPE)[keyof typeof IMAGE_ENTITY_TYPE];
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISelectOption, IMetaData, TRecordValue, TStatus,
|
|
1
|
+
import { ISelectOption, IMetaData, TRecordValue, TStatus, TUSStateCode } from "../index";
|
|
2
2
|
export * from "./routes";
|
|
3
3
|
export declare const PROPERTY_STATUS: {
|
|
4
4
|
readonly Active: "Active";
|
|
@@ -12,14 +12,14 @@ export declare const PropertyTypeOptions: ISelectOption<TPropertyType>[];
|
|
|
12
12
|
export interface IProperty extends IMetaData {
|
|
13
13
|
id: string;
|
|
14
14
|
displayName: string;
|
|
15
|
-
addressLine1
|
|
15
|
+
addressLine1: string;
|
|
16
16
|
addressLine2?: string;
|
|
17
|
-
city
|
|
18
|
-
stateCode
|
|
17
|
+
city: string;
|
|
18
|
+
stateCode: TUSStateCode | string;
|
|
19
19
|
propertyType?: TPropertyType;
|
|
20
20
|
status?: TPropertyStatus;
|
|
21
21
|
sqft?: number;
|
|
22
|
-
postalCode
|
|
22
|
+
postalCode: string;
|
|
23
23
|
country?: string;
|
|
24
24
|
timezone?: string;
|
|
25
25
|
imageUrl?: string;
|
|
@@ -97,10 +97,11 @@ export interface IPropertySummary {
|
|
|
97
97
|
id: string;
|
|
98
98
|
displayName: string;
|
|
99
99
|
propertyType: TPropertyType;
|
|
100
|
-
addressLine1
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
addressLine1: string;
|
|
101
|
+
addressLine2: string;
|
|
102
|
+
city: string;
|
|
103
|
+
stateCode: string;
|
|
104
|
+
postalCode: string;
|
|
104
105
|
imageUrl?: string;
|
|
105
106
|
status?: string;
|
|
106
107
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TRecordValue } from "../base";
|
|
2
|
+
export declare const SUBSCRIPTION_STATUS: {
|
|
3
|
+
readonly ACTIVE: "active";
|
|
4
|
+
readonly CANCELED: "canceled";
|
|
5
|
+
readonly EXPIRED: "expired";
|
|
6
|
+
readonly PAST_DUE: "past_due";
|
|
7
|
+
readonly TRIALING: "trialing";
|
|
8
|
+
};
|
|
9
|
+
export type TSubscriptionStatus = TRecordValue<typeof SUBSCRIPTION_STATUS>;
|
|
10
|
+
export declare const SUBSCRIPTION_PROVIDER: {
|
|
11
|
+
readonly STRIPE: "stripe";
|
|
12
|
+
readonly APPLE: "apple";
|
|
13
|
+
readonly GOOGLE: "google";
|
|
14
|
+
};
|
|
15
|
+
export type TSubscriptionProvider = TRecordValue<typeof SUBSCRIPTION_PROVIDER>;
|
|
16
|
+
export declare const BILLING_PERIOD: {
|
|
17
|
+
readonly MONTHLY: "monthly";
|
|
18
|
+
readonly YEARLY: "yearly";
|
|
19
|
+
};
|
|
20
|
+
export type TBillingPeriod = TRecordValue<typeof BILLING_PERIOD>;
|
|
21
|
+
export interface IUserSubscription {
|
|
22
|
+
id: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
planId: string;
|
|
25
|
+
status: TSubscriptionStatus;
|
|
26
|
+
billingPeriod: TBillingPeriod;
|
|
27
|
+
currentPeriodStart: Date;
|
|
28
|
+
currentPeriodEnd: Date;
|
|
29
|
+
provider: TSubscriptionProvider;
|
|
30
|
+
providerSubscriptionId: string;
|
|
31
|
+
cancelAtPeriodEnd: boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const SUBSCRIPTION_STATUS = {
|
|
2
|
+
ACTIVE: "active",
|
|
3
|
+
CANCELED: "canceled",
|
|
4
|
+
EXPIRED: "expired",
|
|
5
|
+
PAST_DUE: "past_due",
|
|
6
|
+
TRIALING: "trialing",
|
|
7
|
+
};
|
|
8
|
+
export const SUBSCRIPTION_PROVIDER = {
|
|
9
|
+
STRIPE: "stripe",
|
|
10
|
+
APPLE: "apple",
|
|
11
|
+
GOOGLE: "google",
|
|
12
|
+
};
|
|
13
|
+
export const BILLING_PERIOD = {
|
|
14
|
+
MONTHLY: "monthly",
|
|
15
|
+
YEARLY: "yearly",
|
|
16
|
+
};
|
|
@@ -26,10 +26,9 @@ export interface IUserSafe extends Omit<IUser, "passwordHash" | "loginAttempts"
|
|
|
26
26
|
}
|
|
27
27
|
export declare const ACCOUNT_TYPE: {
|
|
28
28
|
readonly TURNDOWN_ADMIN: "TURNDOWN_ADMIN";
|
|
29
|
-
readonly PROPERTY_MANAGER: "PROPERTY_MANAGER";
|
|
30
29
|
readonly ACCOUNT_ADMIN: "ACCOUNT_ADMIN";
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
30
|
+
readonly MANAGER: "MANAGER";
|
|
31
|
+
readonly STAFF: "STAFF";
|
|
33
32
|
readonly GUEST: "GUEST";
|
|
34
33
|
};
|
|
35
34
|
export type TAccountType = TRecordValue<typeof ACCOUNT_TYPE>;
|
package/dist/types/user/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from "./routes";
|
|
2
2
|
export const ACCOUNT_TYPE = {
|
|
3
3
|
TURNDOWN_ADMIN: "TURNDOWN_ADMIN",
|
|
4
|
-
PROPERTY_MANAGER: "PROPERTY_MANAGER",
|
|
5
4
|
ACCOUNT_ADMIN: "ACCOUNT_ADMIN",
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
MANAGER: "MANAGER",
|
|
6
|
+
STAFF: "STAFF",
|
|
8
7
|
GUEST: "GUEST",
|
|
9
8
|
};
|
|
10
9
|
export const ACCOUNT_STATUS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turndown/library",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Shared TypeScript library for the Turndown suite.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"types",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"clean": "rimraf dist",
|
|
35
35
|
"build": "npm run clean && tsc -p .",
|
|
36
36
|
"dev": "tsc -w -p .",
|
|
37
|
+
"format": "prettier --write .",
|
|
37
38
|
"test": "jest",
|
|
38
39
|
"test:watch": "jest --watch",
|
|
39
40
|
"test:coverage": "jest --coverage"
|