@la-main-verte/shared-types 1.0.48 → 1.0.49

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 CHANGED
@@ -1,26 +1,26 @@
1
- # La Main Verte - Shared TypeScript Interfaces
2
-
3
- This package contains the TypeScript interfaces used for the front-end of La Main Verte application.
4
-
5
- ## Installation
6
-
7
- To install the package, run:
8
-
9
- ```bash
10
-
11
- npm install @la-main-verte/shared-types
12
- ```
13
-
14
- ## Usage
15
-
16
- You can import the interfaces directly into your project:
17
-
18
- ```ts
19
- import type { PlantI, NoteI } from '@la-main-verte/shared-types'
20
-
21
- const plant: PlantI = await APIResponse.json()
22
- ```
23
-
24
- ## License
25
-
26
- This package is licensed under the MIT License.
1
+ # La Main Verte - Shared TypeScript Interfaces
2
+
3
+ This package contains the TypeScript interfaces used for the front-end of La Main Verte application.
4
+
5
+ ## Installation
6
+
7
+ To install the package, run:
8
+
9
+ ```bash
10
+
11
+ npm install @la-main-verte/shared-types
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You can import the interfaces directly into your project:
17
+
18
+ ```ts
19
+ import type { PlantI, NoteI } from '@la-main-verte/shared-types'
20
+
21
+ const plant: PlantI = await APIResponse.json()
22
+ ```
23
+
24
+ ## License
25
+
26
+ This package is licensed under the MIT License.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
- {
2
- "name": "@la-main-verte/shared-types",
3
- "version": "1.0.48",
4
- "description": "Shared TypeScript interfaces for frontend of la-main-verte app",
5
- "main": "src/index.js",
6
- "types": "src/index.d.ts",
7
- "author": "lamainverte.ca",
8
- "license": "MIT",
9
- "dependencies": {
10
- "typescript": "^5.6.3"
11
- },
12
- "devDependencies": {},
13
- "scripts": {
14
- "test": "echo \"Error: no test specified\" && exit 1"
15
- }
16
- }
1
+ {
2
+ "name": "@la-main-verte/shared-types",
3
+ "version": "1.0.49",
4
+ "description": "Shared TypeScript interfaces for frontend of la-main-verte app",
5
+ "main": "src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "author": "lamainverte.ca",
8
+ "license": "MIT",
9
+ "dependencies": {
10
+ "typescript": "^5.6.3"
11
+ },
12
+ "devDependencies": {},
13
+ "scripts": {
14
+ "test": "echo \"Error: no test specified\" && exit 1"
15
+ }
16
+ }
package/src/alert.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- export interface AlertI {
2
- id: number
3
- tags: AlertTagI[]
4
- icon: IconName
5
- /**
6
- * ColourCode of the icon
7
- * Ex: #ffffff
8
- */
9
- iconColor: string
10
- message: string
11
- }
12
-
13
- export interface AlertTagI {
14
- name: string
15
- /**
16
- * ColourCode of the alert tag background
17
- * Ex: #ffffff
18
- */
19
- backgroundColor: string
20
- /**
21
- * ColourCode of the alert tag text
22
- * Ex: #ffffff
23
- */
24
- textColor: string
25
- }
1
+ export interface AlertI {
2
+ id: number
3
+ tags: AlertTagI[]
4
+ icon: IconName
5
+ /**
6
+ * ColourCode of the icon
7
+ * Ex: #ffffff
8
+ */
9
+ iconColor: string
10
+ message: string
11
+ }
12
+
13
+ export interface AlertTagI {
14
+ name: string
15
+ /**
16
+ * ColourCode of the alert tag background
17
+ * Ex: #ffffff
18
+ */
19
+ backgroundColor: string
20
+ /**
21
+ * ColourCode of the alert tag text
22
+ * Ex: #ffffff
23
+ */
24
+ textColor: string
25
+ }
package/src/apiError.d.ts CHANGED
@@ -1,28 +1,28 @@
1
- export interface ApiErrorI {
2
- /**
3
- * Literally describe what the server error is, ideally in the language of the user
4
- */
5
- error_message?: string
6
- /**
7
- * A string code to identify the error
8
- */
9
- error_type?:
10
- | 'not_identified'
11
- | 'invalid_request'
12
- | 'subscription_required'
13
- | 'internal_server_error'
14
- | 'resource_already_exists'
15
- | 'not_found'
16
- | 'app_update_required'
17
- | string
18
- /**
19
- * A numerical code that can be used to identify the error
20
- * Ex: 401, 403, 404, 500 or L12, L13, L14
21
- */
22
- error_code?: string | number
23
- /**
24
- * A string that can be used to suggest a solution to the user
25
- * Ex: "Please check your internet connection and try again."
26
- */
27
- error_suggestion?: string
28
- }
1
+ export interface ApiErrorI {
2
+ /**
3
+ * Literally describe what the server error is, ideally in the language of the user
4
+ */
5
+ error_message?: string
6
+ /**
7
+ * A string code to identify the error
8
+ */
9
+ error_type?:
10
+ | 'not_identified'
11
+ | 'invalid_request'
12
+ | 'subscription_required'
13
+ | 'internal_server_error'
14
+ | 'resource_already_exists'
15
+ | 'not_found'
16
+ | 'app_update_required'
17
+ | string
18
+ /**
19
+ * A numerical code that can be used to identify the error
20
+ * Ex: 401, 403, 404, 500 or L12, L13, L14
21
+ */
22
+ error_code?: string | number
23
+ /**
24
+ * A string that can be used to suggest a solution to the user
25
+ * Ex: "Please check your internet connection and try again."
26
+ */
27
+ error_suggestion?: string
28
+ }
@@ -1,7 +1,9 @@
1
- export interface CalendarViewI {
2
- id: number
3
- title: string
4
- slug: string
5
- orderBy: 'startDate' | 'name'
6
- Plants: PlantI[]
7
- }
1
+ import { PlantI } from './plant'
2
+
3
+ export interface CalendarViewI {
4
+ id: number
5
+ title: string
6
+ slug: string
7
+ orderBy: 'startDate' | 'name'
8
+ Plants: PlantI[]
9
+ }
package/src/device.d.ts CHANGED
@@ -1,41 +1,41 @@
1
- /**
2
- * Raw Data returned by the device model
3
- * Device.toJSON() will return this data
4
- */
5
- type DeviceDataI = {
6
- /** Unique identifier for the device */
7
- id: string
8
- /** Identifier for the user associated with the device (UUID) */
9
- memberId: string
10
- /** Optional push notification key */
11
- pushKey?: string
12
- /** Unique identifier for the device (UUID) */
13
- uuid: string
14
- /** RAW User agent string from the device */
15
- userAgent: string
16
- /** Optional platform (e.g., 'ios', 'android', 'windows') */
17
- platform?: 'ios' | 'android' | 'windows'
18
- /** Optional version of the device */
19
- version?: string
20
- /**
21
- * Technical model of the device
22
- * ---
23
- * Ex: iPhone12,1, iPhone13,2, iPhone14,4, etc.
24
- */
25
- model?: string
26
- /**
27
- * Readable name of the device
28
- * ---
29
- * Ex: 'iPhone 12 Pro Max', 'Samsung Galaxy S20', 'MacBook Pro 13 inch'
30
- * */
31
- name?: string
32
- /** Optional app version of the device. Ex: 1.0.0 */
33
- appVersion?: string
34
- /** Timestamp of when the device was created */
35
- createdAt: Date
36
- /** Timestamp of when the device was last updated */
37
- updatedAt: Date
38
- /** Virtual field that combines the name and appVersion */
39
- fullName: string
40
- }
41
- export { DeviceDataI }
1
+ /**
2
+ * Raw Data returned by the device model
3
+ * Device.toJSON() will return this data
4
+ */
5
+ type DeviceDataI = {
6
+ /** Unique identifier for the device */
7
+ id: string
8
+ /** Identifier for the user associated with the device (UUID) */
9
+ memberId: string
10
+ /** Optional push notification key */
11
+ pushKey?: string
12
+ /** Unique identifier for the device (UUID) */
13
+ uuid: string
14
+ /** RAW User agent string from the device */
15
+ userAgent: string
16
+ /** Optional platform (e.g., 'ios', 'android', 'windows') */
17
+ platform?: 'ios' | 'android' | 'windows'
18
+ /** Optional version of the device */
19
+ version?: string
20
+ /**
21
+ * Technical model of the device
22
+ * ---
23
+ * Ex: iPhone12,1, iPhone13,2, iPhone14,4, etc.
24
+ */
25
+ model?: string
26
+ /**
27
+ * Readable name of the device
28
+ * ---
29
+ * Ex: 'iPhone 12 Pro Max', 'Samsung Galaxy S20', 'MacBook Pro 13 inch'
30
+ * */
31
+ name?: string
32
+ /** Optional app version of the device. Ex: 1.0.0 */
33
+ appVersion?: string
34
+ /** Timestamp of when the device was created */
35
+ createdAt: Date
36
+ /** Timestamp of when the device was last updated */
37
+ updatedAt: Date
38
+ /** Virtual field that combines the name and appVersion */
39
+ fullName: string
40
+ }
41
+ export { DeviceDataI }
@@ -1,69 +1,71 @@
1
- /**
2
- * A gardenMap is a collection of garden zones
3
- */
4
- export interface GardenMapI {
5
- id: number
6
- memberId: number
7
- GardenZones: GardenZoneI[]
8
- createdAt: Date
9
- updatedAt: Date
10
- }
11
- export interface GardenZoneI {
12
- id: number
13
- name: string | null
14
- gardenMapId: number
15
- widthInMeters: number
16
- heightInMeters: number
17
- diameterInMeters: number
18
- shape: 'rectangle' | 'circle'
19
- xPosition: number
20
- yPosition: number | null
21
- zIndex: number
22
- order: number
23
- totalSurfaceInSquareMeters: number
24
- totalSurfaceInSquareFeet: number
25
- backgroundColor: string
26
- createdAt: Date
27
- updatedAt: Date
28
- /**
29
- * Orientation virtual field ONLY USE FOR RECTANGLES
30
- * --------------------------------
31
- * Disregard if the shape is a circle or square. It will return 'vertical'
32
- */
33
- orientation: 'horizontal' | 'vertical'
34
- /**
35
- * NOT USED BY THE FRONTEND YET - Use GardenZoneCulture instead
36
- */
37
- GardenZoneCultures?: GardenZoneCultureI[]
38
- /**
39
- * The culture on the GardenZone
40
- */
41
- GardenZoneCulture?: GardenZoneCultureI
42
- }
43
-
44
- export interface GardenZoneCultureI {
45
- id: number
46
- gardenZoneId: number
47
- plantSelectionId: number
48
- seedQuantity: number
49
- densityMode: 'dense' | 'sparse' | 'custom'
50
- /**
51
- * The year of the culture - do not use it yet.
52
- * @deprecated Potentially a mistake to have this field here
53
- */
54
- yearOfCulture: number
55
- PlantSelection?: PlantSelectionI
56
- /**
57
- * The number of alleys
58
- * --------------------------------
59
- * Value is computed by the backend and NOT coming from the DB.
60
- */
61
- numberOfAlleys?: number
62
- /**
63
- * The number of seeds per alley
64
- * --------------------------------
65
- * Value is computed by the backend and NOT coming from the DB.
66
- */
67
- numberOfSeedsPerAlley?: number
68
- fertilizerQuantitySuggested?: string
69
- }
1
+ import { PlantSelectionI } from './plantSelection.d.ts'
2
+
3
+ /**
4
+ * A gardenMap is a collection of garden zones
5
+ */
6
+ export interface GardenMapI {
7
+ id: number
8
+ memberId: number
9
+ GardenZones: GardenZoneI[]
10
+ createdAt: Date
11
+ updatedAt: Date
12
+ }
13
+ export interface GardenZoneI {
14
+ id: number
15
+ name: string | null
16
+ gardenMapId: number
17
+ widthInMeters: number
18
+ heightInMeters: number
19
+ diameterInMeters: number
20
+ shape: 'rectangle' | 'circle'
21
+ xPosition: number
22
+ yPosition: number | null
23
+ zIndex: number
24
+ order: number
25
+ totalSurfaceInSquareMeters: number
26
+ totalSurfaceInSquareFeet: number
27
+ backgroundColor: string
28
+ createdAt: Date
29
+ updatedAt: Date
30
+ /**
31
+ * Orientation virtual field ONLY USE FOR RECTANGLES
32
+ * --------------------------------
33
+ * Disregard if the shape is a circle or square. It will return 'vertical'
34
+ */
35
+ orientation: 'horizontal' | 'vertical'
36
+ /**
37
+ * NOT USED BY THE FRONTEND YET - Use GardenZoneCulture instead
38
+ */
39
+ GardenZoneCultures?: GardenZoneCultureI[]
40
+ /**
41
+ * The culture on the GardenZone
42
+ */
43
+ GardenZoneCulture?: GardenZoneCultureI
44
+ }
45
+
46
+ export interface GardenZoneCultureI {
47
+ id: number
48
+ gardenZoneId: number
49
+ plantSelectionId: number
50
+ seedQuantity: number
51
+ densityMode: 'dense' | 'sparse' | 'custom'
52
+ /**
53
+ * The year of the culture - do not use it yet.
54
+ * @deprecated Potentially a mistake to have this field here
55
+ */
56
+ yearOfCulture: number
57
+ PlantSelection?: PlantSelectionI
58
+ /**
59
+ * The number of alleys
60
+ * --------------------------------
61
+ * Value is computed by the backend and NOT coming from the DB.
62
+ */
63
+ numberOfAlleys?: number
64
+ /**
65
+ * The number of seeds per alley
66
+ * --------------------------------
67
+ * Value is computed by the backend and NOT coming from the DB.
68
+ */
69
+ numberOfSeedsPerAlley?: number
70
+ fertilizerQuantitySuggested?: string
71
+ }
package/src/image.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export interface ImageI {
2
- id: number
3
- noteId: number
4
- s3Key: string
5
- s3Url: string
6
- filename: string
7
- imageURL: string
8
- createdAt: Date
9
- updatedAt: Date
10
- }
1
+ export interface ImageI {
2
+ id: number
3
+ noteId: number
4
+ s3Key: string
5
+ s3Url: string
6
+ filename: string
7
+ imageURL: string
8
+ createdAt: Date
9
+ updatedAt: Date
10
+ }
package/src/index.ts CHANGED
@@ -1,18 +1,21 @@
1
- export * from './member'
2
- export * from './selection'
3
- export * from './plantSelection'
4
- export * from './plant'
5
- export * from './task'
6
- export * from './calendarView'
7
- export * from './apiError'
8
- export * from './gardenMap'
9
- export * from './alert'
10
- export * from './image'
11
- import * as PlantsAPI from './plants.api'
12
- import * as UsersAPI from './users.api'
13
-
14
- // Allow access to the API namespaces without conflicts
15
- export namespace API {
16
- export import PLANTS = PlantsAPI
17
- export import USERS = UsersAPI
18
- }
1
+ export * from './member'
2
+ export * from './selection'
3
+ export * from './plantSelection'
4
+ export * from './plant'
5
+ export * from './task'
6
+ export * from './calendarView'
7
+ export * from './apiError'
8
+ export * from './gardenMap'
9
+ export * from './alert'
10
+ export * from './image'
11
+ export * from './note'
12
+ export * from './taggedItem'
13
+ export * from './tag'
14
+ import * as PlantsAPI from './plants.api'
15
+ import * as UsersAPI from './users.api'
16
+
17
+ // Allow access to the API namespaces without conflicts
18
+ export namespace API {
19
+ export import PLANTS = PlantsAPI
20
+ export import USERS = UsersAPI
21
+ }
package/src/member.d.ts CHANGED
@@ -1,58 +1,61 @@
1
- export interface MemberI {
2
- id: number
3
- email: string
4
- firstName: string
5
- lastName: string
6
- /** Virtual field to get the user's full name */
7
- fullName?: string | null
8
- city?: string
9
- hardinessZoneName?: string
10
- createdAt: Date
11
- updatedAt: Date
12
- lastFreezingDate?: Date
13
- firstFreezingDate?: Date
14
- /**
15
- * Number of unread Crisp messages
16
- */
17
- unreadMessagesCount?: number
18
- notes?: NoteI[]
19
- selections?: SelectionI[]
20
- userActivities?: UserActivityI[]
21
- /**
22
- * hasAnActiveSubscription is a VIRTUAL FIELD used to check if the user has an active subscription
23
- */
24
- hasAnActiveSubscription?: boolean
25
- /**
26
- * Acts as a one-way not identifiable token.
27
- * Crisp and other services like Upvoty use this token to identify the user
28
- */
29
- userToken: string
30
- /**
31
- * neverAddedATask <=> Has the use ever open the task form?
32
- * Yes it is misleading, ticket is open to change it.
33
- * It was too intense to force the user to add a task.
34
- */
35
- neverAddedATask?: boolean
36
- neverAddedAPlant?: boolean
37
- neverAddedANote?: boolean
38
- neverTriedSpacingSection?: boolean
39
- neverTriedAiAgent?: boolean
40
- neverDeletedAPlant?: boolean
41
- neverDeletedATask?: boolean
42
- neverEditedATask?: boolean
43
- finishedOnboarding: boolean
44
- hasDownloadedNativeApp?: boolean
45
- unitSystem: 'imperial' | 'metric'
46
- subscriptionEndDate?: Date
47
- /**
48
- * Virtual field to get the app badge count
49
- * ----------------------------------------
50
- * For now, it's just the number of unread messages.
51
- */
52
- badgeCount?: number
53
- /**
54
- * Number of unread alerts, cached version of unread alerts (the table) count
55
- */
56
- unreadAlertsCount?: number
57
- isAdmin: boolean
58
- }
1
+ import { NoteI } from './note'
2
+ import { SelectionI } from './selection'
3
+
4
+ export interface MemberI {
5
+ id: number
6
+ email: string
7
+ firstName: string
8
+ lastName: string
9
+ /** Virtual field to get the user's full name */
10
+ fullName?: string | null
11
+ city?: string
12
+ hardinessZoneName?: string
13
+ createdAt: Date
14
+ updatedAt: Date
15
+ lastFreezingDate?: Date
16
+ firstFreezingDate?: Date
17
+ /**
18
+ * Number of unread Crisp messages
19
+ */
20
+ unreadMessagesCount?: number
21
+ notes?: NoteI[]
22
+ selections?: SelectionI[]
23
+ userActivities?: UserActivityI[]
24
+ /**
25
+ * hasAnActiveSubscription is a VIRTUAL FIELD used to check if the user has an active subscription
26
+ */
27
+ hasAnActiveSubscription?: boolean
28
+ /**
29
+ * Acts as a one-way not identifiable token.
30
+ * Crisp and other services like Upvoty use this token to identify the user
31
+ */
32
+ userToken: string
33
+ /**
34
+ * neverAddedATask <=> Has the use ever open the task form?
35
+ * Yes it is misleading, ticket is open to change it.
36
+ * It was too intense to force the user to add a task.
37
+ */
38
+ neverAddedATask?: boolean
39
+ neverAddedAPlant?: boolean
40
+ neverAddedANote?: boolean
41
+ neverTriedSpacingSection?: boolean
42
+ neverTriedAiAgent?: boolean
43
+ neverDeletedAPlant?: boolean
44
+ neverDeletedATask?: boolean
45
+ neverEditedATask?: boolean
46
+ finishedOnboarding: boolean
47
+ hasDownloadedNativeApp?: boolean
48
+ unitSystem: 'imperial' | 'metric'
49
+ subscriptionEndDate?: Date
50
+ /**
51
+ * Virtual field to get the app badge count
52
+ * ----------------------------------------
53
+ * For now, it's just the number of unread messages.
54
+ */
55
+ badgeCount?: number
56
+ /**
57
+ * Number of unread alerts, cached version of unread alerts (the table) count
58
+ */
59
+ unreadAlertsCount?: number
60
+ isAdmin: boolean
61
+ }
package/src/note.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { ImageI } from './image.d.ts'
2
+ import { TaggedItemI } from './taggedItem.d.ts'
3
+
4
+ export interface NoteI {
5
+ id: number
6
+ memberId: number
7
+ title: string
8
+ contentInMarkdown: string
9
+ color?: string
10
+ agreedToShare: boolean
11
+ createdAt: Date
12
+ updatedAt: Date
13
+ /**
14
+ * Virtual field for the note thumbnail imageURL (absolute path) */
15
+ imageURL?: string
16
+ /**
17
+ * Virtual field indicating if the note content is short
18
+ * Used to alter the design of the note (likely with ContentInMarkdown replacing the title)
19
+ * */
20
+ hasShortContent?: boolean
21
+ /**
22
+ * Virtual field for the note sharing URL (relative path) */
23
+ sharingURL: string
24
+ darkColor: string
25
+ pastelColor: string
26
+ Images: ImageI[]
27
+ TaggedItems: TaggedItemI[]
28
+ }