hevy-shared 1.0.830 → 1.0.832

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.
@@ -48,11 +48,9 @@ class HevyAPIClient {
48
48
  }
49
49
  }
50
50
  get _authHeaders() {
51
- return this._authToken
51
+ return Object.assign(Object.assign({}, (this._authToken
52
52
  ? { authorization: `Bearer ${this._authToken.access_token}` }
53
- : this._legacyAuthToken
54
- ? { 'auth-token': this._legacyAuthToken }
55
- : null;
53
+ : {})), (this._legacyAuthToken ? { 'auth-token': this._legacyAuthToken } : {}));
56
54
  }
57
55
  refreshExpiredAuthToken() {
58
56
  return __awaiter(this, void 0, void 0, function* () {
package/built/async.d.ts CHANGED
@@ -38,4 +38,9 @@ type MethodDecorator<T> = (target: unknown, propertyKey: string | symbol, descri
38
38
  export declare function synchronized(queue: boolean): MethodDecorator<Promise<any>>;
39
39
  export declare function synchronized(queue: boolean, id: any): MethodDecorator<Promise<any>>;
40
40
  export declare function synchronized(target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>): void;
41
+ export declare abstract class LockError extends Error {
42
+ abstract readonly propertyKey: string | symbol;
43
+ abstract readonly lockId: unknown;
44
+ protected constructor(...args: any);
45
+ }
41
46
  export {};
package/built/async.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.handleRejection = exports.allToResolveOrReject = void 0;
12
+ exports.LockError = exports.handleRejection = exports.allToResolveOrReject = void 0;
13
13
  exports.synchronized = synchronized;
14
14
  /**
15
15
  * The difference between this and `Promise.all` is that `Promise.all` rejects
@@ -75,7 +75,24 @@ function synchronized(arg0, arg1, arg2) {
75
75
  }
76
76
  }
77
77
  const $queue = Symbol();
78
- function synchronizedDecoratorFactory(_target, _propertyKey, descriptor, wait, id) {
78
+ class LockError extends Error {
79
+ constructor(...args) {
80
+ super(...args);
81
+ }
82
+ }
83
+ exports.LockError = LockError;
84
+ class $LockError extends LockError {
85
+ constructor({ message: baseMessage, propertyKey, lockId, }) {
86
+ const formattedLockId = lockId !== undefined ? `"${String(lockId)}"` : '(anonymous)';
87
+ const message = `Cannot invoke "${String(propertyKey)}" (locked by ${formattedLockId}): ${baseMessage}`;
88
+ super(message);
89
+ this.name = 'LockError';
90
+ this.message = message;
91
+ this.propertyKey = propertyKey;
92
+ this.lockId = lockId;
93
+ }
94
+ }
95
+ function synchronizedDecoratorFactory(_target, propertyKey, descriptor, wait, id) {
79
96
  const origFn = descriptor.value;
80
97
  const lockId = arguments.length === 5 ? id : Symbol();
81
98
  descriptor.value = function (...args) {
@@ -84,7 +101,11 @@ function synchronizedDecoratorFactory(_target, _propertyKey, descriptor, wait, i
84
101
  var _c;
85
102
  const queue = ((_b = (_c = ((_a = this[$queue]) !== null && _a !== void 0 ? _a : (this[$queue] = {})))[lockId]) !== null && _b !== void 0 ? _b : (_c[lockId] = []));
86
103
  if (queue.length > 0 && !wait) {
87
- throw new Error('Operation is already in progress');
104
+ throw new $LockError({
105
+ message: 'Operation is already in progress',
106
+ propertyKey,
107
+ lockId: id,
108
+ });
88
109
  }
89
110
  let done;
90
111
  const thisCall = new Promise((resolve) => {
@@ -100,7 +121,11 @@ function synchronizedDecoratorFactory(_target, _propertyKey, descriptor, wait, i
100
121
  done();
101
122
  if (queue.shift() !== thisCall) {
102
123
  // eslint-disable-next-line no-unsafe-finally
103
- throw new Error('Assertion failed: @synchronized queue is mangled');
124
+ throw new $LockError({
125
+ message: 'Assertion failed: @synchronized queue is mangled',
126
+ propertyKey,
127
+ lockId: id,
128
+ });
104
129
  }
105
130
  }
106
131
  });
package/built/index.d.ts CHANGED
@@ -210,7 +210,7 @@ export interface GoogleSignUpRequest {
210
210
  source?: 'web';
211
211
  gympassUserId?: string;
212
212
  }
213
- export interface SocialLoginResult {
213
+ export interface SocialLoginResult extends ClientAuthTokenResponse {
214
214
  auth_token: string;
215
215
  username: string;
216
216
  user_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.830",
3
+ "version": "1.0.832",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",