hackathon-care-fe-sdk 0.0.1 → 0.0.2

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.
@@ -10,185 +10,214 @@ import type { AxiosRequestConfig, AxiosResponse } from "axios";
10
10
  export interface ErrorResponse {
11
11
  message: string;
12
12
  }
13
- export interface Onboarding {
14
- id: number;
15
- step: number;
16
- /** Unix timestamp (seconds) */
17
- created_at: number;
18
- /** Unix timestamp (seconds) */
19
- updated_at: number;
20
- }
21
- export interface OnboardingUpdateRequest {
22
- step: number;
23
- }
24
- export interface Photo {
25
- id: number;
26
- user_id: number;
27
- /** Storage path for the uploaded file */
28
- path: string;
29
- /** Unix timestamp (seconds) */
30
- created_at: number;
31
- /** Unix timestamp (seconds) */
32
- updated_at: number;
33
- }
34
- export interface PhotoListResponse {
35
- photos: Photo[];
36
- }
13
+ export type DetectionsItemBox = {
14
+ ltx: number;
15
+ lty: number;
16
+ rbx: number;
17
+ rby: number;
18
+ };
19
+ export type DetectionsItem = {
20
+ box: DetectionsItemBox;
21
+ confidence: number;
22
+ class_id: number;
23
+ class_name: string;
24
+ };
25
+ export type Detections = DetectionsItem[];
26
+ export type NullableDetectionsItemBox = {
27
+ ltx: number;
28
+ lty: number;
29
+ rbx: number;
30
+ rby: number;
31
+ };
32
+ export type NullableDetectionsItem = {
33
+ box: NullableDetectionsItemBox;
34
+ confidence: number;
35
+ class_id: number;
36
+ class_name: string;
37
+ };
38
+ /**
39
+ * @nullable
40
+ */
41
+ export type NullableDetections = NullableDetectionsItem[] | null;
42
+ export type AnalysisSkinType = (typeof AnalysisSkinType)[keyof typeof AnalysisSkinType];
43
+ export declare const AnalysisSkinType: {
44
+ readonly oily: "oily";
45
+ readonly dry: "dry";
46
+ readonly normal: "normal";
47
+ readonly sensitive: "sensitive";
48
+ };
49
+ export type AnalysisStress = (typeof AnalysisStress)[keyof typeof AnalysisStress];
50
+ export declare const AnalysisStress: {
51
+ readonly low: "low";
52
+ readonly mid: "mid";
53
+ readonly high: "high";
54
+ };
55
+ /**
56
+ * усталость
57
+ */
58
+ export type AnalysisFatigue = (typeof AnalysisFatigue)[keyof typeof AnalysisFatigue];
59
+ export declare const AnalysisFatigue: {
60
+ readonly low: "low";
61
+ readonly mid: "mid";
62
+ readonly high: "high";
63
+ };
64
+ /**
65
+ * тревожность
66
+ */
67
+ export type AnalysisAnxiety = (typeof AnalysisAnxiety)[keyof typeof AnalysisAnxiety];
68
+ export declare const AnalysisAnxiety: {
69
+ readonly low: "low";
70
+ readonly mid: "mid";
71
+ readonly high: "high";
72
+ };
73
+ export type AnalysisEyes = {
74
+ yellowing: boolean;
75
+ redness: boolean;
76
+ dark_circles: boolean;
77
+ general_tone: number;
78
+ };
37
79
  export interface Analysis {
38
80
  id: number;
39
81
  photo_id: number;
40
- skin_type: string;
41
- cancer: string;
42
- diseases: string[];
82
+ skin_type: AnalysisSkinType;
83
+ stress: AnalysisStress;
84
+ /** усталость */
85
+ fatigue: AnalysisFatigue;
86
+ /** тревожность */
87
+ anxiety: AnalysisAnxiety;
88
+ hydration: boolean;
89
+ general_tone: number;
90
+ diseases: Detections;
91
+ problems: Detections;
92
+ eyes: AnalysisEyes;
43
93
  /** Unix timestamp (seconds) */
44
94
  created_at: number;
45
95
  /** Unix timestamp (seconds) */
46
96
  updated_at: number;
47
97
  }
98
+ /**
99
+ * @nullable
100
+ */
101
+ export type PartialAnalysisSkinType = (typeof PartialAnalysisSkinType)[keyof typeof PartialAnalysisSkinType] | null;
102
+ export declare const PartialAnalysisSkinType: {
103
+ readonly oily: "oily";
104
+ readonly dry: "dry";
105
+ readonly normal: "normal";
106
+ readonly sensitive: "sensitive";
107
+ };
108
+ /**
109
+ * @nullable
110
+ */
111
+ export type PartialAnalysisStress = (typeof PartialAnalysisStress)[keyof typeof PartialAnalysisStress] | null;
112
+ export declare const PartialAnalysisStress: {
113
+ readonly low: "low";
114
+ readonly mid: "mid";
115
+ readonly high: "high";
116
+ };
117
+ /**
118
+ * усталость
119
+ * @nullable
120
+ */
121
+ export type PartialAnalysisFatigue = (typeof PartialAnalysisFatigue)[keyof typeof PartialAnalysisFatigue] | null;
122
+ export declare const PartialAnalysisFatigue: {
123
+ readonly low: "low";
124
+ readonly mid: "mid";
125
+ readonly high: "high";
126
+ };
127
+ /**
128
+ * тревожность
129
+ * @nullable
130
+ */
131
+ export type PartialAnalysisAnxiety = (typeof PartialAnalysisAnxiety)[keyof typeof PartialAnalysisAnxiety] | null;
132
+ export declare const PartialAnalysisAnxiety: {
133
+ readonly low: "low";
134
+ readonly mid: "mid";
135
+ readonly high: "high";
136
+ };
137
+ export type PartialAnalysisEyes = {
138
+ /** @nullable */
139
+ yellowing: boolean | null;
140
+ /** @nullable */
141
+ redness: boolean | null;
142
+ /** @nullable */
143
+ dark_circles: boolean | null;
144
+ /** @nullable */
145
+ general_tone: number | null;
146
+ };
48
147
  export interface PartialAnalysis {
49
- id?: number;
148
+ id: number;
50
149
  photo_id: number;
51
150
  /** @nullable */
52
- skin_type: string | null;
151
+ skin_type: PartialAnalysisSkinType;
152
+ /** @nullable */
153
+ stress: PartialAnalysisStress;
154
+ /**
155
+ * усталость
156
+ * @nullable
157
+ */
158
+ fatigue: PartialAnalysisFatigue;
159
+ /**
160
+ * тревожность
161
+ * @nullable
162
+ */
163
+ anxiety: PartialAnalysisAnxiety;
53
164
  /** @nullable */
54
- cancer: string | null;
165
+ hydration: boolean | null;
166
+ general_tone: number;
55
167
  /** @nullable */
56
- diseases: string[] | null;
57
- /** Unix timestamp (seconds) */
58
- created_at: number;
59
- /** Unix timestamp (seconds) */
60
- updated_at: number;
61
- }
62
- export interface SkinDisease {
63
- id: number;
64
- analysis_id: number;
65
- name: string;
66
- left_top_dot_x: number;
67
- left_top_dot_y: number;
68
- right_bottom_dot_x: number;
69
- right_bottom_dot_y: number;
168
+ diseases: NullableDetections;
169
+ /** @nullable */
170
+ problems: NullableDetections;
171
+ eyes: PartialAnalysisEyes;
70
172
  /** Unix timestamp (seconds) */
71
173
  created_at: number;
72
174
  /** Unix timestamp (seconds) */
73
175
  updated_at: number;
74
176
  }
75
- export interface AnalysisResponse {
76
- analysis: Analysis;
77
- skin_diseases: SkinDisease[];
78
- }
79
- export interface PartialAnalysisResponse {
80
- analysis: PartialAnalysis;
81
- /** @nullable */
82
- skin_diseases: SkinDisease[] | null;
83
- }
84
177
  export interface AnalysisStartRequest {
85
- photo_id: number;
178
+ image: Blob;
86
179
  }
87
180
  export interface AnalysisStartResponse {
88
181
  started: boolean;
89
- photo_id?: number;
182
+ analysis_id: number;
90
183
  }
91
184
  export type AnalysisStatusResponseOneOf = {
92
185
  ready: boolean;
93
- analysis: AnalysisResponse;
186
+ analysis: Analysis;
94
187
  };
95
188
  export type AnalysisStatusResponseOneOfTwo = {
96
189
  ready: boolean;
97
- analysis: PartialAnalysisResponse;
190
+ analysis: PartialAnalysis;
98
191
  };
99
192
  export type AnalysisStatusResponse = AnalysisStatusResponseOneOf | AnalysisStatusResponseOneOfTwo;
100
- export interface ReportResponse {
101
- [key: string]: unknown;
102
- }
103
- export interface StreakResponse {
104
- /** Number of consecutive days with activity */
105
- days: number;
106
- /** Whether the streak is failed */
107
- is_failed: boolean;
108
- }
109
193
  /**
110
194
  * Photo identifier
111
195
  */
112
- export type PhotoIdQueryParameter = number;
113
- export type GetPhotoByIdParams = {
114
- /**
115
- * Photo identifier
116
- */
117
- photo_id: PhotoIdQueryParameter;
118
- };
119
- export type UploadPhotoBody = {
120
- file: Blob;
121
- };
122
- export type GetPhotoAnalysisParams = {
196
+ export type AnalysisIdQueryParameter = number;
197
+ export type GetAnalysisParams = {
123
198
  /**
124
199
  * Photo identifier
125
200
  */
126
- photo_id: PhotoIdQueryParameter;
201
+ analysis_id: AnalysisIdQueryParameter;
127
202
  };
128
203
  export type GetAnalysisStatusParams = {
129
204
  /**
130
205
  * Photo identifier
131
206
  */
132
- photo_id: PhotoIdQueryParameter;
133
- };
134
- export type GetReportByPhotoIdParams = {
135
- /**
136
- * Photo identifier
137
- */
138
- photo_id: PhotoIdQueryParameter;
207
+ analysis_id: AnalysisIdQueryParameter;
139
208
  };
140
209
  /**
141
- * @summary Get onboarding state
142
- */
143
- export declare const getOnboarding: <TData = AxiosResponse<Onboarding>>(options?: AxiosRequestConfig) => Promise<TData>;
144
- /**
145
- * @summary Update onboarding step
146
- */
147
- export declare const updateOnboarding: <TData = AxiosResponse<Onboarding>>(onboardingUpdateRequest: OnboardingUpdateRequest, options?: AxiosRequestConfig) => Promise<TData>;
148
- /**
149
- * @summary Get photo metadata
210
+ * @summary Get finished analysis per photo
150
211
  */
151
- export declare const getPhotoById: <TData = AxiosResponse<Photo>>(params: GetPhotoByIdParams, options?: AxiosRequestConfig) => Promise<TData>;
152
- /**
153
- * @summary Upload a new photo
154
- */
155
- export declare const uploadPhoto: <TData = AxiosResponse<Photo>>(uploadPhotoBody: UploadPhotoBody, options?: AxiosRequestConfig) => Promise<TData>;
156
- /**
157
- * @summary List user's photos (gallery)
158
- */
159
- export declare const listPhotos: <TData = AxiosResponse<PhotoListResponse>>(options?: AxiosRequestConfig) => Promise<TData>;
160
- /**
161
- * @summary Get finished analysis for a photo
162
- */
163
- export declare const getPhotoAnalysis: <TData = AxiosResponse<AnalysisResponse>>(params: GetPhotoAnalysisParams, options?: AxiosRequestConfig) => Promise<TData>;
212
+ export declare const getAnalysis: <TData = AxiosResponse<Analysis>>(params: GetAnalysisParams, options?: AxiosRequestConfig) => Promise<TData>;
164
213
  /**
165
214
  * @summary Start processing analysis for a photo
166
215
  */
167
216
  export declare const startAnalysis: <TData = AxiosResponse<AnalysisStartResponse>>(analysisStartRequest: AnalysisStartRequest, options?: AxiosRequestConfig) => Promise<TData>;
168
217
  /**
169
- * @summary Get analysis processing status
218
+ * @summary Get analysis processing status (чтобы полить)
170
219
  */
171
220
  export declare const getAnalysisStatus: <TData = AxiosResponse<AnalysisStatusResponse>>(params: GetAnalysisStatusParams, options?: AxiosRequestConfig) => Promise<TData>;
172
- /**
173
- * @summary Get latest analysis (current state)
174
- */
175
- export declare const getLatestAnalysis: <TData = AxiosResponse<AnalysisResponse>>(options?: AxiosRequestConfig) => Promise<TData>;
176
- /**
177
- * @summary Get report for a specific photo (xlsx file)
178
- */
179
- export declare const getReportByPhotoId: <TData = AxiosResponse<ReportResponse>>(params: GetReportByPhotoIdParams, options?: AxiosRequestConfig) => Promise<TData>;
180
- /**
181
- * @summary Get current streak in days
182
- */
183
- export declare const getStreak: <TData = AxiosResponse<StreakResponse>>(options?: AxiosRequestConfig) => Promise<TData>;
184
- export type GetOnboardingResult = AxiosResponse<Onboarding>;
185
- export type UpdateOnboardingResult = AxiosResponse<Onboarding>;
186
- export type GetPhotoByIdResult = AxiosResponse<Photo>;
187
- export type UploadPhotoResult = AxiosResponse<Photo>;
188
- export type ListPhotosResult = AxiosResponse<PhotoListResponse>;
189
- export type GetPhotoAnalysisResult = AxiosResponse<AnalysisResponse>;
221
+ export type GetAnalysisResult = AxiosResponse<Analysis>;
190
222
  export type StartAnalysisResult = AxiosResponse<AnalysisStartResponse>;
191
223
  export type GetAnalysisStatusResult = AxiosResponse<AnalysisStatusResponse>;
192
- export type GetLatestAnalysisResult = AxiosResponse<AnalysisResponse>;
193
- export type GetReportByPhotoIdResult = AxiosResponse<ReportResponse>;
194
- export type GetStreakResult = AxiosResponse<StreakResponse>;
@@ -7,45 +7,60 @@
7
7
  * OpenAPI spec version: 1.0.0
8
8
  */
9
9
  import axios from "axios";
10
- /**
11
- * @summary Get onboarding state
12
- */
13
- export const getOnboarding = (options) => {
14
- return axios.get(`/onboarding`, options);
10
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
11
+ export const AnalysisSkinType = {
12
+ oily: "oily",
13
+ dry: "dry",
14
+ normal: "normal",
15
+ sensitive: "sensitive",
15
16
  };
16
- /**
17
- * @summary Update onboarding step
18
- */
19
- export const updateOnboarding = (onboardingUpdateRequest, options) => {
20
- return axios.put(`/onboarding`, onboardingUpdateRequest, options);
17
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
18
+ export const AnalysisStress = {
19
+ low: "low",
20
+ mid: "mid",
21
+ high: "high",
21
22
  };
22
- /**
23
- * @summary Get photo metadata
24
- */
25
- export const getPhotoById = (params, options) => {
26
- return axios.get(`/photo`, {
27
- ...options,
28
- params: { ...params, ...options?.params },
29
- });
23
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
24
+ export const AnalysisFatigue = {
25
+ low: "low",
26
+ mid: "mid",
27
+ high: "high",
30
28
  };
31
- /**
32
- * @summary Upload a new photo
33
- */
34
- export const uploadPhoto = (uploadPhotoBody, options) => {
35
- const formData = new FormData();
36
- formData.append(`file`, uploadPhotoBody.file);
37
- return axios.post(`/photo`, formData, options);
29
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
30
+ export const AnalysisAnxiety = {
31
+ low: "low",
32
+ mid: "mid",
33
+ high: "high",
38
34
  };
39
- /**
40
- * @summary List user's photos (gallery)
41
- */
42
- export const listPhotos = (options) => {
43
- return axios.get(`/photo/all`, options);
35
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
36
+ export const PartialAnalysisSkinType = {
37
+ oily: "oily",
38
+ dry: "dry",
39
+ normal: "normal",
40
+ sensitive: "sensitive",
41
+ };
42
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
43
+ export const PartialAnalysisStress = {
44
+ low: "low",
45
+ mid: "mid",
46
+ high: "high",
47
+ };
48
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
49
+ export const PartialAnalysisFatigue = {
50
+ low: "low",
51
+ mid: "mid",
52
+ high: "high",
53
+ };
54
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
55
+ export const PartialAnalysisAnxiety = {
56
+ low: "low",
57
+ mid: "mid",
58
+ high: "high",
44
59
  };
45
60
  /**
46
- * @summary Get finished analysis for a photo
61
+ * @summary Get finished analysis per photo
47
62
  */
48
- export const getPhotoAnalysis = (params, options) => {
63
+ export const getAnalysis = (params, options) => {
49
64
  return axios.get(`/analysis`, {
50
65
  ...options,
51
66
  params: { ...params, ...options?.params },
@@ -55,10 +70,12 @@ export const getPhotoAnalysis = (params, options) => {
55
70
  * @summary Start processing analysis for a photo
56
71
  */
57
72
  export const startAnalysis = (analysisStartRequest, options) => {
58
- return axios.post(`/analysis/start`, analysisStartRequest, options);
73
+ const formData = new FormData();
74
+ formData.append(`image`, analysisStartRequest.image);
75
+ return axios.post(`/analysis/start`, formData, options);
59
76
  };
60
77
  /**
61
- * @summary Get analysis processing status
78
+ * @summary Get analysis processing status (чтобы полить)
62
79
  */
63
80
  export const getAnalysisStatus = (params, options) => {
64
81
  return axios.get(`/analysis/status`, {
@@ -66,24 +83,3 @@ export const getAnalysisStatus = (params, options) => {
66
83
  params: { ...params, ...options?.params },
67
84
  });
68
85
  };
69
- /**
70
- * @summary Get latest analysis (current state)
71
- */
72
- export const getLatestAnalysis = (options) => {
73
- return axios.get(`/analysis/latest`, options);
74
- };
75
- /**
76
- * @summary Get report for a specific photo (xlsx file)
77
- */
78
- export const getReportByPhotoId = (params, options) => {
79
- return axios.get(`/report`, {
80
- ...options,
81
- params: { ...params, ...options?.params },
82
- });
83
- };
84
- /**
85
- * @summary Get current streak in days
86
- */
87
- export const getStreak = (options) => {
88
- return axios.get(`/streak`, options);
89
- };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { readFileSync, writeFileSync } from "fs";
2
+ import { join } from "path";
3
+ // Simple script to bump patch version in package.json
4
+ const pkgPath = join(process.cwd(), "package.json");
5
+ const pkgRaw = readFileSync(pkgPath, "utf8");
6
+ const pkg = JSON.parse(pkgRaw);
7
+ if (typeof pkg.version !== "string") {
8
+ console.error("No version field found in package.json");
9
+ process.exit(1);
10
+ }
11
+ const verParts = pkg.version.split(".").map(Number);
12
+ if (verParts.length !== 3 || verParts.some(isNaN)) {
13
+ console.error("Version is not of the form x.y.z");
14
+ process.exit(1);
15
+ }
16
+ // Patch bump
17
+ verParts[2] += 1;
18
+ pkg.version = verParts.join(".");
19
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, 4) + "\n");
20
+ console.log(`Version bumped to ${pkg.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hackathon-care-fe-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "type": "module",
@@ -27,6 +27,7 @@
27
27
  "axios": "1.12.2"
28
28
  },
29
29
  "devDependencies": {
30
+ "tsx": "4.20.4",
30
31
  "typescript": "5.8.3"
31
32
  },
32
33
  "scripts": {