hevy-shared 1.0.932 → 1.0.933

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/async.d.ts CHANGED
@@ -34,9 +34,13 @@ export declare const allToResolveOrReject: <T>(promises: Promise<T>[]) => Promis
34
34
  * await handleRejection(fetch('https://hevy.com/blabla'));
35
35
  */
36
36
  export declare const handleRejection: <T>(p: Promise<T>) => Promise<T>;
37
- type MethodDecorator<T> = (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => T>) => void;
38
- export declare function synchronized(queue: boolean): MethodDecorator<Promise<any>>;
39
- export declare function synchronized(queue: boolean, id: any): MethodDecorator<Promise<any>>;
37
+ type Stage3MethodDecorator<T> = (value: (...args: any[]) => T, context: ClassMemberDecoratorContext) => (...args: any[]) => T;
38
+ export declare function _synchronized_3(queue: boolean): Stage3MethodDecorator<Promise<any>>;
39
+ export declare function _synchronized_3(queue: boolean, id: any): Stage3MethodDecorator<Promise<any>>;
40
+ export declare function _synchronized_3(value: (...args: any[]) => any, context: ClassMemberDecoratorContext): void;
41
+ type LegacyMethodDecorator<T> = (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => T>) => void;
42
+ export declare function synchronized(queue: boolean): LegacyMethodDecorator<Promise<any>>;
43
+ export declare function synchronized(queue: boolean, id: any): LegacyMethodDecorator<Promise<any>>;
40
44
  export declare function synchronized(target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>): void;
41
45
  export declare abstract class LockError extends Error {
42
46
  abstract readonly propertyKey: string | symbol;
package/built/async.js CHANGED
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LockError = exports.handleRejection = exports.allToResolveOrReject = void 0;
13
+ exports._synchronized_3 = _synchronized_3;
13
14
  exports.synchronized = synchronized;
14
15
  /**
15
16
  * The difference between this and `Promise.all` is that `Promise.all` rejects
@@ -59,19 +60,35 @@ exports.allToResolveOrReject = allToResolveOrReject;
59
60
  */
60
61
  const handleRejection = (p) => (p.catch(() => { }), p);
61
62
  exports.handleRejection = handleRejection;
63
+ /**
64
+ * Do not use this directly. Use the alias provided by the parent project.
65
+ */
66
+ function _synchronized_3(arg0, arg1) {
67
+ if (typeof arg1 === 'object' &&
68
+ arg1 !== null &&
69
+ 'name' in arg1 &&
70
+ 'access' in arg1) {
71
+ return synchronizedStage3DecoratorFactory(arg0, arg1, true);
72
+ }
73
+ else {
74
+ return function (value, context) {
75
+ return synchronizedStage3DecoratorFactory(value, context, arg0, arg1);
76
+ };
77
+ }
78
+ }
62
79
  function synchronized(arg0, arg1, arg2) {
63
80
  if (arguments.length === 1) {
64
81
  return function (target, propertyKey, descriptor) {
65
- return synchronizedDecoratorFactory(target, propertyKey, descriptor, arg0);
82
+ return synchronizedLegacyDecoratorFactory(target, propertyKey, descriptor, arg0);
66
83
  };
67
84
  }
68
85
  else if (arguments.length === 2) {
69
86
  return function (target, propertyKey, descriptor) {
70
- return synchronizedDecoratorFactory(target, propertyKey, descriptor, arg0, arg1);
87
+ return synchronizedLegacyDecoratorFactory(target, propertyKey, descriptor, arg0, arg1);
71
88
  };
72
89
  }
73
90
  else {
74
- return synchronizedDecoratorFactory(arg0, arg1, arg2, true);
91
+ return synchronizedLegacyDecoratorFactory(arg0, arg1, arg2, true);
75
92
  }
76
93
  }
77
94
  const $queue = Symbol();
@@ -92,10 +109,30 @@ class $LockError extends LockError {
92
109
  this.lockId = lockId;
93
110
  }
94
111
  }
95
- function synchronizedDecoratorFactory(_target, propertyKey, descriptor, wait, id) {
112
+ function synchronizedStage3DecoratorFactory(origFn, context, wait, id) {
113
+ const lockId = arguments.length === 4 ? id : Symbol();
114
+ const propertyKey = context.name;
115
+ return synchronizedDecoratorFactory({
116
+ id,
117
+ lockId,
118
+ origFn,
119
+ propertyKey,
120
+ wait,
121
+ });
122
+ }
123
+ function synchronizedLegacyDecoratorFactory(_target, propertyKey, descriptor, wait, id) {
96
124
  const origFn = descriptor.value;
97
125
  const lockId = arguments.length === 5 ? id : Symbol();
98
- descriptor.value = function (...args) {
126
+ descriptor.value = synchronizedDecoratorFactory({
127
+ id,
128
+ lockId,
129
+ origFn,
130
+ propertyKey,
131
+ wait,
132
+ });
133
+ }
134
+ function synchronizedDecoratorFactory({ id, lockId, origFn, propertyKey, wait, }) {
135
+ return function (...args) {
99
136
  return __awaiter(this, void 0, void 0, function* () {
100
137
  var _a, _b;
101
138
  var _c;
package/built/index.d.ts CHANGED
@@ -111,7 +111,6 @@ export interface UserAccountResponse {
111
111
  email_verified: boolean;
112
112
  height_cm?: number;
113
113
  is_hevy_trainer_user: boolean;
114
- trainer_program_updated_at?: string;
115
114
  }
116
115
  export interface CoachAppPushTarget {
117
116
  type: 'android' | 'ios';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.932",
3
+ "version": "1.0.933",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",