@jaws-developers-customers/consulca-types 1.0.5 → 1.0.7
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/README.md +3 -0
- package/index.d.ts +6 -5
- package/index.js +8 -3
- package/index.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ Il workflow genera una versione unica per ogni run su `main`, così la pubblicaz
|
|
|
30
30
|
- `formatAddress`
|
|
31
31
|
- `hasUserRole`
|
|
32
32
|
- `hasAccessChannel`
|
|
33
|
+
- `Query.isSuccess`
|
|
33
34
|
|
|
34
35
|
## Esempio
|
|
35
36
|
|
|
@@ -47,6 +48,8 @@ console.log(getUserFullName({ first_name: 'Mario', last_name: 'Rossi' }));
|
|
|
47
48
|
console.log(hasUserRole([{ role: 'manager' }], 'manager'));
|
|
48
49
|
```
|
|
49
50
|
|
|
51
|
+
`Query.isSuccess(error_code)` restituisce `true` per i codici nel formato `xx.xx.xxx` il cui ultimo gruppo inizia con `0`.
|
|
52
|
+
|
|
50
53
|
### Esempio TypeScript
|
|
51
54
|
|
|
52
55
|
```ts
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export type UserStatus = 'active' | 'invited' | 'suspended' | 'disabled';
|
|
|
2
2
|
export type UserRole = 'lessor' | 'manager' | 'website_manager' | 'inspector';
|
|
3
3
|
export type AccessChannel = 'intranet_dashboard' | 'mobile_app' | 'website_admin';
|
|
4
4
|
export type AccessStatus = 'active' | 'revoked';
|
|
5
|
-
export type PropertyType = 'apartment' | 'house' | 'commercial' | 'parking' | 'other';
|
|
6
5
|
export type PropertyStatus = 'active' | 'inactive' | 'archived';
|
|
7
6
|
export type ManagementRole = 'primary' | 'secondary' | 'accounting' | 'technical' | 'other';
|
|
8
7
|
export type LeaseStatus = 'planned' | 'active' | 'ended' | 'cancelled';
|
|
@@ -23,6 +22,11 @@ export interface ColorPalette {
|
|
|
23
22
|
export interface Constants {
|
|
24
23
|
API_DEV: string;
|
|
25
24
|
API: string;
|
|
25
|
+
ICON: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface QueryHelpers {
|
|
29
|
+
isSuccess(errorCode: string): boolean;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export interface Addressable {
|
|
@@ -86,9 +90,7 @@ export interface Property {
|
|
|
86
90
|
id: string;
|
|
87
91
|
building_id: string;
|
|
88
92
|
property_number: string;
|
|
89
|
-
property_type: PropertyType;
|
|
90
93
|
floor?: string | null;
|
|
91
|
-
rooms?: number | null;
|
|
92
94
|
area_m2?: number | null;
|
|
93
95
|
status: PropertyStatus;
|
|
94
96
|
created_at: string | Date;
|
|
@@ -169,7 +171,6 @@ export interface Claim {
|
|
|
169
171
|
title: string;
|
|
170
172
|
description: string;
|
|
171
173
|
amount_estimate?: number | null;
|
|
172
|
-
currency: string;
|
|
173
174
|
submitted_at?: string | Date | null;
|
|
174
175
|
created_at: string | Date;
|
|
175
176
|
updated_at: string | Date;
|
|
@@ -224,7 +225,6 @@ export declare const USER_STATUSES: readonly UserStatus[];
|
|
|
224
225
|
export declare const USER_ROLES: readonly UserRole[];
|
|
225
226
|
export declare const ACCESS_CHANNELS: readonly AccessChannel[];
|
|
226
227
|
export declare const ACCESS_STATUSES: readonly AccessStatus[];
|
|
227
|
-
export declare const PROPERTY_TYPES: readonly PropertyType[];
|
|
228
228
|
export declare const PROPERTY_STATUSES: readonly PropertyStatus[];
|
|
229
229
|
export declare const MANAGEMENT_ROLES: readonly ManagementRole[];
|
|
230
230
|
export declare const LEASE_STATUSES: readonly LeaseStatus[];
|
|
@@ -235,6 +235,7 @@ export declare const CLAIM_STATUSES: readonly ClaimStatus[];
|
|
|
235
235
|
export declare const WORK_STATUSES: readonly WorkStatus[];
|
|
236
236
|
export declare const COLOR_PALETTE: Readonly<ColorPalette>;
|
|
237
237
|
export declare const CONSTANTS: Readonly<Constants>;
|
|
238
|
+
export declare const Query: Readonly<QueryHelpers>;
|
|
238
239
|
|
|
239
240
|
export declare function toDate(value: string | number | Date | null | undefined): Date | null;
|
|
240
241
|
export declare function formatDate(
|
package/index.js
CHANGED
|
@@ -4,7 +4,6 @@ const USER_STATUSES = Object.freeze(['active', 'invited', 'suspended', 'disabled
|
|
|
4
4
|
const USER_ROLES = Object.freeze(['lessor', 'manager', 'website_manager', 'inspector']);
|
|
5
5
|
const ACCESS_CHANNELS = Object.freeze(['intranet_dashboard', 'mobile_app', 'website_admin']);
|
|
6
6
|
const ACCESS_STATUSES = Object.freeze(['active', 'revoked']);
|
|
7
|
-
const PROPERTY_TYPES = Object.freeze(['apartment', 'house', 'commercial', 'parking', 'other']);
|
|
8
7
|
const PROPERTY_STATUSES = Object.freeze(['active', 'inactive', 'archived']);
|
|
9
8
|
const MANAGEMENT_ROLES = Object.freeze(['primary', 'secondary', 'accounting', 'technical', 'other']);
|
|
10
9
|
const LEASE_STATUSES = Object.freeze(['planned', 'active', 'ended', 'cancelled']);
|
|
@@ -22,7 +21,13 @@ const COLOR_PALETTE = Object.freeze({
|
|
|
22
21
|
});
|
|
23
22
|
const CONSTANTS = Object.freeze({
|
|
24
23
|
API_DEV: 'https://api.consulca.local',
|
|
25
|
-
API: 'https://api.consulca.ch'
|
|
24
|
+
API: 'https://api.consulca.ch',
|
|
25
|
+
ICON: 'https://www.consulca.ch/wp-content/themes/consulca_theme2020/img/default_user.png'
|
|
26
|
+
});
|
|
27
|
+
const Query = Object.freeze({
|
|
28
|
+
isSuccess(errorCode) {
|
|
29
|
+
return typeof errorCode === 'string' && /^\d{2}\.\d{2}\.0\d{2}$/.test(errorCode);
|
|
30
|
+
},
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
function toDate(value) {
|
|
@@ -128,7 +133,6 @@ module.exports = {
|
|
|
128
133
|
LEASE_STATUSES,
|
|
129
134
|
MANAGEMENT_ROLES,
|
|
130
135
|
PROPERTY_STATUSES,
|
|
131
|
-
PROPERTY_TYPES,
|
|
132
136
|
USER_ROLES,
|
|
133
137
|
USER_STATUSES,
|
|
134
138
|
WORK_STATUSES,
|
|
@@ -140,5 +144,6 @@ module.exports = {
|
|
|
140
144
|
getUserFullName,
|
|
141
145
|
hasAccessChannel,
|
|
142
146
|
hasUserRole,
|
|
147
|
+
Query,
|
|
143
148
|
toDate,
|
|
144
149
|
};
|
package/index.mjs
CHANGED