@pear-protocol/types 1.11.0 → 1.13.0

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.
@@ -23,7 +23,11 @@ export declare const RefreshTokenResponse: z.ZodObject<{
23
23
  tokenType: z.ZodLiteral<"Bearer">;
24
24
  expiresIn: z.ZodNumber;
25
25
  }, z.core.$strip>;
26
- export declare const RefreshSessionResponse: z.ZodVoid;
26
+ export declare const RefreshSessionResponse: z.ZodObject<{
27
+ accessToken: z.ZodString;
28
+ tokenType: z.ZodLiteral<"Bearer">;
29
+ expiresIn: z.ZodNumber;
30
+ }, z.core.$strip>;
27
31
  export declare const LogoutResponse: z.ZodVoid;
28
32
  export declare const RegisterEmailResponse: z.ZodVoid;
29
33
  export declare const VerifyEmailResponse: z.ZodVoid;
@@ -12,7 +12,11 @@ const RefreshTokenResponse = z.object({
12
12
  tokenType: z.literal("Bearer").describe('Token type (always "Bearer")'),
13
13
  expiresIn: z.number().int().positive().describe("Access token expiry time in seconds")
14
14
  }).describe("Successful token refresh response");
15
- const RefreshSessionResponse = z.void().describe("Successful session refresh response");
15
+ const RefreshSessionResponse = z.object({
16
+ accessToken: z.string().describe("New JWT access token"),
17
+ tokenType: z.literal("Bearer").describe('Token type (always "Bearer")'),
18
+ expiresIn: z.number().int().positive().describe("Access token expiry time in seconds")
19
+ }).describe("Successful session refresh response");
16
20
  const LogoutResponse = z.void().describe("Successful logout response");
17
21
  const RegisterEmailResponse = z.void().describe("Successful email registration response");
18
22
  const VerifyEmailResponse = z.void().describe("Successful email verification response");
@@ -82,6 +82,7 @@ export declare const Position: z.ZodObject<{
82
82
  EXTERNAL: "EXTERNAL";
83
83
  }>;
84
84
  exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
85
+ unstableHistoricalData: z.ZodBoolean;
85
86
  totalFundingPayment: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
86
87
  closedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
88
  initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
@@ -36,6 +36,10 @@ const Position = z.object({
36
36
  * Position exposure
37
37
  */
38
38
  exposure: PositionExposure,
39
+ /**
40
+ * Whether a backfilled fill invalidated historical metrics derived from this position.
41
+ */
42
+ unstableHistoricalData: z.boolean(),
39
43
  totalFundingPayment: PositionTotalFundingPayment,
40
44
  /**
41
45
  * Closed at timestamp
@@ -27,6 +27,7 @@ export declare const PositionListResponse: z.ZodObject<{
27
27
  EXTERNAL: "EXTERNAL";
28
28
  }>;
29
29
  exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
30
+ unstableHistoricalData: z.ZodBoolean;
30
31
  totalFundingPayment: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
31
32
  closedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
33
  initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
@@ -4,6 +4,12 @@ export declare const AutoRebalanceStatus: z.ZodEnum<{
4
4
  PAUSED: "PAUSED";
5
5
  }>;
6
6
  export type AutoRebalanceStatus = z.infer<typeof AutoRebalanceStatus>;
7
+ export declare const AutoRebalancePausedReason: z.ZodEnum<{
8
+ USER: "USER";
9
+ POSITION_CHANGED: "POSITION_CHANGED";
10
+ REPEATED_FAILURES: "REPEATED_FAILURES";
11
+ }>;
12
+ export type AutoRebalancePausedReason = z.infer<typeof AutoRebalancePausedReason>;
7
13
  export declare const AutoRebalanceWeightSource: z.ZodEnum<{
8
14
  INITIAL_WEIGHT: "INITIAL_WEIGHT";
9
15
  LIVE_BETA: "LIVE_BETA";
@@ -29,6 +35,11 @@ export declare const AutoRebalanceConfig: z.ZodObject<{
29
35
  ACTIVE: "ACTIVE";
30
36
  PAUSED: "PAUSED";
31
37
  }>;
38
+ pausedReason: z.ZodOptional<z.ZodEnum<{
39
+ USER: "USER";
40
+ POSITION_CHANGED: "POSITION_CHANGED";
41
+ REPEATED_FAILURES: "REPEATED_FAILURES";
42
+ }>>;
32
43
  weightSource: z.ZodEnum<{
33
44
  INITIAL_WEIGHT: "INITIAL_WEIGHT";
34
45
  LIVE_BETA: "LIVE_BETA";
@@ -3,6 +3,7 @@ import { UnsignedDecimalString } from '../common/schema';
3
3
  import { InstrumentId } from '../instrument';
4
4
 
5
5
  const AutoRebalanceStatus = z.enum(["ACTIVE", "PAUSED"]);
6
+ const AutoRebalancePausedReason = z.enum(["USER", "POSITION_CHANGED", "REPEATED_FAILURES"]);
6
7
  const AutoRebalanceWeightSource = z.enum(["INITIAL_WEIGHT", "LIVE_BETA"]);
7
8
  const AutoRebalanceTimeframe = z.enum(["1h", "4h", "1d"]);
8
9
  const RebalanceEventStatus = z.enum(["SUCCESS", "FAILED"]);
@@ -11,6 +12,7 @@ const AutoRebalanceConfig = z.object({
11
12
  id: z.uuid(),
12
13
  positionId: z.uuid(),
13
14
  status: AutoRebalanceStatus,
15
+ pausedReason: AutoRebalancePausedReason.optional(),
14
16
  weightSource: AutoRebalanceWeightSource,
15
17
  minimumDriftPct: UnsignedDecimalString,
16
18
  timeframe: AutoRebalanceTimeframe.optional(),
@@ -30,4 +32,4 @@ const RebalanceEvent = z.object({
30
32
  createdAt: z.iso.datetime()
31
33
  });
32
34
 
33
- export { AutoRebalanceConfig, AutoRebalanceStatus, AutoRebalanceTimeframe, AutoRebalanceWeightSource, RebalanceEvent, RebalanceEventStatus, WeightMap };
35
+ export { AutoRebalanceConfig, AutoRebalancePausedReason, AutoRebalanceStatus, AutoRebalanceTimeframe, AutoRebalanceWeightSource, RebalanceEvent, RebalanceEventStatus, WeightMap };
@@ -12,26 +12,38 @@ export declare const RebalanceManual: z.ZodObject<{
12
12
  export type RebalanceManual = z.output<typeof RebalanceManual>;
13
13
  declare const CreateInitialWeight: z.ZodObject<{
14
14
  weightSource: z.ZodLiteral<"INITIAL_WEIGHT">;
15
- positionId: z.ZodUUID;
16
15
  minimumDriftPct: z.ZodString;
16
+ positionId: z.ZodUUID;
17
17
  }, z.core.$strip>;
18
18
  declare const CreateLiveBeta: z.ZodObject<{
19
19
  weightSource: z.ZodLiteral<"LIVE_BETA">;
20
- positionId: z.ZodUUID;
21
20
  minimumDriftPct: z.ZodString;
22
21
  timeframe: z.ZodEnum<{
23
22
  "1d": "1d";
24
23
  "1h": "1h";
25
24
  "4h": "4h";
26
25
  }>;
26
+ positionId: z.ZodUUID;
27
27
  }, z.core.$strip>;
28
28
  export declare const CreateAutoRebalanceConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
29
  weightSource: z.ZodLiteral<"INITIAL_WEIGHT">;
30
- positionId: z.ZodUUID;
31
30
  minimumDriftPct: z.ZodString;
31
+ positionId: z.ZodUUID;
32
32
  }, z.core.$strip>, z.ZodObject<{
33
33
  weightSource: z.ZodLiteral<"LIVE_BETA">;
34
+ minimumDriftPct: z.ZodString;
35
+ timeframe: z.ZodEnum<{
36
+ "1d": "1d";
37
+ "1h": "1h";
38
+ "4h": "4h";
39
+ }>;
34
40
  positionId: z.ZodUUID;
41
+ }, z.core.$strip>], "weightSource">;
42
+ export declare const ReplaceAutoRebalanceConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
43
+ weightSource: z.ZodLiteral<"INITIAL_WEIGHT">;
44
+ minimumDriftPct: z.ZodString;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ weightSource: z.ZodLiteral<"LIVE_BETA">;
35
47
  minimumDriftPct: z.ZodString;
36
48
  timeframe: z.ZodEnum<{
37
49
  "1d": "1d";
@@ -54,5 +66,6 @@ export declare const UpdateAutoRebalanceConfig: z.ZodObject<{
54
66
  export type CreateInitialWeight = z.output<typeof CreateInitialWeight>;
55
67
  export type CreateLiveBeta = z.output<typeof CreateLiveBeta>;
56
68
  export type CreateAutoRebalanceConfig = z.output<typeof CreateAutoRebalanceConfig>;
69
+ export type ReplaceAutoRebalanceConfig = z.output<typeof ReplaceAutoRebalanceConfig>;
57
70
  export type UpdateAutoRebalanceConfig = z.output<typeof UpdateAutoRebalanceConfig>;
58
71
  export {};
@@ -22,22 +22,23 @@ const RebalanceManual = z.object({
22
22
  const MinimumDriftPct = UnsignedDecimalString.refine((value) => Number(value) > 0 && Number(value) <= 1, {
23
23
  message: "minimumDriftPct must be greater than 0 and at most 1"
24
24
  });
25
- const CreateInitialWeight = z.object({
25
+ const InitialWeightConfig = z.object({
26
26
  weightSource: z.literal("INITIAL_WEIGHT"),
27
- positionId: z.uuid(),
28
27
  minimumDriftPct: MinimumDriftPct
29
28
  });
30
- const CreateLiveBeta = z.object({
29
+ const LiveBetaConfig = z.object({
31
30
  weightSource: z.literal("LIVE_BETA"),
32
- positionId: z.uuid(),
33
31
  minimumDriftPct: MinimumDriftPct,
34
32
  timeframe: AutoRebalanceTimeframe
35
33
  });
34
+ const CreateInitialWeight = InitialWeightConfig.extend({ positionId: z.uuid() });
35
+ const CreateLiveBeta = LiveBetaConfig.extend({ positionId: z.uuid() });
36
36
  const CreateAutoRebalanceConfig = z.discriminatedUnion("weightSource", [CreateInitialWeight, CreateLiveBeta]);
37
+ const ReplaceAutoRebalanceConfig = z.discriminatedUnion("weightSource", [InitialWeightConfig, LiveBetaConfig]);
37
38
  const UpdateAutoRebalanceConfig = z.object({
38
39
  minimumDriftPct: MinimumDriftPct.optional(),
39
40
  timeframe: AutoRebalanceTimeframe.optional(),
40
41
  status: AutoRebalanceStatus.optional()
41
42
  });
42
43
 
43
- export { CreateAutoRebalanceConfig, RebalanceManual, UpdateAutoRebalanceConfig };
44
+ export { CreateAutoRebalanceConfig, RebalanceManual, ReplaceAutoRebalanceConfig, UpdateAutoRebalanceConfig };
@@ -24,6 +24,11 @@ export declare const AutoRebalanceListResponse: z.ZodObject<{
24
24
  ACTIVE: "ACTIVE";
25
25
  PAUSED: "PAUSED";
26
26
  }>;
27
+ pausedReason: z.ZodOptional<z.ZodEnum<{
28
+ USER: "USER";
29
+ POSITION_CHANGED: "POSITION_CHANGED";
30
+ REPEATED_FAILURES: "REPEATED_FAILURES";
31
+ }>>;
27
32
  weightSource: z.ZodEnum<{
28
33
  INITIAL_WEIGHT: "INITIAL_WEIGHT";
29
34
  LIVE_BETA: "LIVE_BETA";
@@ -47,6 +52,11 @@ export declare const CreateAutoRebalanceResponse: z.ZodObject<{
47
52
  ACTIVE: "ACTIVE";
48
53
  PAUSED: "PAUSED";
49
54
  }>;
55
+ pausedReason: z.ZodOptional<z.ZodEnum<{
56
+ USER: "USER";
57
+ POSITION_CHANGED: "POSITION_CHANGED";
58
+ REPEATED_FAILURES: "REPEATED_FAILURES";
59
+ }>>;
50
60
  weightSource: z.ZodEnum<{
51
61
  INITIAL_WEIGHT: "INITIAL_WEIGHT";
52
62
  LIVE_BETA: "LIVE_BETA";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",