@pear-protocol/types 1.24.0 → 1.25.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.
Files changed (75) hide show
  1. package/dist/auth/api-keys.js +11 -3
  2. package/dist/auth/entities.js +10 -2
  3. package/dist/auth/payloads.d.ts +7 -0
  4. package/dist/auth/payloads.js +15 -11
  5. package/dist/auth/response.js +4 -1
  6. package/dist/common/array.js +9 -2
  7. package/dist/common/refinement.js +25 -19
  8. package/dist/common/request.js +8 -8
  9. package/dist/common/response.js +10 -10
  10. package/dist/common/schema.js +9 -2
  11. package/dist/common/trade-legs.js +17 -12
  12. package/dist/connector/index.js +7 -1
  13. package/dist/execution/entities.js +96 -65
  14. package/dist/execution/queries.js +5 -1
  15. package/dist/execution/responses.js +3 -1
  16. package/dist/fee/entities.js +17 -3
  17. package/dist/fill/entities.js +33 -29
  18. package/dist/fill/queries.js +4 -1
  19. package/dist/funding/entities.js +4 -4
  20. package/dist/funding/responses.js +2 -2
  21. package/dist/instrument/entities.js +56 -44
  22. package/dist/instrument/queries.js +6 -1
  23. package/dist/instrument/responses.js +4 -4
  24. package/dist/instrument-precision/index.js +23 -23
  25. package/dist/ladder/entities.js +5 -1
  26. package/dist/ladder/payloads.js +15 -4
  27. package/dist/ladder/queries.js +0 -1
  28. package/dist/ladder/responses.js +12 -4
  29. package/dist/leverage/payloads.js +4 -1
  30. package/dist/notification/entities.js +37 -28
  31. package/dist/notification/payloads.js +9 -3
  32. package/dist/notification/queries.js +5 -1
  33. package/dist/notification/responses.js +4 -4
  34. package/dist/order/entities.js +38 -30
  35. package/dist/portfolio/queries.js +18 -3
  36. package/dist/position/entities.js +95 -72
  37. package/dist/position/queries.js +29 -23
  38. package/dist/price/entities.js +4 -1
  39. package/dist/price/responses.js +4 -4
  40. package/dist/rebalance/entities.js +23 -6
  41. package/dist/rebalance/payloads.js +23 -11
  42. package/dist/rebalance/queries.js +2 -8
  43. package/dist/rebalance/responses.js +12 -4
  44. package/dist/saved-baskets/entities.js +3 -1
  45. package/dist/saved-baskets/payloads.js +3 -1
  46. package/dist/schedule/entities.js +87 -71
  47. package/dist/schedule/payloads.js +36 -33
  48. package/dist/schedule/queries.js +5 -1
  49. package/dist/schedule/responses.js +12 -4
  50. package/dist/statistics/entities.d.ts +1 -0
  51. package/dist/statistics/entities.js +12 -0
  52. package/dist/statistics/queries.d.ts +2 -0
  53. package/dist/statistics/queries.js +16 -3
  54. package/dist/statistics/responses.d.ts +1 -0
  55. package/dist/sync/payloads.js +13 -17
  56. package/dist/tca/entities.js +4 -1
  57. package/dist/tca/responses.js +4 -1
  58. package/dist/trade/payloads.js +37 -23
  59. package/dist/trade/responses.js +15 -5
  60. package/dist/trade-accounts/entities.js +4 -1
  61. package/dist/trade-accounts/response.js +6 -2
  62. package/dist/trigger/common/index.js +27 -6
  63. package/dist/trigger/entities/conditions.js +14 -15
  64. package/dist/trigger/entities/index.js +89 -80
  65. package/dist/trigger/oracle.js +10 -3
  66. package/dist/trigger/payloads/conditions.js +8 -2
  67. package/dist/trigger/payloads/index.js +18 -4
  68. package/dist/trigger/queries.js +5 -1
  69. package/dist/trigger/refinement/static.refinement.js +5 -2
  70. package/dist/trigger/refinement/trailing.refinement.js +8 -6
  71. package/dist/trigger/responses.js +12 -4
  72. package/dist/triggers/entities.js +8 -2
  73. package/dist/users/entities.js +4 -1
  74. package/dist/users/payloads.js +17 -18
  75. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- import 'zod';
2
-
3
- const RefineTrailingConfig = (value, ctx) => {
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const RefineTrailingConfig = /* @__PURE__ */ __name((value, ctx) => {
4
4
  for (const issue of getTrailingDeltaIssues(value)) {
5
5
  ctx.addIssue({
6
6
  code: "custom",
7
7
  message: issue.message
8
8
  });
9
9
  }
10
- };
11
- const RefineTrailingLogicalRules = (value, ctx) => {
10
+ }, "RefineTrailingConfig");
11
+ const RefineTrailingLogicalRules = /* @__PURE__ */ __name((value, ctx) => {
12
12
  for (const issue of getTrailingLogicalIssues({
13
13
  conditionType: value.condition.type,
14
14
  trailing: value.trailing
@@ -18,7 +18,7 @@ const RefineTrailingLogicalRules = (value, ctx) => {
18
18
  message: issue.message
19
19
  });
20
20
  }
21
- };
21
+ }, "RefineTrailingLogicalRules");
22
22
  function getTrailingLogicalIssues(input) {
23
23
  const { trailing } = input;
24
24
  const issues = [];
@@ -51,6 +51,7 @@ function getTrailingLogicalIssues(input) {
51
51
  }
52
52
  return issues;
53
53
  }
54
+ __name(getTrailingLogicalIssues, "getTrailingLogicalIssues");
54
55
  function getTrailingDeltaIssues(trailing) {
55
56
  const issues = [];
56
57
  if (trailing.deltaValue <= 0) {
@@ -77,5 +78,6 @@ function getTrailingDeltaIssues(trailing) {
77
78
  }
78
79
  return issues;
79
80
  }
81
+ __name(getTrailingDeltaIssues, "getTrailingDeltaIssues");
80
82
 
81
83
  export { RefineTrailingConfig, RefineTrailingLogicalRules, getTrailingDeltaIssues, getTrailingLogicalIssues };
@@ -2,9 +2,17 @@ import { z } from 'zod';
2
2
  import { CursorResponse } from '../common';
3
3
  import { Trigger } from './entities';
4
4
 
5
- const TriggerListResponse = CursorResponse.extend({ triggers: z.array(Trigger) });
6
- const CreateTriggerResponse = z.object({ trigger: Trigger });
7
- const CancelTriggerResponse = z.object({ id: z.uuid() });
8
- const CancelAllTriggersResponse = z.object({ ids: z.array(z.uuid()) });
5
+ const TriggerListResponse = CursorResponse.extend({
6
+ triggers: z.array(Trigger)
7
+ });
8
+ const CreateTriggerResponse = z.object({
9
+ trigger: Trigger
10
+ });
11
+ const CancelTriggerResponse = z.object({
12
+ id: z.uuid()
13
+ });
14
+ const CancelAllTriggersResponse = z.object({
15
+ ids: z.array(z.uuid())
16
+ });
9
17
 
10
18
  export { CancelAllTriggersResponse, CancelTriggerResponse, CreateTriggerResponse, TriggerListResponse };
@@ -1,6 +1,9 @@
1
1
  import { z } from 'zod';
2
2
 
3
- const ExternalTriggerSource = z.enum(["kalshi", "polymarket"]);
3
+ const ExternalTriggerSource = z.enum([
4
+ "kalshi",
5
+ "polymarket"
6
+ ]);
4
7
  const TriggerOutcome = z.object({
5
8
  id: z.string(),
6
9
  label: z.string(),
@@ -13,7 +16,10 @@ const ExternalTrigger = z.object({
13
16
  selectable: z.boolean(),
14
17
  oracle: z.number().nullable(),
15
18
  options: z.array(TriggerOutcome),
16
- type: z.enum(["binary", "multi"]),
19
+ type: z.enum([
20
+ "binary",
21
+ "multi"
22
+ ]),
17
23
  title: z.string(),
18
24
  imageUrl: z.string().nullable()
19
25
  });
@@ -7,7 +7,10 @@ const UserPreferences = z.object({
7
7
  const UserProfile = z.object({
8
8
  id: z.uuid().describe("User UUID"),
9
9
  displayName: z.string().describe("Public display name"),
10
- role: z.enum(["basic", "pro"]).describe("User role"),
10
+ role: z.enum([
11
+ "basic",
12
+ "pro"
13
+ ]).describe("User role"),
11
14
  address: z.string().nullable().describe("Linked wallet address (for evm_wallet provider)"),
12
15
  email: z.string().nullable().describe("Linked email address (for email provider)"),
13
16
  emailVerified: z.boolean().describe("Whether the email is verified"),
@@ -4,24 +4,23 @@ const UpdateUserPreferences = z.object({
4
4
  slippageToleranceBps: z.int().min(1).max(1e4).optional().describe("User slippage preference in basis points")
5
5
  }).describe("Payload to update user preferences");
6
6
  const DISPLAY_NAME_REGEX = /^[\p{L}\p{N} .'-]+$/u;
7
- const DisplayNameSchema = z.preprocess(
8
- (value) => {
9
- if (typeof value !== "string") return value;
10
- return value.normalize("NFKC").trim().replace(/\s+/g, " ");
11
- },
12
- z.string().min(1, "Display name must be at least 1 character").max(40, "Display name must be at most 40 characters").refine((value) => !/[\u200B-\u200D\uFEFF]/.test(value), {
13
- message: "Display name contains invisible characters"
14
- }).refine((value) => DISPLAY_NAME_REGEX.test(value), {
15
- message: "Display name may only contain letters, numbers, spaces, apostrophes, hyphens, and periods"
16
- }).refine((value) => /[\p{L}\p{N}]/u.test(value), {
17
- message: "Display name must contain at least one letter or number"
18
- }).refine((value) => !/^[ .'-]|[ .'-]$/.test(value), {
19
- message: "Display name cannot start or end with punctuation"
20
- }).refine((value) => !/[ .'-]{2,}/.test(value), {
21
- message: "Display name cannot contain repeated separators"
22
- })
23
- );
24
- const UpdateUserDisplayName = z.object({ displayName: DisplayNameSchema }).describe("Payload to update user display name");
7
+ const DisplayNameSchema = z.preprocess((value) => {
8
+ if (typeof value !== "string") return value;
9
+ return value.normalize("NFKC").trim().replace(/\s+/g, " ");
10
+ }, z.string().min(1, "Display name must be at least 1 character").max(40, "Display name must be at most 40 characters").refine((value) => !/[\u200B-\u200D\uFEFF]/.test(value), {
11
+ message: "Display name contains invisible characters"
12
+ }).refine((value) => DISPLAY_NAME_REGEX.test(value), {
13
+ message: "Display name may only contain letters, numbers, spaces, apostrophes, hyphens, and periods"
14
+ }).refine((value) => /[\p{L}\p{N}]/u.test(value), {
15
+ message: "Display name must contain at least one letter or number"
16
+ }).refine((value) => !/^[ .'-]|[ .'-]$/.test(value), {
17
+ message: "Display name cannot start or end with punctuation"
18
+ }).refine((value) => !/[ .'-]{2,}/.test(value), {
19
+ message: "Display name cannot contain repeated separators"
20
+ }));
21
+ const UpdateUserDisplayName = z.object({
22
+ displayName: DisplayNameSchema
23
+ }).describe("Payload to update user display name");
25
24
  const ReferralCodeSpelling = z.string().min(1).max(32).regex(/^[\x20-\x7E]+$/, "Referral code must contain printable ASCII characters only");
26
25
  const IssuedReferralCodeSpelling = z.string().trim().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Referral code must contain only letters, digits, hyphens, or underscores");
27
26
  const CreateReferralCode = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",