@pear-protocol/types 1.10.0 → 1.12.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.
- package/dist/auth/entities.d.ts +2 -0
- package/dist/auth/entities.js +1 -1
- package/dist/auth/payloads.d.ts +4 -0
- package/dist/auth/payloads.js +6 -1
- package/dist/auth/response.d.ts +42 -0
- package/dist/auth/response.js +27 -1
- package/dist/common/array.d.ts +1 -1
- package/dist/position/entities.d.ts +1 -0
- package/dist/position/entities.js +4 -0
- package/dist/position/responses.d.ts +1 -0
- package/dist/rebalance/entities.d.ts +11 -0
- package/dist/rebalance/entities.js +3 -1
- package/dist/rebalance/payloads.d.ts +16 -3
- package/dist/rebalance/payloads.js +6 -5
- package/dist/rebalance/responses.d.ts +10 -0
- package/package.json +1 -1
package/dist/auth/entities.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const LoginMethod: z.ZodEnum<{
|
|
3
3
|
email: "email";
|
|
4
4
|
evm_wallet: "evm_wallet";
|
|
5
|
+
oauth: "oauth";
|
|
5
6
|
}>;
|
|
6
7
|
export declare const AuthenticatedUser: z.ZodObject<{
|
|
7
8
|
id: z.ZodUUID;
|
|
@@ -14,6 +15,7 @@ export declare const AuthenticatedUser: z.ZodObject<{
|
|
|
14
15
|
loginMethod: z.ZodEnum<{
|
|
15
16
|
email: "email";
|
|
16
17
|
evm_wallet: "evm_wallet";
|
|
18
|
+
oauth: "oauth";
|
|
17
19
|
}>;
|
|
18
20
|
}, z.core.$strip>;
|
|
19
21
|
export type LoginMethod = z.infer<typeof LoginMethod>;
|
package/dist/auth/entities.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
const LoginMethod = z.enum(["email", "evm_wallet"]).describe("Authentication provider used for the current session");
|
|
3
|
+
const LoginMethod = z.enum(["email", "evm_wallet", "oauth"]).describe("Authentication provider used for the current session");
|
|
4
4
|
const AuthenticatedUser = z.object({
|
|
5
5
|
id: z.uuid().describe("User UUID"),
|
|
6
6
|
role: z.enum(["basic", "pro", "admin"]).describe("User role"),
|
package/dist/auth/payloads.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export declare const ResendVerificationForRegisterRequest: z.ZodObject<{
|
|
|
59
59
|
export declare const LogoutRequest: z.ZodObject<{
|
|
60
60
|
refreshToken: z.ZodString;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
|
+
export declare const OauthInteractionConfirmRequest: z.ZodObject<{
|
|
63
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
62
65
|
export type RequestNonceRequest = z.infer<typeof RequestNonceRequest>;
|
|
63
66
|
export type WalletLoginRequest = z.infer<typeof WalletLoginRequest>;
|
|
64
67
|
export type EmailRegisterRequest = z.infer<typeof EmailRegisterRequest>;
|
|
@@ -68,6 +71,7 @@ export type EmailLoginRequest = z.infer<typeof EmailLoginRequest>;
|
|
|
68
71
|
export type LoginRequest = z.infer<typeof LoginRequest>;
|
|
69
72
|
export type RefreshTokenRequest = z.infer<typeof RefreshTokenRequest>;
|
|
70
73
|
export type LogoutRequest = z.infer<typeof LogoutRequest>;
|
|
74
|
+
export type OauthInteractionConfirmRequest = z.infer<typeof OauthInteractionConfirmRequest>;
|
|
71
75
|
export type VerifyEmailRequest = z.infer<typeof VerifyEmailRequest>;
|
|
72
76
|
export type ResendVerificationForRegisterRequest = z.infer<typeof ResendVerificationForRegisterRequest>;
|
|
73
77
|
export type ChangePasswordRequest = z.infer<typeof ChangePasswordRequest>;
|
package/dist/auth/payloads.js
CHANGED
|
@@ -55,5 +55,10 @@ const ResendVerificationForRegisterRequest = z.object({
|
|
|
55
55
|
const LogoutRequest = z.object({
|
|
56
56
|
refreshToken: z.string().min(1, "Refresh token is required").describe("Refresh token to revoke")
|
|
57
57
|
}).describe("Logout and revoke refresh token");
|
|
58
|
+
const OauthInteractionConfirmRequest = z.object({
|
|
59
|
+
scopes: z.array(z.string()).default([]).describe(
|
|
60
|
+
"The scope set the user granted at consent (opaque to the AS; empty resolves to the read-only fail-safe)"
|
|
61
|
+
)
|
|
62
|
+
}).describe("Consent confirmation body \u2014 the granted scope set");
|
|
58
63
|
|
|
59
|
-
export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, VerifyEmailRequest, WalletLoginRequest };
|
|
64
|
+
export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, OauthInteractionConfirmRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, VerifyEmailRequest, WalletLoginRequest };
|
package/dist/auth/response.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const LoginResponse: z.ZodObject<{
|
|
|
13
13
|
loginMethod: z.ZodEnum<{
|
|
14
14
|
email: "email";
|
|
15
15
|
evm_wallet: "evm_wallet";
|
|
16
|
+
oauth: "oauth";
|
|
16
17
|
}>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
}, z.core.$strip>;
|
|
@@ -48,8 +49,44 @@ export declare const MeResponse: z.ZodObject<{
|
|
|
48
49
|
loginMethod: z.ZodEnum<{
|
|
49
50
|
email: "email";
|
|
50
51
|
evm_wallet: "evm_wallet";
|
|
52
|
+
oauth: "oauth";
|
|
51
53
|
}>;
|
|
52
54
|
}, z.core.$strip>;
|
|
55
|
+
export declare const OauthGrant: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
59
|
+
connectedAt: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export declare const OauthGrantsResponse: z.ZodObject<{
|
|
62
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
66
|
+
connectedAt: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const OauthInteractionClient: z.ZodObject<{
|
|
70
|
+
clientId: z.ZodString;
|
|
71
|
+
clientName: z.ZodOptional<z.ZodString>;
|
|
72
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const OauthInteractionDetailsResponse: z.ZodObject<{
|
|
75
|
+
uid: z.ZodString;
|
|
76
|
+
prompt: z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
details: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
81
|
+
client: z.ZodObject<{
|
|
82
|
+
clientId: z.ZodString;
|
|
83
|
+
clientName: z.ZodOptional<z.ZodString>;
|
|
84
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export declare const OauthInteractionRedirectResponse: z.ZodObject<{
|
|
88
|
+
returnTo: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
53
90
|
export type RequestNonceResponse = z.infer<typeof RequestNonceResponse>;
|
|
54
91
|
export type LoginResponse = z.infer<typeof LoginResponse>;
|
|
55
92
|
export type RefreshSessionResponse = z.infer<typeof RefreshSessionResponse>;
|
|
@@ -59,8 +96,13 @@ export type RegisterEmailResponse = z.infer<typeof RegisterEmailResponse>;
|
|
|
59
96
|
export type LinkEmailResponse = z.infer<typeof LinkEmailResponse>;
|
|
60
97
|
export type LinkWalletResponse = z.infer<typeof LinkWalletResponse>;
|
|
61
98
|
export type MeResponse = z.infer<typeof MeResponse>;
|
|
99
|
+
export type OauthGrant = z.infer<typeof OauthGrant>;
|
|
100
|
+
export type OauthGrantsResponse = z.infer<typeof OauthGrantsResponse>;
|
|
62
101
|
export type ResendVerificationResponse = z.infer<typeof ResendVerificationResponse>;
|
|
63
102
|
export type VerifyEmailResponse = z.infer<typeof VerifyEmailResponse>;
|
|
64
103
|
export type ChangePasswordResponse = z.infer<typeof ChangePasswordResponse>;
|
|
65
104
|
export type ForgotPasswordResponse = z.infer<typeof ForgotPasswordResponse>;
|
|
66
105
|
export type ResetPasswordResponse = z.infer<typeof ResetPasswordResponse>;
|
|
106
|
+
export type OauthInteractionClient = z.infer<typeof OauthInteractionClient>;
|
|
107
|
+
export type OauthInteractionDetailsResponse = z.infer<typeof OauthInteractionDetailsResponse>;
|
|
108
|
+
export type OauthInteractionRedirectResponse = z.infer<typeof OauthInteractionRedirectResponse>;
|
package/dist/auth/response.js
CHANGED
|
@@ -28,5 +28,31 @@ const RequestNonceResponse = z.object({
|
|
|
28
28
|
expiresAt: z.number().int().positive().describe("Unix timestamp when nonce expires")
|
|
29
29
|
}).describe("Nonce response for wallet authentication");
|
|
30
30
|
const MeResponse = AuthenticatedUser.describe("Current authenticated user info");
|
|
31
|
+
const OauthGrant = z.object({
|
|
32
|
+
id: z.string().describe("OAuth grant id \u2014 used to revoke this grant"),
|
|
33
|
+
name: z.string().describe("Human-readable client name, falling back to the client id when unnamed"),
|
|
34
|
+
scopes: z.array(z.string()).describe("The granted scope set (opaque; the client interprets it)"),
|
|
35
|
+
connectedAt: z.string().describe("ISO timestamp when the grant was created")
|
|
36
|
+
}).describe("One active OAuth grant the user has authorized");
|
|
37
|
+
const OauthGrantsResponse = z.object({
|
|
38
|
+
grants: z.array(OauthGrant).describe("The user active OAuth grants, newest first")
|
|
39
|
+
}).describe("List of the user active OAuth grants");
|
|
40
|
+
const OauthInteractionClient = z.object({
|
|
41
|
+
clientId: z.string().describe("OAuth client identifier"),
|
|
42
|
+
clientName: z.string().optional().describe("Human-readable client name"),
|
|
43
|
+
redirectUris: z.array(z.string()).describe("Registered redirect URIs for the client")
|
|
44
|
+
}).describe("OAuth client info for an interaction");
|
|
45
|
+
const OauthInteractionDetailsResponse = z.object({
|
|
46
|
+
uid: z.string().describe("Interaction session identifier"),
|
|
47
|
+
prompt: z.object({
|
|
48
|
+
name: z.string().describe('Prompt name the interaction is currently awaiting, e.g. "login" or "consent"'),
|
|
49
|
+
details: z.record(z.string(), z.unknown()).describe("Prompt-specific details from the AS")
|
|
50
|
+
}).describe("Prompt the interaction is currently awaiting"),
|
|
51
|
+
params: z.record(z.string(), z.unknown()).describe("Original authorization request params"),
|
|
52
|
+
client: OauthInteractionClient
|
|
53
|
+
}).describe("OAuth interaction details for the current prompt");
|
|
54
|
+
const OauthInteractionRedirectResponse = z.object({
|
|
55
|
+
returnTo: z.string().describe("Provider URL to redirect the browser back to")
|
|
56
|
+
}).describe("OAuth interaction redirect target after login/confirm/abort");
|
|
31
57
|
|
|
32
|
-
export { ChangePasswordResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, VerifyEmailResponse };
|
|
58
|
+
export { ChangePasswordResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, OauthGrant, OauthGrantsResponse, OauthInteractionClient, OauthInteractionDetailsResponse, OauthInteractionRedirectResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, VerifyEmailResponse };
|
package/dist/common/array.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* @param val - The value to normalize.
|
|
8
8
|
* @returns The normalized value.
|
|
9
9
|
*/
|
|
10
|
-
export declare function normalizeArray<TInput>(val: TInput): (TInput & any[]) |
|
|
10
|
+
export declare function normalizeArray<TInput>(val: TInput): string[] | (TInput & any[]) | undefined;
|
|
@@ -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
|
|
25
|
+
const InitialWeightConfig = z.object({
|
|
26
26
|
weightSource: z.literal("INITIAL_WEIGHT"),
|
|
27
|
-
positionId: z.uuid(),
|
|
28
27
|
minimumDriftPct: MinimumDriftPct
|
|
29
28
|
});
|
|
30
|
-
const
|
|
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";
|