hevy-shared 1.0.904 → 1.0.906
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/built/API/APIClient.d.ts +1 -4
- package/built/API/APIClient.js +0 -9
- package/built/API/types.d.ts +0 -2
- package/built/index.d.ts +14 -1
- package/package.json +1 -1
package/built/API/APIClient.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientAuthToken, DeepReadonly } from '..';
|
|
2
|
-
import { RequestConfig, HTTPResponse, HTTPClient,
|
|
2
|
+
import { RequestConfig, HTTPResponse, HTTPClient, HTTPErrorHandler } from './types';
|
|
3
3
|
interface HevyAPIClientConfig<UserContext> {
|
|
4
4
|
/**
|
|
5
5
|
* How long before predicted token expiry to request a new token. We request
|
|
@@ -90,7 +90,6 @@ export declare class HevyAPIClient<UserContext = never> {
|
|
|
90
90
|
private static readonly DEFAULT_TOKEN_REFRESH_THROTTLE_MS;
|
|
91
91
|
private static readonly DEFAULT_REFRESH_AUTH_TOKEN_API_ENDPOINT;
|
|
92
92
|
private readonly _config;
|
|
93
|
-
private _responseHandlers;
|
|
94
93
|
private _errorHandlers;
|
|
95
94
|
private _authTokenFactory;
|
|
96
95
|
private _legacyAuthToken;
|
|
@@ -124,8 +123,6 @@ export declare class HevyAPIClient<UserContext = never> {
|
|
|
124
123
|
clearAuthToken(): Promise<void>;
|
|
125
124
|
get isAuthenticated(): boolean;
|
|
126
125
|
markSessionDeleted(): void;
|
|
127
|
-
attachResponseHandler(onResponse: HTTPResponseHandler): void;
|
|
128
|
-
removeResponseHandlers(): void;
|
|
129
126
|
attachErrorHandler(onError: HTTPErrorHandler<{
|
|
130
127
|
willRetry: boolean;
|
|
131
128
|
isTokenRefreshedAfterRequest: boolean;
|
package/built/API/APIClient.js
CHANGED
|
@@ -20,7 +20,6 @@ const __1 = require("..");
|
|
|
20
20
|
const types_1 = require("./types");
|
|
21
21
|
class HevyAPIClient {
|
|
22
22
|
constructor(httpClient, config) {
|
|
23
|
-
this._responseHandlers = [];
|
|
24
23
|
this._errorHandlers = [];
|
|
25
24
|
this._authTokenFactory = {
|
|
26
25
|
type: 'value',
|
|
@@ -146,11 +145,9 @@ class HevyAPIClient {
|
|
|
146
145
|
response,
|
|
147
146
|
});
|
|
148
147
|
}
|
|
149
|
-
this._responseHandlers.forEach((cb) => cb({ isSuccess: true, value: response }, request));
|
|
150
148
|
return response;
|
|
151
149
|
}
|
|
152
150
|
catch (e) {
|
|
153
|
-
this._responseHandlers.forEach((cb) => cb({ isSuccess: false, error: e }, request));
|
|
154
151
|
if (!(0, types_1.isHTTPError)(e))
|
|
155
152
|
throw e;
|
|
156
153
|
const { response } = e;
|
|
@@ -241,12 +238,6 @@ class HevyAPIClient {
|
|
|
241
238
|
markSessionDeleted() {
|
|
242
239
|
this._lastSessionDelete = new Date();
|
|
243
240
|
}
|
|
244
|
-
attachResponseHandler(onResponse) {
|
|
245
|
-
this._responseHandlers.push(onResponse);
|
|
246
|
-
}
|
|
247
|
-
removeResponseHandlers() {
|
|
248
|
-
this._responseHandlers.length = 0;
|
|
249
|
-
}
|
|
250
241
|
attachErrorHandler(onError) {
|
|
251
242
|
this._errorHandlers.push(onError);
|
|
252
243
|
}
|
package/built/API/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Result } from '..';
|
|
2
1
|
export interface HTTPClient {
|
|
3
2
|
get<T>(url: string, config?: RequestConfig): Promise<HTTPResponse<T>>;
|
|
4
3
|
delete<T>(url: string, config?: RequestConfig): Promise<HTTPResponse<T>>;
|
|
@@ -23,7 +22,6 @@ export interface HTTPRequestFactory<T = unknown> {
|
|
|
23
22
|
headers: Record<string, string>;
|
|
24
23
|
try(): Promise<HTTPResponse<T>>;
|
|
25
24
|
}
|
|
26
|
-
export type HTTPResponseHandler<T = unknown, R = unknown> = (response: Result<HTTPResponse<T>>, request: HTTPRequestFactory<R>) => void;
|
|
27
25
|
export type HTTPErrorHandler<E, T = unknown, R = unknown> = (response: HTTPResponse<T>, request: HTTPRequestFactory<R>, extraData: E) => void;
|
|
28
26
|
export interface HTTPResponse<T = unknown> {
|
|
29
27
|
status: number;
|
package/built/index.d.ts
CHANGED
|
@@ -246,7 +246,8 @@ export interface UsernameAvailabilityResponse {
|
|
|
246
246
|
isAvailable: boolean;
|
|
247
247
|
suggestions: string[];
|
|
248
248
|
}
|
|
249
|
-
export interface CoachLoginResult
|
|
249
|
+
export interface CoachLoginResult {
|
|
250
|
+
auth_token: string;
|
|
250
251
|
is_first_login_to_coach_platform: boolean;
|
|
251
252
|
}
|
|
252
253
|
export interface CoachSocialLoginResult extends SocialLoginResult {
|
|
@@ -1914,3 +1915,15 @@ export interface ExerciseHistoryWorkout {
|
|
|
1914
1915
|
export declare const supportedScopes: readonly ["read-workout", "modify-workout", "read-routine", "modify-routine", "unrestricted"];
|
|
1915
1916
|
export type OAuthScope = Lookup<typeof supportedScopes>;
|
|
1916
1917
|
export declare const isOAuthScope: (x: string) => x is OAuthScope;
|
|
1918
|
+
export interface MuscleGroupSetCount {
|
|
1919
|
+
muscleGroup: MuscleGroup;
|
|
1920
|
+
sets: number;
|
|
1921
|
+
}
|
|
1922
|
+
export interface WorkoutsWithMediaBackofficeResponse {
|
|
1923
|
+
username: string;
|
|
1924
|
+
workouts: {
|
|
1925
|
+
id: string;
|
|
1926
|
+
name: string;
|
|
1927
|
+
media: WorkoutMedia[];
|
|
1928
|
+
}[];
|
|
1929
|
+
}
|