@la-main-verte/shared-types 1.0.57 → 1.0.58

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.
@@ -1,84 +1,92 @@
1
- import { PlantI } from './plant.d'
2
- import { SelectionI } from './selection.d'
3
- import { ImageDataI } from './image.d'
4
-
5
- interface PlantExtendedDataI extends PlantI {
6
- /**
7
- * Future plant images gallery for now using notes as a proxy
8
- */
9
- Images: ImageDataI[]
10
- /**
11
- * Selections of the plant
12
- */
13
- Selections: SelectionI[]
14
- }
15
-
16
- export namespace PLANTS {
17
- export namespace RECOMMENDATIONS {
18
- /**
19
- * Request parameters for plant recommendations
20
- * @remarks identification by session token is optional
21
- */
22
- export interface Request {
23
- headers?: {
24
- 'x-session-token'?: string
25
- }
26
- }
27
- /**
28
- * Response containing recommended plants with their tags
29
- */
30
- export type Response = PlantExtendedDataI[]
31
- }
32
- export namespace SEARCH {
33
- /**
34
- * Request parameters for plant recommendations
35
- * @remarks identification by session token is optional
36
- */
37
- export interface Request {
38
- headers?: {
39
- 'x-session-token'?: string
40
- }
41
- query?: {
42
- withAzoteNeedsKgPerHa?: boolean
43
- withSpacing?: boolean
44
- parentsOnly?: boolean
45
- search?: string
46
- family?: string
47
- limit?: number
48
- /**
49
- * If submitted, it means we are searching for plants that can be planted in the given garden zone.
50
- * It almost means:
51
- * - withSpacing will be set to true automatically.
52
- * - Plant.contextualSearchText may be added to the results to provided additional contextual information to the search results (and therefore the member)
53
- */
54
- gardenZoneId?: string | number
55
- }
56
- }
57
- /**
58
- * Response containing search plants with their tags
59
- */
60
- export type Response = PlantExtendedDataI[]
61
- }
62
- export namespace UPDATE {
63
- export interface Request {
64
- params: {
65
- slug: string
66
- }
67
- body: {
68
- name?: string
69
- description?: string
70
- shared?: boolean
71
- spaceBetweenSeedMin?: number | null
72
- spaceBetweenSeedMax?: number | null
73
- spaceBetweenAlleyMin?: number | null
74
- spaceBetweenAlleyMax?: number | null
75
- weeksToMaturity?: number | null
76
- indoorSeeding?: boolean
77
- outdoorSeeding?: boolean
78
- sunRequirements?: 'partialShade' | 'fullSun' | 'fullShade' | null
79
- isHardy?: boolean | null
80
- }
81
- }
82
- export type Response = PlantI
83
- }
84
- }
1
+ import { PlantI } from './plant.d'
2
+ import { SelectionI } from './selection.d'
3
+ import { ImageDataI } from './image.d'
4
+
5
+ interface PlantExtendedDataI extends PlantI {
6
+ /**
7
+ * Future plant images gallery for now using notes as a proxy
8
+ */
9
+ Images: ImageDataI[]
10
+ /**
11
+ * Selections of the plant
12
+ */
13
+ Selections: SelectionI[]
14
+ }
15
+
16
+ export namespace PLANTS {
17
+ export namespace RECOMMENDATIONS {
18
+ /**
19
+ * Request parameters for plant recommendations
20
+ * @remarks identification by session token is optional
21
+ */
22
+ export interface Request {
23
+ headers?: {
24
+ 'x-session-token'?: string
25
+ }
26
+ query?: {
27
+ gardenZoneId?: string | number
28
+ selectionSlug?: string
29
+ }
30
+ }
31
+ export type RecommendedPlantI = PlantExtendedDataI & {
32
+ contextualSearchText?: string
33
+ }
34
+ export type Response = RecommendedPlantI[]
35
+ }
36
+ export namespace SEARCH {
37
+ /**
38
+ * Request parameters for plant recommendations
39
+ * @remarks identification by session token is optional
40
+ */
41
+ export interface Request {
42
+ headers?: {
43
+ 'x-session-token'?: string
44
+ }
45
+ query?: {
46
+ withAzoteNeedsKgPerHa?: boolean
47
+ withSpacing?: boolean
48
+ parentsOnly?: boolean
49
+ search?: string
50
+ family?: string
51
+ limit?: number
52
+ /**
53
+ * If submitted, it means we are searching for plants that can be planted in the given garden zone.
54
+ * It almost means:
55
+ * - withSpacing will be set to true automatically.
56
+ * - Plant.contextualSearchText may be added to the results to provided additional contextual information to the search results (and therefore the member)
57
+ */
58
+ gardenZoneId?: string | number
59
+ /**
60
+ * Slug of the selection currently being edited. Used to contextualize rotation insights for search results.
61
+ */
62
+ selectionSlug?: string
63
+ }
64
+ }
65
+ /**
66
+ * Response containing search plants with their tags
67
+ */
68
+ export type Response = PlantExtendedDataI[]
69
+ }
70
+ export namespace UPDATE {
71
+ export interface Request {
72
+ params: {
73
+ slug: string
74
+ }
75
+ body: {
76
+ name?: string
77
+ description?: string
78
+ shared?: boolean
79
+ spaceBetweenSeedMin?: number | null
80
+ spaceBetweenSeedMax?: number | null
81
+ spaceBetweenAlleyMin?: number | null
82
+ spaceBetweenAlleyMax?: number | null
83
+ weeksToMaturity?: number | null
84
+ indoorSeeding?: boolean
85
+ outdoorSeeding?: boolean
86
+ sunRequirements?: 'partialShade' | 'fullSun' | 'fullShade' | null
87
+ isHardy?: boolean | null
88
+ }
89
+ }
90
+ export type Response = PlantI
91
+ }
92
+ }
@@ -0,0 +1,3 @@
1
+ export type RotationGroup = 'regenerative' | 'demanding' | 'moderately_demanding' | 'less_demanding'
2
+
3
+ export const ROTATION_GROUPS: RotationGroup[] = ['regenerative', 'demanding', 'moderately_demanding', 'less_demanding']
@@ -1,55 +1,55 @@
1
- import { PlantI } from './plant'
2
-
3
- export interface SelectionI {
4
- id: number
5
- memberId: number
6
- title: string
7
- slug: string
8
- description?: string
9
- orderBy?: 'startDate' | 'name'
10
- default?: boolean
11
- viewsCount?: number
12
- imageLocation?: string
13
- imageURL?: string
14
- /**
15
- * Indicates if the selection is featured on the app (search, explore, etc).
16
- **/
17
- featured: boolean
18
- /**
19
- * Indicates if the selection is dynamically generated on the fly by the API.
20
- * Ex: "What you can seed in March"
21
- * INTERNAL USE ONLY
22
- */
23
- isDynamic: boolean
24
- /**
25
- * Background color of the selection, for UI purposes.
26
- */
27
- backgroundColor: string | null
28
- /**
29
- * Font color of the selection, for UI purposes.
30
- */
31
- fontColor: string | null
32
- /**
33
- * Font awesome icon name of the selection, for UI purposes.
34
- * -----------------------------------------
35
- * Not all icons are available in the react-native-app. Must be explicitly declared first.
36
- * Ex: 'fa-bag-seedling', 'fa-bug', etc.
37
- */
38
- iconName: string | null
39
- link?: string
40
- sharingURL?: string
41
- createdAt: Date
42
- updatedAt: Date
43
- Plants?: PlantI[]
44
- yearOfCulture: number
45
- }
46
-
47
- /**
48
- * Those are the different possible types for a selection.
49
- */
50
- export type SelectionType = 'Serre' | 'Potager' | 'Recette' | 'Coup de coeur' | "Jardin d'intérieur" | 'Autres'
51
-
52
- export interface SelectionTypeI {
53
- name: SelectionType
54
- iconName?: IconName
55
- }
1
+ import { PlantI } from './plant'
2
+
3
+ export interface SelectionI {
4
+ id: number
5
+ memberId: number
6
+ title: string
7
+ slug: string
8
+ description?: string
9
+ orderBy?: 'startDate' | 'name'
10
+ default?: boolean
11
+ viewsCount?: number
12
+ imageLocation?: string
13
+ imageURL?: string
14
+ /**
15
+ * Indicates if the selection is featured on the app (search, explore, etc).
16
+ **/
17
+ featured: boolean
18
+ /**
19
+ * Indicates if the selection is dynamically generated on the fly by the API.
20
+ * Ex: "What you can seed in March"
21
+ * INTERNAL USE ONLY
22
+ */
23
+ isDynamic: boolean
24
+ /**
25
+ * Background color of the selection, for UI purposes.
26
+ */
27
+ backgroundColor: string | null
28
+ /**
29
+ * Font color of the selection, for UI purposes.
30
+ */
31
+ fontColor: string | null
32
+ /**
33
+ * Font awesome icon name of the selection, for UI purposes.
34
+ * -----------------------------------------
35
+ * Not all icons are available in the react-native-app. Must be explicitly declared first.
36
+ * Ex: 'fa-bag-seedling', 'fa-bug', etc.
37
+ */
38
+ iconName: string | null
39
+ link?: string
40
+ sharingURL?: string
41
+ createdAt: Date
42
+ updatedAt: Date
43
+ Plants?: PlantI[]
44
+ yearOfCulture: number
45
+ }
46
+
47
+ /**
48
+ * Those are the different possible types for a selection.
49
+ */
50
+ export type SelectionType = 'Serre' | 'Potager' | 'Recette' | 'Coup de coeur' | "Jardin d'intérieur" | 'Autres'
51
+
52
+ export interface SelectionTypeI {
53
+ name: SelectionType
54
+ iconName?: IconName
55
+ }
@@ -1,134 +1,134 @@
1
- import type { UTMParams } from './utmParams'
2
- import type { EventType, EventDetailsI } from '../../server/types/sessionEvent'
3
- import type { PaymentProductTypeI } from '../../server/types/payment'
4
-
5
- interface RequestHeaders {
6
- 'x-session-token'?: string
7
- 'x-native-app-version'?: string
8
- 'x-application-type'?: 'react-native' | 'web'
9
- 'user-agent'?: string
10
- }
11
-
12
- export namespace SESSIONS {
13
- export namespace POST {
14
- export interface Request {
15
- headers: RequestHeaders
16
- body: {
17
- uuid?: string
18
- platform?: 'web' | 'react-native' | 'unknown'
19
- device_id?: number
20
- app_version?: string
21
- ip_address?: string
22
- } & Partial<UTMParams>
23
- }
24
- export interface Response {
25
- success: boolean
26
- session: {
27
- id: number
28
- uuid: string
29
- is_authenticated: boolean
30
- expires_at: string
31
- platform: string
32
- first_seen_at: string
33
- last_activity_at: string
34
- }
35
- message?: string
36
- }
37
- }
38
-
39
- export namespace GET {
40
- export interface Request {
41
- headers: RequestHeaders
42
- query: {
43
- session_id: string
44
- }
45
- }
46
- export interface Response {
47
- success: boolean
48
- session?: {
49
- id: number
50
- uuid: string
51
- is_authenticated: boolean
52
- expires_at: string
53
- platform: string
54
- first_seen_at: string
55
- last_activity_at: string
56
- memberId?: number
57
- }
58
- message?: string
59
- }
60
- }
61
-
62
- export namespace EVENTS {
63
- export namespace POST {
64
- export interface Request {
65
- headers: RequestHeaders
66
- body: EventDetailsI & {
67
- uuid: string
68
- event_data?: any
69
- // Feature usage specific
70
- feature_name?: string
71
- feature_action?: string
72
- // Event metadata
73
- platform?: 'web' | 'react-native' | 'unknown'
74
- device_id?: number
75
- app_version?: string
76
- ip_address?: string
77
- // Payment tracking
78
- payment_customer_external_id?: string
79
- payment_processor?: 'stripe' | 'apple' | 'google'
80
- payment_middleware?: 'stripe' | 'revenuecat'
81
- payment_product_type?: PaymentProductTypeI
82
- payment_transaction_id?: string
83
- // Revenue tracking
84
- revenue_amount?: number
85
- currency?: string
86
- created_by?: 'server' | 'client' | 'unknown'
87
- }
88
- }
89
- export interface Response {
90
- success: boolean
91
- event: {
92
- id: number
93
- sessionId: number
94
- createdAt: string
95
- } & EventDetailsI
96
- message?: string
97
- }
98
- }
99
-
100
- export namespace GET {
101
- export interface Request {
102
- headers: RequestHeaders
103
- query: {
104
- session_id?: string
105
- event_type?: EventType
106
- feature_name?: string
107
- campaign_id?: string
108
- start_date?: string
109
- end_date?: string
110
- limit?: number
111
- offset?: number
112
- }
113
- }
114
- export interface Response {
115
- success: boolean
116
- events: Array<
117
- {
118
- id: number
119
- sessionId: number
120
- event_data?: any
121
- feature_name?: string
122
- feature_action?: string
123
- platform: string
124
- revenue_amount?: number
125
- currency?: string
126
- createdAt: string
127
- } & EventDetailsI
128
- >
129
- total_count: number
130
- message?: string
131
- }
132
- }
133
- }
134
- }
1
+ import type { UTMParams } from './utmParams'
2
+ import type { EventType, EventDetailsI } from '../../server/types/sessionEvent'
3
+ import type { PaymentProductTypeI } from '../../server/types/payment'
4
+
5
+ interface RequestHeaders {
6
+ 'x-session-token'?: string
7
+ 'x-native-app-version'?: string
8
+ 'x-application-type'?: 'react-native' | 'web'
9
+ 'user-agent'?: string
10
+ }
11
+
12
+ export namespace SESSIONS {
13
+ export namespace POST {
14
+ export interface Request {
15
+ headers: RequestHeaders
16
+ body: {
17
+ uuid?: string
18
+ platform?: 'web' | 'react-native' | 'unknown'
19
+ device_id?: number
20
+ app_version?: string
21
+ ip_address?: string
22
+ } & Partial<UTMParams>
23
+ }
24
+ export interface Response {
25
+ success: boolean
26
+ session: {
27
+ id: number
28
+ uuid: string
29
+ is_authenticated: boolean
30
+ expires_at: string
31
+ platform: string
32
+ first_seen_at: string
33
+ last_activity_at: string
34
+ }
35
+ message?: string
36
+ }
37
+ }
38
+
39
+ export namespace GET {
40
+ export interface Request {
41
+ headers: RequestHeaders
42
+ query: {
43
+ session_id: string
44
+ }
45
+ }
46
+ export interface Response {
47
+ success: boolean
48
+ session?: {
49
+ id: number
50
+ uuid: string
51
+ is_authenticated: boolean
52
+ expires_at: string
53
+ platform: string
54
+ first_seen_at: string
55
+ last_activity_at: string
56
+ memberId?: number
57
+ }
58
+ message?: string
59
+ }
60
+ }
61
+
62
+ export namespace EVENTS {
63
+ export namespace POST {
64
+ export interface Request {
65
+ headers: RequestHeaders
66
+ body: EventDetailsI & {
67
+ uuid: string
68
+ event_data?: any
69
+ // Feature usage specific
70
+ feature_name?: string
71
+ feature_action?: string
72
+ // Event metadata
73
+ platform?: 'web' | 'react-native' | 'unknown'
74
+ device_id?: number
75
+ app_version?: string
76
+ ip_address?: string
77
+ // Payment tracking
78
+ payment_customer_external_id?: string
79
+ payment_processor?: 'stripe' | 'apple' | 'google'
80
+ payment_middleware?: 'stripe' | 'revenuecat'
81
+ payment_product_type?: PaymentProductTypeI
82
+ payment_transaction_id?: string
83
+ // Revenue tracking
84
+ revenue_amount?: number
85
+ currency?: string
86
+ created_by?: 'server' | 'client' | 'unknown'
87
+ }
88
+ }
89
+ export interface Response {
90
+ success: boolean
91
+ event: {
92
+ id: number
93
+ sessionId: number
94
+ createdAt: string
95
+ } & EventDetailsI
96
+ message?: string
97
+ }
98
+ }
99
+
100
+ export namespace GET {
101
+ export interface Request {
102
+ headers: RequestHeaders
103
+ query: {
104
+ session_id?: string
105
+ event_type?: EventType
106
+ feature_name?: string
107
+ campaign_id?: string
108
+ start_date?: string
109
+ end_date?: string
110
+ limit?: number
111
+ offset?: number
112
+ }
113
+ }
114
+ export interface Response {
115
+ success: boolean
116
+ events: Array<
117
+ {
118
+ id: number
119
+ sessionId: number
120
+ event_data?: any
121
+ feature_name?: string
122
+ feature_action?: string
123
+ platform: string
124
+ revenue_amount?: number
125
+ currency?: string
126
+ createdAt: string
127
+ } & EventDetailsI
128
+ >
129
+ total_count: number
130
+ message?: string
131
+ }
132
+ }
133
+ }
134
+ }
@@ -1,12 +1,12 @@
1
- import { TagI } from './tag.d.ts'
2
-
3
- export interface TaggedItemI {
4
- id: number
5
- noteId: number
6
- tagId: number
7
- itemType: 'plant' | 'task'
8
- itemId: number
9
- createdAt: Date
10
- updatedAt: Date
11
- Tag: TagI
12
- }
1
+ import { TagI } from './tag.d.ts'
2
+
3
+ export interface TaggedItemI {
4
+ id: number
5
+ noteId: number
6
+ tagId: number
7
+ itemType: 'plant' | 'task'
8
+ itemId: number
9
+ createdAt: Date
10
+ updatedAt: Date
11
+ Tag: TagI
12
+ }
package/src/task.d.ts CHANGED
@@ -1,40 +1,40 @@
1
- export interface TaskI {
2
- id: number
3
- name: string
4
- startDate: Date
5
- endDate?: Date
6
- /**
7
- * ColourCode of the task
8
- * Ex: #ffffff
9
- */
10
- colourCode: string
11
- iconName?: string
12
- private: boolean
13
- }
14
-
15
- /**
16
- * Represents predefined task tags used in the task creation/modification form.
17
- * There are just a few Tasks that have their own tags
18
- * and they just have a name a colourCode and an optional iconName similar to the Task they represent
19
- */
20
- export interface TaskTagI {
21
- name: string
22
- /**
23
- * ColourCode of the task
24
- * Ex: #ffffff
25
- */
26
- colourCode: string
27
- iconName?: string
28
- }
29
-
30
- /**
31
- * Data used to create or edit a task
32
- */
33
- export interface TaskFormDataI {
34
- name: string
35
- startDate: Date
36
- endDate?: Date
37
- colourCode: string
38
- iconName?: string
39
- private: boolean
40
- }
1
+ export interface TaskI {
2
+ id: number
3
+ name: string
4
+ startDate: Date
5
+ endDate?: Date
6
+ /**
7
+ * ColourCode of the task
8
+ * Ex: #ffffff
9
+ */
10
+ colourCode: string
11
+ iconName?: string
12
+ private: boolean
13
+ }
14
+
15
+ /**
16
+ * Represents predefined task tags used in the task creation/modification form.
17
+ * There are just a few Tasks that have their own tags
18
+ * and they just have a name a colourCode and an optional iconName similar to the Task they represent
19
+ */
20
+ export interface TaskTagI {
21
+ name: string
22
+ /**
23
+ * ColourCode of the task
24
+ * Ex: #ffffff
25
+ */
26
+ colourCode: string
27
+ iconName?: string
28
+ }
29
+
30
+ /**
31
+ * Data used to create or edit a task
32
+ */
33
+ export interface TaskFormDataI {
34
+ name: string
35
+ startDate: Date
36
+ endDate?: Date
37
+ colourCode: string
38
+ iconName?: string
39
+ private: boolean
40
+ }