@polyester/sdk 0.17.0 → 0.18.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 (43) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/gen/auth/v1/resolve_pb.d.ts +35 -6
  3. package/dist/gen/auth/v1/resolve_pb.d.ts.map +1 -1
  4. package/dist/gen/auth/v1/resolve_pb.js +34 -2
  5. package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
  6. package/dist/gen/auth/v1/subaccounts_pb.d.ts +37 -10
  7. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  8. package/dist/gen/auth/v1/subaccounts_pb.js +38 -6
  9. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  10. package/dist/gen/orders/v1/orders_pb.d.ts +124 -14
  11. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  12. package/dist/gen/orders/v1/orders_pb.js +124 -2
  13. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  14. package/dist/services/accounts/accounts.codecs.js +6 -1
  15. package/dist/services/accounts/accounts.codecs.js.map +1 -1
  16. package/dist/services/accounts/accounts.schemas.d.ts +2 -2
  17. package/dist/services/accounts/accounts.schemas.d.ts.map +1 -1
  18. package/dist/services/accounts/accounts.schemas.js +4 -3
  19. package/dist/services/accounts/accounts.schemas.js.map +1 -1
  20. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  21. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  22. package/dist/services/orders/orders-batch.schemas.d.ts +9 -9
  23. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  24. package/dist/services/orders/orders-batch.schemas.js +4 -4
  25. package/dist/services/orders/orders-batch.schemas.js.map +1 -1
  26. package/dist/services/orders/orders-input.schemas.d.ts +8 -8
  27. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  28. package/dist/services/orders/orders-input.schemas.js +5 -4
  29. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  30. package/dist/services/orders/orders-output.schemas.d.ts +6 -6
  31. package/dist/services/orders/orders.codecs.js +20 -1
  32. package/dist/services/orders/orders.codecs.js.map +1 -1
  33. package/dist/services/subaccounts/subaccounts.codecs.js +11 -1
  34. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  35. package/dist/services/subaccounts/subaccounts.js +1 -1
  36. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  37. package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -7
  38. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  39. package/dist/services/subaccounts/subaccounts.schemas.js +2 -6
  40. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  41. package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
  42. package/dist/services/triggers/triggers-output.schemas.d.ts +18 -18
  43. package/package.json +1 -1
@@ -243,7 +243,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
243
243
  attachedRisk: {
244
244
  takeProfit: {
245
245
  state: {
246
- status: "unspecified" | "failed" | "completed" | "created" | "armed" | "running" | "paused" | "canceled" | "not_configured";
246
+ status: "unspecified" | "created" | "failed" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
247
247
  armedTs: number | undefined;
248
248
  armedTsNs: string | undefined;
249
249
  terminalTs: number | undefined;
@@ -262,7 +262,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
262
262
  } | undefined;
263
263
  stopLoss: {
264
264
  state: {
265
- status: "unspecified" | "failed" | "completed" | "created" | "armed" | "running" | "paused" | "canceled" | "not_configured";
265
+ status: "unspecified" | "created" | "failed" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
266
266
  armedTs: number | undefined;
267
267
  armedTsNs: string | undefined;
268
268
  terminalTs: number | undefined;
@@ -281,7 +281,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
281
281
  } | undefined;
282
282
  trailingStop: {
283
283
  state: {
284
- status: "unspecified" | "failed" | "completed" | "created" | "armed" | "running" | "paused" | "canceled" | "not_configured";
284
+ status: "unspecified" | "created" | "failed" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
285
285
  armedTs: number | undefined;
286
286
  armedTsNs: string | undefined;
287
287
  terminalTs: number | undefined;
@@ -586,7 +586,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
586
586
  attachedRisk: {
587
587
  takeProfit: {
588
588
  state: {
589
- status: "unspecified" | "failed" | "completed" | "created" | "armed" | "running" | "paused" | "canceled" | "not_configured";
589
+ status: "unspecified" | "created" | "failed" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
590
590
  armedTs: number | undefined;
591
591
  armedTsNs: string | undefined;
592
592
  terminalTs: number | undefined;
@@ -605,7 +605,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
605
605
  } | undefined;
606
606
  stopLoss: {
607
607
  state: {
608
- status: "unspecified" | "failed" | "completed" | "created" | "armed" | "running" | "paused" | "canceled" | "not_configured";
608
+ status: "unspecified" | "created" | "failed" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
609
609
  armedTs: number | undefined;
610
610
  armedTsNs: string | undefined;
611
611
  terminalTs: number | undefined;
@@ -624,7 +624,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
624
624
  } | undefined;
625
625
  trailingStop: {
626
626
  state: {
627
- status: "unspecified" | "failed" | "completed" | "created" | "armed" | "running" | "paused" | "canceled" | "not_configured";
627
+ status: "unspecified" | "created" | "failed" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
628
628
  armedTs: number | undefined;
629
629
  armedTsNs: string | undefined;
630
630
  terminalTs: number | undefined;
@@ -12,6 +12,25 @@ const MODIFY_BEHAVIOR_VALUES = [
12
12
  "AMEND_ONLY",
13
13
  "REPLACE_ONLY"
14
14
  ];
15
+ const CancelOrderStatusCodec = { protoToOutput: {
16
+ [0]: "unspecified",
17
+ [1]: "accepted"
18
+ } };
19
+ const CancelAllOrdersStatusCodec = { protoToOutput: {
20
+ [0]: "unspecified",
21
+ [1]: "submitted",
22
+ [2]: "dry_run"
23
+ } };
24
+ const CancelAllAfterStatusCodec = { protoToOutput: {
25
+ [0]: "unspecified",
26
+ [1]: "armed",
27
+ [2]: "disabled"
28
+ } };
29
+ const BatchCancelOrderStatusCodec = { protoToOutput: {
30
+ [0]: "unspecified",
31
+ [1]: "accepted",
32
+ [2]: "rejected"
33
+ } };
15
34
  const OrderStatusFilterCodec = { inputToProto: {
16
35
  FILLED: 4,
17
36
  CANCELED: 5,
@@ -81,6 +100,6 @@ const BatchReplacePhaseCodec = { protoToOutput: {
81
100
  [4]: "terminal"
82
101
  } };
83
102
  //#endregion
84
- export { AttachedRiskLegStatusCodec, BatchReplaceAdmissionStatusCodec, BatchReplaceItemAdmissionStatusCodec, BatchReplacePhaseCodec, FEE_ASSET_VALUES, FeeAssetCodec, MODIFY_BEHAVIOR_VALUES, ModifyActionCodec, ModifyBehaviorCodec, ORDER_STATUS_FILTER_VALUES, OrderOriginScopeCodec, OrderSideCodec, OrderStatusCodec, OrderStatusFilterCodec, OrderTriggerTypeCodec, OrderTypeCodec, SELF_TRADE_PREVENTION_MODE_VALUES, SelfTradePreventionModeCodec, TimeInForceCodec };
103
+ export { AttachedRiskLegStatusCodec, BatchCancelOrderStatusCodec, BatchReplaceAdmissionStatusCodec, BatchReplaceItemAdmissionStatusCodec, BatchReplacePhaseCodec, CancelAllAfterStatusCodec, CancelAllOrdersStatusCodec, CancelOrderStatusCodec, FEE_ASSET_VALUES, FeeAssetCodec, MODIFY_BEHAVIOR_VALUES, ModifyActionCodec, ModifyBehaviorCodec, ORDER_STATUS_FILTER_VALUES, OrderOriginScopeCodec, OrderSideCodec, OrderStatusCodec, OrderStatusFilterCodec, OrderTriggerTypeCodec, OrderTypeCodec, SELF_TRADE_PREVENTION_MODE_VALUES, SelfTradePreventionModeCodec, TimeInForceCodec };
85
104
 
86
105
  //# sourceMappingURL=orders.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"orders.codecs.js","names":[],"sources":["../../../src/services/orders/orders.codecs.ts"],"sourcesContent":["import * as ProtoRead from \"../../gen/orders/v1/orders_read_pb.js\";\nimport * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\nexport {\n FEE_ASSET_VALUES,\n FeeAssetCodec,\n type FeeAssetValue,\n ORDER_SIDE_VALUES,\n ORDER_TYPE_VALUES,\n OrderSideCodec,\n type OrderSideValue,\n OrderTypeCodec,\n type OrderTypeValue,\n SELF_TRADE_PREVENTION_MODE_VALUES,\n SelfTradePreventionModeCodec,\n type SelfTradePreventionModeValue,\n TIME_IN_FORCE_OUTPUT_VALUES,\n TIME_IN_FORCE_VALUES,\n TimeInForceCodec,\n type TimeInForceOutputValue,\n type TimeInForceValue,\n TRIGGER_PRICE_SOURCE_VALUES,\n TriggerPriceSourceCodec,\n type TriggerPriceSourceValue,\n} from \"./order-enums.codecs.js\";\n\nexport const ORDER_STATUS_FILTER_VALUES = [\"FILLED\", \"CANCELED\", \"REJECTED\"] as const;\nexport type OrderStatusFilterValue = (typeof ORDER_STATUS_FILTER_VALUES)[number];\n\nexport const ORDER_STATUS_VALUES = [\n \"pending\",\n \"pending_cancel\",\n \"working\",\n \"filled\",\n \"canceled\",\n \"rejected\",\n] as const;\nexport type OrderStatusValue = (typeof ORDER_STATUS_VALUES)[number];\n\nexport const ORDER_ORIGIN_SCOPE_VALUES = [\n \"direct\",\n \"attached_risk\",\n \"standalone_trigger\",\n \"system\",\n] as const;\nexport type OrderOriginScope = (typeof ORDER_ORIGIN_SCOPE_VALUES)[number];\n\nexport const ORDER_TRIGGER_TYPE_VALUES = [\n \"unspecified\",\n \"stop_loss\",\n \"take_profit\",\n \"trailing_stop\",\n \"twap\",\n \"ladder\",\n] as const;\nexport type OrderTriggerType = (typeof ORDER_TRIGGER_TYPE_VALUES)[number];\n\nexport const ATTACHED_RISK_LEG_STATUS_VALUES = [\n \"not_configured\",\n \"created\",\n \"armed\",\n \"running\",\n \"completed\",\n \"canceled\",\n \"failed\",\n \"paused\",\n] as const;\nexport type AttachedRiskLegStatusValue = (typeof ATTACHED_RISK_LEG_STATUS_VALUES)[number];\n\nexport const MODIFY_BEHAVIOR_VALUES = [\"AMEND_OR_REPLACE\", \"AMEND_ONLY\", \"REPLACE_ONLY\"] as const;\nexport type ModifyBehaviorValue = (typeof MODIFY_BEHAVIOR_VALUES)[number];\n\nexport const MODIFY_ACTION_VALUES = [\"AMENDED\", \"REPLACED\"] as const;\nexport type ModifyActionValue = (typeof MODIFY_ACTION_VALUES)[number];\n\nexport const BATCH_REPLACE_ADMISSION_STATUS_VALUES = [\n \"admitted\",\n \"partially_admitted\",\n \"rejected\",\n] as const;\nexport type BatchReplaceAdmissionStatusValue =\n (typeof BATCH_REPLACE_ADMISSION_STATUS_VALUES)[number];\n\nexport const BATCH_REPLACE_ITEM_ADMISSION_STATUS_VALUES = [\"admitted\", \"rejected\"] as const;\nexport type BatchReplaceItemAdmissionStatusValue =\n (typeof BATCH_REPLACE_ITEM_ADMISSION_STATUS_VALUES)[number];\n\nexport const BATCH_REPLACE_PHASE_VALUES = [\"admitted\", \"working\", \"rejected\", \"terminal\"] as const;\nexport type BatchReplacePhaseValue = (typeof BATCH_REPLACE_PHASE_VALUES)[number];\n\nexport const OrderStatusFilterCodec = {\n inputToProto: {\n FILLED: ProtoRead.OrderStatus.FILLED,\n CANCELED: ProtoRead.OrderStatus.CANCELED,\n REJECTED: ProtoRead.OrderStatus.REJECTED,\n } satisfies InputToProto<OrderStatusFilterValue, ProtoRead.OrderStatus>,\n} as const;\n\nexport const OrderStatusCodec = {\n protoToOutput: {\n [ProtoRead.OrderStatus.ORDER_STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.OrderStatus.PENDING]: \"pending\",\n [ProtoRead.OrderStatus.PENDING_CANCEL]: \"pending_cancel\",\n [ProtoRead.OrderStatus.WORKING]: \"working\",\n [ProtoRead.OrderStatus.FILLED]: \"filled\",\n [ProtoRead.OrderStatus.CANCELED]: \"canceled\",\n [ProtoRead.OrderStatus.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<ProtoRead.OrderStatus, OrderStatusValue>,\n} as const;\n\nexport const OrderOriginScopeCodec = {\n protoToOutput: {\n [ProtoRead.OrderOriginScope.ORDER_ORIGIN_SCOPE_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.OrderOriginScope.DIRECT]: \"direct\",\n [ProtoRead.OrderOriginScope.ATTACHED_RISK]: \"attached_risk\",\n [ProtoRead.OrderOriginScope.STANDALONE_TRIGGER]: \"standalone_trigger\",\n [ProtoRead.OrderOriginScope.SYSTEM]: \"system\",\n } satisfies ProtoToOutput<ProtoRead.OrderOriginScope, OrderOriginScope>,\n} as const;\n\nexport const OrderTriggerTypeCodec = {\n protoToOutput: {\n [ProtoRead.OrderTriggerType.ORDER_TRIGGER_TYPE_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.OrderTriggerType.STOP_LOSS]: \"stop_loss\",\n [ProtoRead.OrderTriggerType.TAKE_PROFIT]: \"take_profit\",\n [ProtoRead.OrderTriggerType.TRAILING_STOP]: \"trailing_stop\",\n [ProtoRead.OrderTriggerType.TWAP]: \"twap\",\n [ProtoRead.OrderTriggerType.LADDER]: \"ladder\",\n } satisfies Record<ProtoRead.OrderTriggerType, OrderTriggerType>,\n} as const;\n\nexport const AttachedRiskLegStatusCodec = {\n protoToOutput: {\n [ProtoRead.AttachedRiskLegState_Status.STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.AttachedRiskLegState_Status.NOT_CONFIGURED]: \"not_configured\",\n [ProtoRead.AttachedRiskLegState_Status.CREATED]: \"created\",\n [ProtoRead.AttachedRiskLegState_Status.ARMED]: \"armed\",\n [ProtoRead.AttachedRiskLegState_Status.RUNNING]: \"running\",\n [ProtoRead.AttachedRiskLegState_Status.COMPLETED]: \"completed\",\n [ProtoRead.AttachedRiskLegState_Status.CANCELED]: \"canceled\",\n [ProtoRead.AttachedRiskLegState_Status.FAILED]: \"failed\",\n [ProtoRead.AttachedRiskLegState_Status.PAUSED]: \"paused\",\n } satisfies ProtoToOutput<ProtoRead.AttachedRiskLegState_Status, AttachedRiskLegStatusValue>,\n} as const;\n\nexport const ModifyBehaviorCodec = {\n inputToProto: {\n AMEND_OR_REPLACE: ProtoWrite.ModifyBehavior.AMEND_OR_REPLACE,\n AMEND_ONLY: ProtoWrite.ModifyBehavior.AMEND_ONLY,\n REPLACE_ONLY: ProtoWrite.ModifyBehavior.REPLACE_ONLY,\n } satisfies InputToProto<ModifyBehaviorValue, ProtoWrite.ModifyBehavior>,\n} as const;\n\nexport const ModifyActionCodec = {\n protoToOutput: {\n [ProtoWrite.ModifyActionTaken.MODIFY_ACTION_UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.ModifyActionTaken.AMENDED]: \"AMENDED\",\n [ProtoWrite.ModifyActionTaken.REPLACED]: \"REPLACED\",\n } satisfies ProtoToOutput<ProtoWrite.ModifyActionTaken, ModifyActionValue>,\n} as const;\n\nexport const BatchReplaceAdmissionStatusCodec = {\n protoToOutput: {\n [ProtoWrite.BatchReplaceAdmissionStatus.UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.BatchReplaceAdmissionStatus.ADMITTED]: \"admitted\",\n [ProtoWrite.BatchReplaceAdmissionStatus.PARTIALLY_ADMITTED]: \"partially_admitted\",\n [ProtoWrite.BatchReplaceAdmissionStatus.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<\n ProtoWrite.BatchReplaceAdmissionStatus,\n BatchReplaceAdmissionStatusValue\n >,\n} as const;\n\nexport const BatchReplaceItemAdmissionStatusCodec = {\n protoToOutput: {\n [ProtoWrite.BatchReplaceItemAdmissionStatus.UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.BatchReplaceItemAdmissionStatus.ADMITTED]: \"admitted\",\n [ProtoWrite.BatchReplaceItemAdmissionStatus.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<\n ProtoWrite.BatchReplaceItemAdmissionStatus,\n BatchReplaceItemAdmissionStatusValue\n >,\n} as const;\n\nexport const BatchReplacePhaseCodec = {\n protoToOutput: {\n [ProtoRead.BatchReplacePhase.UNSPECIFIED]: \"unspecified\",\n [ProtoRead.BatchReplacePhase.ADMITTED]: \"admitted\",\n [ProtoRead.BatchReplacePhase.WORKING]: \"working\",\n [ProtoRead.BatchReplacePhase.REJECTED]: \"rejected\",\n [ProtoRead.BatchReplacePhase.TERMINAL]: \"terminal\",\n } satisfies ProtoToOutput<ProtoRead.BatchReplacePhase, BatchReplacePhaseValue>,\n} as const;\n"],"mappings":";;;;AA0BA,MAAa,6BAA6B;CAAC;CAAU;CAAY;AAAU;AA2C3E,MAAa,yBAAyB;CAAC;CAAoB;CAAc;AAAc;AAqBvF,MAAa,yBAAyB,EAClC,cAAc;CACV,QAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,mBAAmB,EAC5B,eAAe;EACuC,IAAA;EACjB,IAAA;EACO,IAAA;EACP,IAAA;EACD,IAAA;EACE,IAAA;EACA,IAAA;AACtC,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACkD,IAAA;EACxB,IAAA;EACO,IAAA;EACK,IAAA;EACZ,IAAA;AACzC,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACkD,IAAA;EACrB,IAAA;EACE,IAAA;EACE,IAAA;EACT,IAAA;EACE,IAAA;AACzC,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EACiD,IAAA;EACJ,IAAA;EACP,IAAA;EACF,IAAA;EACE,IAAA;EACE,IAAA;EACD,IAAA;EACF,IAAA;EACA,IAAA;AACpD,EACJ;AAEA,MAAa,sBAAsB,EAC/B,cAAc;CACV,kBAAA;CACA,YAAA;CACA,cAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EAC+C,IAAA;EAClB,IAAA;EACC,IAAA;AAC7C,EACJ;AAEA,MAAa,mCAAmC,EAC5C,eAAe;EAC2C,IAAA;EACH,IAAA;EACU,IAAA;EACV,IAAA;AACvD,EAIJ;AAEA,MAAa,uCAAuC,EAChD,eAAe;EAC+C,IAAA;EACH,IAAA;EACA,IAAA;AAC3D,EAIJ;AAEA,MAAa,yBAAyB,EAClC,eAAe;EACgC,IAAA;EACH,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;AAC5C,EACJ"}
1
+ {"version":3,"file":"orders.codecs.js","names":[],"sources":["../../../src/services/orders/orders.codecs.ts"],"sourcesContent":["import * as ProtoRead from \"../../gen/orders/v1/orders_read_pb.js\";\nimport * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\nexport {\n FEE_ASSET_VALUES,\n FeeAssetCodec,\n type FeeAssetValue,\n ORDER_SIDE_VALUES,\n ORDER_TYPE_VALUES,\n OrderSideCodec,\n type OrderSideValue,\n OrderTypeCodec,\n type OrderTypeValue,\n SELF_TRADE_PREVENTION_MODE_VALUES,\n SelfTradePreventionModeCodec,\n type SelfTradePreventionModeValue,\n TIME_IN_FORCE_OUTPUT_VALUES,\n TIME_IN_FORCE_VALUES,\n TimeInForceCodec,\n type TimeInForceOutputValue,\n type TimeInForceValue,\n TRIGGER_PRICE_SOURCE_VALUES,\n TriggerPriceSourceCodec,\n type TriggerPriceSourceValue,\n} from \"./order-enums.codecs.js\";\n\nexport const ORDER_STATUS_FILTER_VALUES = [\"FILLED\", \"CANCELED\", \"REJECTED\"] as const;\nexport type OrderStatusFilterValue = (typeof ORDER_STATUS_FILTER_VALUES)[number];\n\nexport const ORDER_STATUS_VALUES = [\n \"pending\",\n \"pending_cancel\",\n \"working\",\n \"filled\",\n \"canceled\",\n \"rejected\",\n] as const;\nexport type OrderStatusValue = (typeof ORDER_STATUS_VALUES)[number];\n\nexport const ORDER_ORIGIN_SCOPE_VALUES = [\n \"direct\",\n \"attached_risk\",\n \"standalone_trigger\",\n \"system\",\n] as const;\nexport type OrderOriginScope = (typeof ORDER_ORIGIN_SCOPE_VALUES)[number];\n\nexport const ORDER_TRIGGER_TYPE_VALUES = [\n \"unspecified\",\n \"stop_loss\",\n \"take_profit\",\n \"trailing_stop\",\n \"twap\",\n \"ladder\",\n] as const;\nexport type OrderTriggerType = (typeof ORDER_TRIGGER_TYPE_VALUES)[number];\n\nexport const ATTACHED_RISK_LEG_STATUS_VALUES = [\n \"not_configured\",\n \"created\",\n \"armed\",\n \"running\",\n \"completed\",\n \"canceled\",\n \"failed\",\n \"paused\",\n] as const;\nexport type AttachedRiskLegStatusValue = (typeof ATTACHED_RISK_LEG_STATUS_VALUES)[number];\n\nexport const MODIFY_BEHAVIOR_VALUES = [\"AMEND_OR_REPLACE\", \"AMEND_ONLY\", \"REPLACE_ONLY\"] as const;\nexport type ModifyBehaviorValue = (typeof MODIFY_BEHAVIOR_VALUES)[number];\n\nexport const MODIFY_ACTION_VALUES = [\"AMENDED\", \"REPLACED\"] as const;\nexport type ModifyActionValue = (typeof MODIFY_ACTION_VALUES)[number];\n\nexport const BATCH_REPLACE_ADMISSION_STATUS_VALUES = [\n \"admitted\",\n \"partially_admitted\",\n \"rejected\",\n] as const;\nexport type BatchReplaceAdmissionStatusValue =\n (typeof BATCH_REPLACE_ADMISSION_STATUS_VALUES)[number];\n\nexport const BATCH_REPLACE_ITEM_ADMISSION_STATUS_VALUES = [\"admitted\", \"rejected\"] as const;\nexport type BatchReplaceItemAdmissionStatusValue =\n (typeof BATCH_REPLACE_ITEM_ADMISSION_STATUS_VALUES)[number];\n\nexport const BATCH_REPLACE_PHASE_VALUES = [\"admitted\", \"working\", \"rejected\", \"terminal\"] as const;\nexport type BatchReplacePhaseValue = (typeof BATCH_REPLACE_PHASE_VALUES)[number];\n\nexport const CancelOrderStatusCodec = {\n protoToOutput: {\n [ProtoWrite.CancelOrderResponse_Status.STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.CancelOrderResponse_Status.ACCEPTED]: \"accepted\",\n } satisfies ProtoToOutput<ProtoWrite.CancelOrderResponse_Status, \"accepted\">,\n} as const;\n\nexport const CancelAllOrdersStatusCodec = {\n protoToOutput: {\n [ProtoWrite.CancelAllOrdersResponse_Status.STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.CancelAllOrdersResponse_Status.SUBMITTED]: \"submitted\",\n [ProtoWrite.CancelAllOrdersResponse_Status.DRY_RUN]: \"dry_run\",\n } satisfies ProtoToOutput<ProtoWrite.CancelAllOrdersResponse_Status, \"submitted\" | \"dry_run\">,\n} as const;\n\nexport const CancelAllAfterStatusCodec = {\n protoToOutput: {\n [ProtoWrite.CancelAllAfterResponse_Status.STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.CancelAllAfterResponse_Status.ARMED]: \"armed\",\n [ProtoWrite.CancelAllAfterResponse_Status.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<ProtoWrite.CancelAllAfterResponse_Status, \"armed\" | \"disabled\">,\n} as const;\n\nexport const BatchCancelOrderStatusCodec = {\n protoToOutput: {\n [ProtoWrite.BatchCancelResultItem_Status.STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.BatchCancelResultItem_Status.ACCEPTED]: \"accepted\",\n [ProtoWrite.BatchCancelResultItem_Status.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<ProtoWrite.BatchCancelResultItem_Status, \"accepted\" | \"rejected\">,\n} as const;\n\nexport const OrderStatusFilterCodec = {\n inputToProto: {\n FILLED: ProtoRead.OrderStatus.FILLED,\n CANCELED: ProtoRead.OrderStatus.CANCELED,\n REJECTED: ProtoRead.OrderStatus.REJECTED,\n } satisfies InputToProto<OrderStatusFilterValue, ProtoRead.OrderStatus>,\n} as const;\n\nexport const OrderStatusCodec = {\n protoToOutput: {\n [ProtoRead.OrderStatus.ORDER_STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.OrderStatus.PENDING]: \"pending\",\n [ProtoRead.OrderStatus.PENDING_CANCEL]: \"pending_cancel\",\n [ProtoRead.OrderStatus.WORKING]: \"working\",\n [ProtoRead.OrderStatus.FILLED]: \"filled\",\n [ProtoRead.OrderStatus.CANCELED]: \"canceled\",\n [ProtoRead.OrderStatus.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<ProtoRead.OrderStatus, OrderStatusValue>,\n} as const;\n\nexport const OrderOriginScopeCodec = {\n protoToOutput: {\n [ProtoRead.OrderOriginScope.ORDER_ORIGIN_SCOPE_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.OrderOriginScope.DIRECT]: \"direct\",\n [ProtoRead.OrderOriginScope.ATTACHED_RISK]: \"attached_risk\",\n [ProtoRead.OrderOriginScope.STANDALONE_TRIGGER]: \"standalone_trigger\",\n [ProtoRead.OrderOriginScope.SYSTEM]: \"system\",\n } satisfies ProtoToOutput<ProtoRead.OrderOriginScope, OrderOriginScope>,\n} as const;\n\nexport const OrderTriggerTypeCodec = {\n protoToOutput: {\n [ProtoRead.OrderTriggerType.ORDER_TRIGGER_TYPE_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.OrderTriggerType.STOP_LOSS]: \"stop_loss\",\n [ProtoRead.OrderTriggerType.TAKE_PROFIT]: \"take_profit\",\n [ProtoRead.OrderTriggerType.TRAILING_STOP]: \"trailing_stop\",\n [ProtoRead.OrderTriggerType.TWAP]: \"twap\",\n [ProtoRead.OrderTriggerType.LADDER]: \"ladder\",\n } satisfies Record<ProtoRead.OrderTriggerType, OrderTriggerType>,\n} as const;\n\nexport const AttachedRiskLegStatusCodec = {\n protoToOutput: {\n [ProtoRead.AttachedRiskLegState_Status.STATUS_UNSPECIFIED]: \"unspecified\",\n [ProtoRead.AttachedRiskLegState_Status.NOT_CONFIGURED]: \"not_configured\",\n [ProtoRead.AttachedRiskLegState_Status.CREATED]: \"created\",\n [ProtoRead.AttachedRiskLegState_Status.ARMED]: \"armed\",\n [ProtoRead.AttachedRiskLegState_Status.RUNNING]: \"running\",\n [ProtoRead.AttachedRiskLegState_Status.COMPLETED]: \"completed\",\n [ProtoRead.AttachedRiskLegState_Status.CANCELED]: \"canceled\",\n [ProtoRead.AttachedRiskLegState_Status.FAILED]: \"failed\",\n [ProtoRead.AttachedRiskLegState_Status.PAUSED]: \"paused\",\n } satisfies ProtoToOutput<ProtoRead.AttachedRiskLegState_Status, AttachedRiskLegStatusValue>,\n} as const;\n\nexport const ModifyBehaviorCodec = {\n inputToProto: {\n AMEND_OR_REPLACE: ProtoWrite.ModifyBehavior.AMEND_OR_REPLACE,\n AMEND_ONLY: ProtoWrite.ModifyBehavior.AMEND_ONLY,\n REPLACE_ONLY: ProtoWrite.ModifyBehavior.REPLACE_ONLY,\n } satisfies InputToProto<ModifyBehaviorValue, ProtoWrite.ModifyBehavior>,\n} as const;\n\nexport const ModifyActionCodec = {\n protoToOutput: {\n [ProtoWrite.ModifyActionTaken.MODIFY_ACTION_UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.ModifyActionTaken.AMENDED]: \"AMENDED\",\n [ProtoWrite.ModifyActionTaken.REPLACED]: \"REPLACED\",\n } satisfies ProtoToOutput<ProtoWrite.ModifyActionTaken, ModifyActionValue>,\n} as const;\n\nexport const BatchReplaceAdmissionStatusCodec = {\n protoToOutput: {\n [ProtoWrite.BatchReplaceAdmissionStatus.UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.BatchReplaceAdmissionStatus.ADMITTED]: \"admitted\",\n [ProtoWrite.BatchReplaceAdmissionStatus.PARTIALLY_ADMITTED]: \"partially_admitted\",\n [ProtoWrite.BatchReplaceAdmissionStatus.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<\n ProtoWrite.BatchReplaceAdmissionStatus,\n BatchReplaceAdmissionStatusValue\n >,\n} as const;\n\nexport const BatchReplaceItemAdmissionStatusCodec = {\n protoToOutput: {\n [ProtoWrite.BatchReplaceItemAdmissionStatus.UNSPECIFIED]: \"unspecified\",\n [ProtoWrite.BatchReplaceItemAdmissionStatus.ADMITTED]: \"admitted\",\n [ProtoWrite.BatchReplaceItemAdmissionStatus.REJECTED]: \"rejected\",\n } satisfies ProtoToOutput<\n ProtoWrite.BatchReplaceItemAdmissionStatus,\n BatchReplaceItemAdmissionStatusValue\n >,\n} as const;\n\nexport const BatchReplacePhaseCodec = {\n protoToOutput: {\n [ProtoRead.BatchReplacePhase.UNSPECIFIED]: \"unspecified\",\n [ProtoRead.BatchReplacePhase.ADMITTED]: \"admitted\",\n [ProtoRead.BatchReplacePhase.WORKING]: \"working\",\n [ProtoRead.BatchReplacePhase.REJECTED]: \"rejected\",\n [ProtoRead.BatchReplacePhase.TERMINAL]: \"terminal\",\n } satisfies ProtoToOutput<ProtoRead.BatchReplacePhase, BatchReplacePhaseValue>,\n} as const;\n"],"mappings":";;;;AA0BA,MAAa,6BAA6B;CAAC;CAAU;CAAY;AAAU;AA2C3E,MAAa,yBAAyB;CAAC;CAAoB;CAAc;AAAc;AAqBvF,MAAa,yBAAyB,EAClC,eAAe;EACiD,IAAA;EACV,IAAA;AACtD,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EACqD,IAAA;EACT,IAAA;EACF,IAAA;AACzD,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACoD,IAAA;EACb,IAAA;EACG,IAAA;AACzD,EACJ;AAEA,MAAa,8BAA8B,EACvC,eAAe;EACmD,IAAA;EACV,IAAA;EACA,IAAA;AACxD,EACJ;AAEA,MAAa,yBAAyB,EAClC,cAAc;CACV,QAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,mBAAmB,EAC5B,eAAe;EACuC,IAAA;EACjB,IAAA;EACO,IAAA;EACP,IAAA;EACD,IAAA;EACE,IAAA;EACA,IAAA;AACtC,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACkD,IAAA;EACxB,IAAA;EACO,IAAA;EACK,IAAA;EACZ,IAAA;AACzC,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACkD,IAAA;EACrB,IAAA;EACE,IAAA;EACE,IAAA;EACT,IAAA;EACE,IAAA;AACzC,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EACiD,IAAA;EACJ,IAAA;EACP,IAAA;EACF,IAAA;EACE,IAAA;EACE,IAAA;EACD,IAAA;EACF,IAAA;EACA,IAAA;AACpD,EACJ;AAEA,MAAa,sBAAsB,EAC/B,cAAc;CACV,kBAAA;CACA,YAAA;CACA,cAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EAC+C,IAAA;EAClB,IAAA;EACC,IAAA;AAC7C,EACJ;AAEA,MAAa,mCAAmC,EAC5C,eAAe;EAC2C,IAAA;EACH,IAAA;EACU,IAAA;EACV,IAAA;AACvD,EAIJ;AAEA,MAAa,uCAAuC,EAChD,eAAe;EAC+C,IAAA;EACH,IAAA;EACA,IAAA;AAC3D,EAIJ;AAEA,MAAa,yBAAyB,EAClC,eAAe;EACgC,IAAA;EACH,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;AAC5C,EACJ"}
@@ -1,5 +1,10 @@
1
1
  import "../../gen/auth/v1/subaccounts_pb.js";
2
2
  //#region src/services/subaccounts/subaccounts.codecs.ts
3
+ const SUBACCOUNT_INVITE_DIRECTION_VALUES = [
4
+ "",
5
+ "incoming",
6
+ "outgoing"
7
+ ];
3
8
  const SUBACCOUNT_STATUS_VALUES = ["active", "disabled"];
4
9
  const SubaccountRoleCodec = {
5
10
  inputToProto: {
@@ -60,6 +65,11 @@ const InviteStatusCodec = { protoToOutput: {
60
65
  [3]: "declined",
61
66
  [4]: "cancelled"
62
67
  } };
68
+ const SubaccountInviteDirectionCodec = { inputToProto: {
69
+ "": 0,
70
+ incoming: 1,
71
+ outgoing: 2
72
+ } };
63
73
  const SubaccountStatusCodec = {
64
74
  inputToProto: {
65
75
  active: 1,
@@ -107,6 +117,6 @@ const ActivityEventSourceCodec = { protoToOutput: {
107
117
  [3]: "api"
108
118
  } };
109
119
  //#endregion
110
- export { ActivityEntityKindCodec, ActivityEventActionCodec, ActivityEventSourceCodec, InviteActionCodec, InviteStatusCodec, SUBACCOUNT_STATUS_VALUES, SubaccountPermissionCodec, SubaccountRoleCodec, SubaccountStatusCodec };
120
+ export { ActivityEntityKindCodec, ActivityEventActionCodec, ActivityEventSourceCodec, InviteActionCodec, InviteStatusCodec, SUBACCOUNT_INVITE_DIRECTION_VALUES, SUBACCOUNT_STATUS_VALUES, SubaccountInviteDirectionCodec, SubaccountPermissionCodec, SubaccountRoleCodec, SubaccountStatusCodec };
111
121
 
112
122
  //# sourceMappingURL=subaccounts.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.codecs.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\nexport type SubaccountRoleValue = (typeof SUBACCOUNT_ROLE_VALUES)[number];\n\nexport const SUBACCOUNT_PERMISSION_VALUES = [\n \"read_subaccount\",\n \"update_subaccount\",\n \"read_balances\",\n \"read_spot\",\n \"trade_spot\",\n \"read_internal_transfers\",\n \"internal_transfer\",\n \"external_withdraw\",\n \"read_address_book\",\n \"manage_address_book\",\n \"read_members\",\n \"manage_members\",\n \"read_invites\",\n \"manage_invites\",\n \"read_api_keys\",\n \"manage_api_keys\",\n \"read_subaccount_policy\",\n \"manage_subaccount_policy\",\n \"read_activity\",\n \"read_activity_security_details\",\n \"manage_member_mfa_requirement\",\n \"create_deposit_address\",\n \"read_deposit_addresses\",\n \"read_guard_signer_status\",\n \"manage_guard_signer\",\n] as const;\nexport type SubaccountPermissionValue = (typeof SUBACCOUNT_PERMISSION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_ACTION_VALUES = [\"accept\", \"decline\", \"cancel\"] as const;\nexport type SubaccountInviteActionValue = (typeof SUBACCOUNT_INVITE_ACTION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_STATUS_VALUES = [\n \"pending\",\n \"accepted\",\n \"declined\",\n \"cancelled\",\n] as const;\nexport type SubaccountInviteStatusValue = (typeof SUBACCOUNT_INVITE_STATUS_VALUES)[number];\n\nexport const SUBACCOUNT_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type SubaccountStatusValue = (typeof SUBACCOUNT_STATUS_VALUES)[number];\n\nexport const ACTIVITY_ENTITY_KIND_VALUES = [\n \"account\",\n \"session\",\n \"api_key\",\n \"subaccount\",\n \"member\",\n \"policy\",\n \"invite\",\n \"security\",\n \"destination\",\n] as const;\nexport type ActivityEntityKindValue = (typeof ACTIVITY_ENTITY_KIND_VALUES)[number];\n\nexport const ACTIVITY_EVENT_ACTION_VALUES = [\n \"created\",\n \"updated\",\n \"deleted\",\n \"enabled\",\n \"disabled\",\n \"removed\",\n \"role_set\",\n \"received\",\n \"replied\",\n \"failed\",\n \"revoked\",\n \"blocked\",\n \"hold_placed\",\n \"hold_released\",\n] as const;\nexport type ActivityEventActionValue = (typeof ACTIVITY_EVENT_ACTION_VALUES)[number];\n\nexport const ACTIVITY_EVENT_SOURCE_VALUES = [\"web\", \"mobile\", \"api\"] as const;\nexport type ActivityEventSourceValue = (typeof ACTIVITY_EVENT_SOURCE_VALUES)[number];\n\nexport const SubaccountRoleCodec = {\n inputToProto: {\n owner: Proto.SubaccountRole.OWNER,\n admin: Proto.SubaccountRole.ADMIN,\n treasury: Proto.SubaccountRole.TREASURY,\n leveraged_trader: Proto.SubaccountRole.LEVERAGED_TRADER,\n trader: Proto.SubaccountRole.TRADER,\n viewer: Proto.SubaccountRole.VIEWER,\n } satisfies InputToProto<SubaccountRoleValue, Proto.SubaccountRole>,\n protoToOutput: {\n [Proto.SubaccountRole.SUBACCOUNT_ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountRole.OWNER]: \"owner\",\n [Proto.SubaccountRole.ADMIN]: \"admin\",\n [Proto.SubaccountRole.TREASURY]: \"treasury\",\n [Proto.SubaccountRole.LEVERAGED_TRADER]: \"leveraged_trader\",\n [Proto.SubaccountRole.TRADER]: \"trader\",\n [Proto.SubaccountRole.VIEWER]: \"viewer\",\n } satisfies ProtoToOutput<Proto.SubaccountRole, SubaccountRoleValue>,\n} as const;\n\nexport const SubaccountPermissionCodec = {\n protoToOutput: {\n [Proto.SubaccountPermission.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT]: \"read_subaccount\",\n [Proto.SubaccountPermission.UPDATE_SUBACCOUNT]: \"update_subaccount\",\n [Proto.SubaccountPermission.READ_BALANCES]: \"read_balances\",\n [Proto.SubaccountPermission.READ_SPOT]: \"read_spot\",\n [Proto.SubaccountPermission.TRADE_SPOT]: \"trade_spot\",\n [Proto.SubaccountPermission.READ_INTERNAL_TRANSFERS]: \"read_internal_transfers\",\n [Proto.SubaccountPermission.INTERNAL_TRANSFER]: \"internal_transfer\",\n [Proto.SubaccountPermission.EXTERNAL_WITHDRAW]: \"external_withdraw\",\n [Proto.SubaccountPermission.READ_ADDRESS_BOOK]: \"read_address_book\",\n [Proto.SubaccountPermission.MANAGE_ADDRESS_BOOK]: \"manage_address_book\",\n [Proto.SubaccountPermission.READ_MEMBERS]: \"read_members\",\n [Proto.SubaccountPermission.MANAGE_MEMBERS]: \"manage_members\",\n [Proto.SubaccountPermission.READ_INVITES]: \"read_invites\",\n [Proto.SubaccountPermission.MANAGE_INVITES]: \"manage_invites\",\n [Proto.SubaccountPermission.READ_API_KEYS]: \"read_api_keys\",\n [Proto.SubaccountPermission.MANAGE_API_KEYS]: \"manage_api_keys\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT_POLICY]: \"read_subaccount_policy\",\n [Proto.SubaccountPermission.MANAGE_SUBACCOUNT_POLICY]: \"manage_subaccount_policy\",\n [Proto.SubaccountPermission.READ_ACTIVITY]: \"read_activity\",\n [Proto.SubaccountPermission.READ_ACTIVITY_SECURITY_DETAILS]:\n \"read_activity_security_details\",\n [Proto.SubaccountPermission.MANAGE_MEMBER_MFA_REQUIREMENT]: \"manage_member_mfa_requirement\",\n [Proto.SubaccountPermission.CREATE_DEPOSIT_ADDRESS]: \"create_deposit_address\",\n [Proto.SubaccountPermission.READ_DEPOSIT_ADDRESSES]: \"read_deposit_addresses\",\n [Proto.SubaccountPermission.READ_GUARD_SIGNER_STATUS]: \"read_guard_signer_status\",\n [Proto.SubaccountPermission.MANAGE_GUARD_SIGNER]: \"manage_guard_signer\",\n } satisfies ProtoToOutput<Proto.SubaccountPermission, SubaccountPermissionValue>,\n} as const;\n\nexport const InviteActionCodec = {\n inputToProto: {\n accept: Proto.SubaccountInviteAction.ACCEPT,\n decline: Proto.SubaccountInviteAction.DECLINE,\n cancel: Proto.SubaccountInviteAction.CANCEL,\n } satisfies InputToProto<SubaccountInviteActionValue, Proto.SubaccountInviteAction>,\n} as const;\n\nexport const InviteStatusCodec = {\n protoToOutput: {\n [Proto.SubaccountInviteStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountInviteStatus.PENDING]: \"pending\",\n [Proto.SubaccountInviteStatus.ACCEPTED]: \"accepted\",\n [Proto.SubaccountInviteStatus.DECLINED]: \"declined\",\n [Proto.SubaccountInviteStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SubaccountInviteStatus, SubaccountInviteStatusValue>,\n} as const;\n\nexport const SubaccountStatusCodec = {\n inputToProto: {\n active: Proto.SubaccountStatus.ACTIVE,\n disabled: Proto.SubaccountStatus.DISABLED,\n } satisfies InputToProto<SubaccountStatusValue, Proto.SubaccountStatus>,\n protoToOutput: {\n [Proto.SubaccountStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountStatus.ACTIVE]: \"active\",\n [Proto.SubaccountStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.SubaccountStatus, SubaccountStatusValue>,\n} as const;\n\nexport const ActivityEntityKindCodec = {\n protoToOutput: {\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_ACCOUNT]: \"account\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SESSION]: \"session\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_API_KEY]: \"api_key\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SUBACCOUNT]: \"subaccount\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_MEMBER]: \"member\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_POLICY]: \"policy\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_INVITE]: \"invite\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SECURITY]: \"security\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_DESTINATION]: \"destination\",\n } satisfies ProtoToOutput<Proto.ActivityEntityKind, ActivityEntityKindValue>,\n} as const;\n\nexport const ActivityEventActionCodec = {\n protoToOutput: {\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_CREATED]: \"created\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UPDATED]: \"updated\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DELETED]: \"deleted\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ENABLED]: \"enabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DISABLED]: \"disabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REMOVED]: \"removed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ROLE_SET]: \"role_set\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_RECEIVED]: \"received\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REPLIED]: \"replied\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_FAILED]: \"failed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REVOKED]: \"revoked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_BLOCKED]: \"blocked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_PLACED]: \"hold_placed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_RELEASED]: \"hold_released\",\n } satisfies ProtoToOutput<Proto.ActivityEventAction, ActivityEventActionValue>,\n} as const;\n\nexport const ActivityEventSourceCodec = {\n protoToOutput: {\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_WEB]: \"web\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_MOBILE]: \"mobile\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_API]: \"api\",\n } satisfies ProtoToOutput<Proto.ActivityEventSource, ActivityEventSourceValue>,\n} as const;\n"],"mappings":";;AAqDA,MAAa,2BAA2B,CAAC,UAAU,UAAU;AAqC7D,MAAa,sBAAsB;CAC/B,cAAc;EACV,OAAA;EACA,OAAA;EACA,UAAA;EACA,kBAAA;EACA,QAAA;EACA,QAAA;CACJ;CACA,eAAe;GACyC,IAAA;GACtB,IAAA;GACA,IAAA;GACG,IAAA;GACQ,IAAA;GACV,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC+B,IAAA;EACI,IAAA;EACE,IAAA;EACJ,IAAA;EACJ,IAAA;EACC,IAAA;EACa,IAAA;EACN,IAAA;EACA,IAAA;EACA,IAAA;EACE,KAAA;EACP,KAAA;EACE,KAAA;EACF,KAAA;EACE,KAAA;EACD,KAAA;EACE,KAAA;EACO,KAAA;EACE,KAAA;EACX,KAAA;EAExC,KAAA;EACwD,KAAA;EACP,KAAA;EACA,KAAA;EACE,KAAA;EACL,KAAA;AACtD,EACJ;AAEA,MAAa,oBAAoB,EAC7B,cAAc;CACV,QAAA;CACA,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EACiC,IAAA;EACJ,IAAA;EACC,IAAA;EACA,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC2B,IAAA;GACL,IAAA;GACE,IAAA;CACvC;AACJ;AAEA,MAAa,0BAA0B,EACnC,eAAe;EAC6C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACG,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACE,IAAA;EACG,IAAA;AAC5D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACC,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;EACD,KAAA;EACC,KAAA;EACA,KAAA;EACI,KAAA;EACE,KAAA;AAC/D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACR,IAAA;EACG,IAAA;EACH,IAAA;AACrD,EACJ"}
1
+ {"version":3,"file":"subaccounts.codecs.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\nexport type SubaccountRoleValue = (typeof SUBACCOUNT_ROLE_VALUES)[number];\n\nexport const SUBACCOUNT_PERMISSION_VALUES = [\n \"read_subaccount\",\n \"update_subaccount\",\n \"read_balances\",\n \"read_spot\",\n \"trade_spot\",\n \"read_internal_transfers\",\n \"internal_transfer\",\n \"external_withdraw\",\n \"read_address_book\",\n \"manage_address_book\",\n \"read_members\",\n \"manage_members\",\n \"read_invites\",\n \"manage_invites\",\n \"read_api_keys\",\n \"manage_api_keys\",\n \"read_subaccount_policy\",\n \"manage_subaccount_policy\",\n \"read_activity\",\n \"read_activity_security_details\",\n \"manage_member_mfa_requirement\",\n \"create_deposit_address\",\n \"read_deposit_addresses\",\n \"read_guard_signer_status\",\n \"manage_guard_signer\",\n] as const;\nexport type SubaccountPermissionValue = (typeof SUBACCOUNT_PERMISSION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_ACTION_VALUES = [\"accept\", \"decline\", \"cancel\"] as const;\nexport type SubaccountInviteActionValue = (typeof SUBACCOUNT_INVITE_ACTION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_STATUS_VALUES = [\n \"pending\",\n \"accepted\",\n \"declined\",\n \"cancelled\",\n] as const;\nexport type SubaccountInviteStatusValue = (typeof SUBACCOUNT_INVITE_STATUS_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_DIRECTION_VALUES = [\"\", \"incoming\", \"outgoing\"] as const;\nexport type SubaccountInviteDirectionValue = (typeof SUBACCOUNT_INVITE_DIRECTION_VALUES)[number];\n\nexport const SUBACCOUNT_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type SubaccountStatusValue = (typeof SUBACCOUNT_STATUS_VALUES)[number];\n\nexport const ACTIVITY_ENTITY_KIND_VALUES = [\n \"account\",\n \"session\",\n \"api_key\",\n \"subaccount\",\n \"member\",\n \"policy\",\n \"invite\",\n \"security\",\n \"destination\",\n] as const;\nexport type ActivityEntityKindValue = (typeof ACTIVITY_ENTITY_KIND_VALUES)[number];\n\nexport const ACTIVITY_EVENT_ACTION_VALUES = [\n \"created\",\n \"updated\",\n \"deleted\",\n \"enabled\",\n \"disabled\",\n \"removed\",\n \"role_set\",\n \"received\",\n \"replied\",\n \"failed\",\n \"revoked\",\n \"blocked\",\n \"hold_placed\",\n \"hold_released\",\n] as const;\nexport type ActivityEventActionValue = (typeof ACTIVITY_EVENT_ACTION_VALUES)[number];\n\nexport const ACTIVITY_EVENT_SOURCE_VALUES = [\"web\", \"mobile\", \"api\"] as const;\nexport type ActivityEventSourceValue = (typeof ACTIVITY_EVENT_SOURCE_VALUES)[number];\n\nexport const SubaccountRoleCodec = {\n inputToProto: {\n owner: Proto.SubaccountRole.OWNER,\n admin: Proto.SubaccountRole.ADMIN,\n treasury: Proto.SubaccountRole.TREASURY,\n leveraged_trader: Proto.SubaccountRole.LEVERAGED_TRADER,\n trader: Proto.SubaccountRole.TRADER,\n viewer: Proto.SubaccountRole.VIEWER,\n } satisfies InputToProto<SubaccountRoleValue, Proto.SubaccountRole>,\n protoToOutput: {\n [Proto.SubaccountRole.SUBACCOUNT_ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountRole.OWNER]: \"owner\",\n [Proto.SubaccountRole.ADMIN]: \"admin\",\n [Proto.SubaccountRole.TREASURY]: \"treasury\",\n [Proto.SubaccountRole.LEVERAGED_TRADER]: \"leveraged_trader\",\n [Proto.SubaccountRole.TRADER]: \"trader\",\n [Proto.SubaccountRole.VIEWER]: \"viewer\",\n } satisfies ProtoToOutput<Proto.SubaccountRole, SubaccountRoleValue>,\n} as const;\n\nexport const SubaccountPermissionCodec = {\n protoToOutput: {\n [Proto.SubaccountPermission.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT]: \"read_subaccount\",\n [Proto.SubaccountPermission.UPDATE_SUBACCOUNT]: \"update_subaccount\",\n [Proto.SubaccountPermission.READ_BALANCES]: \"read_balances\",\n [Proto.SubaccountPermission.READ_SPOT]: \"read_spot\",\n [Proto.SubaccountPermission.TRADE_SPOT]: \"trade_spot\",\n [Proto.SubaccountPermission.READ_INTERNAL_TRANSFERS]: \"read_internal_transfers\",\n [Proto.SubaccountPermission.INTERNAL_TRANSFER]: \"internal_transfer\",\n [Proto.SubaccountPermission.EXTERNAL_WITHDRAW]: \"external_withdraw\",\n [Proto.SubaccountPermission.READ_ADDRESS_BOOK]: \"read_address_book\",\n [Proto.SubaccountPermission.MANAGE_ADDRESS_BOOK]: \"manage_address_book\",\n [Proto.SubaccountPermission.READ_MEMBERS]: \"read_members\",\n [Proto.SubaccountPermission.MANAGE_MEMBERS]: \"manage_members\",\n [Proto.SubaccountPermission.READ_INVITES]: \"read_invites\",\n [Proto.SubaccountPermission.MANAGE_INVITES]: \"manage_invites\",\n [Proto.SubaccountPermission.READ_API_KEYS]: \"read_api_keys\",\n [Proto.SubaccountPermission.MANAGE_API_KEYS]: \"manage_api_keys\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT_POLICY]: \"read_subaccount_policy\",\n [Proto.SubaccountPermission.MANAGE_SUBACCOUNT_POLICY]: \"manage_subaccount_policy\",\n [Proto.SubaccountPermission.READ_ACTIVITY]: \"read_activity\",\n [Proto.SubaccountPermission.READ_ACTIVITY_SECURITY_DETAILS]:\n \"read_activity_security_details\",\n [Proto.SubaccountPermission.MANAGE_MEMBER_MFA_REQUIREMENT]: \"manage_member_mfa_requirement\",\n [Proto.SubaccountPermission.CREATE_DEPOSIT_ADDRESS]: \"create_deposit_address\",\n [Proto.SubaccountPermission.READ_DEPOSIT_ADDRESSES]: \"read_deposit_addresses\",\n [Proto.SubaccountPermission.READ_GUARD_SIGNER_STATUS]: \"read_guard_signer_status\",\n [Proto.SubaccountPermission.MANAGE_GUARD_SIGNER]: \"manage_guard_signer\",\n } satisfies ProtoToOutput<Proto.SubaccountPermission, SubaccountPermissionValue>,\n} as const;\n\nexport const InviteActionCodec = {\n inputToProto: {\n accept: Proto.SubaccountInviteAction.ACCEPT,\n decline: Proto.SubaccountInviteAction.DECLINE,\n cancel: Proto.SubaccountInviteAction.CANCEL,\n } satisfies InputToProto<SubaccountInviteActionValue, Proto.SubaccountInviteAction>,\n} as const;\n\nexport const InviteStatusCodec = {\n protoToOutput: {\n [Proto.SubaccountInviteStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountInviteStatus.PENDING]: \"pending\",\n [Proto.SubaccountInviteStatus.ACCEPTED]: \"accepted\",\n [Proto.SubaccountInviteStatus.DECLINED]: \"declined\",\n [Proto.SubaccountInviteStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SubaccountInviteStatus, SubaccountInviteStatusValue>,\n} as const;\n\nexport const SubaccountInviteDirectionCodec = {\n inputToProto: {\n \"\": Proto.SubaccountInviteDirection.DIRECTION_UNSPECIFIED,\n incoming: Proto.SubaccountInviteDirection.INCOMING,\n outgoing: Proto.SubaccountInviteDirection.OUTGOING,\n } satisfies InputToProto<SubaccountInviteDirectionValue, Proto.SubaccountInviteDirection>,\n} as const;\n\nexport const SubaccountStatusCodec = {\n inputToProto: {\n active: Proto.SubaccountStatus.ACTIVE,\n disabled: Proto.SubaccountStatus.DISABLED,\n } satisfies InputToProto<SubaccountStatusValue, Proto.SubaccountStatus>,\n protoToOutput: {\n [Proto.SubaccountStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountStatus.ACTIVE]: \"active\",\n [Proto.SubaccountStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.SubaccountStatus, SubaccountStatusValue>,\n} as const;\n\nexport const ActivityEntityKindCodec = {\n protoToOutput: {\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_ACCOUNT]: \"account\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SESSION]: \"session\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_API_KEY]: \"api_key\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SUBACCOUNT]: \"subaccount\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_MEMBER]: \"member\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_POLICY]: \"policy\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_INVITE]: \"invite\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SECURITY]: \"security\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_DESTINATION]: \"destination\",\n } satisfies ProtoToOutput<Proto.ActivityEntityKind, ActivityEntityKindValue>,\n} as const;\n\nexport const ActivityEventActionCodec = {\n protoToOutput: {\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_CREATED]: \"created\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UPDATED]: \"updated\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DELETED]: \"deleted\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ENABLED]: \"enabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DISABLED]: \"disabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REMOVED]: \"removed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ROLE_SET]: \"role_set\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_RECEIVED]: \"received\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REPLIED]: \"replied\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_FAILED]: \"failed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REVOKED]: \"revoked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_BLOCKED]: \"blocked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_PLACED]: \"hold_placed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_RELEASED]: \"hold_released\",\n } satisfies ProtoToOutput<Proto.ActivityEventAction, ActivityEventActionValue>,\n} as const;\n\nexport const ActivityEventSourceCodec = {\n protoToOutput: {\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_WEB]: \"web\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_MOBILE]: \"mobile\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_API]: \"api\",\n } satisfies ProtoToOutput<Proto.ActivityEventSource, ActivityEventSourceValue>,\n} as const;\n"],"mappings":";;AAqDA,MAAa,qCAAqC;CAAC;CAAI;CAAY;AAAU;AAG7E,MAAa,2BAA2B,CAAC,UAAU,UAAU;AAqC7D,MAAa,sBAAsB;CAC/B,cAAc;EACV,OAAA;EACA,OAAA;EACA,UAAA;EACA,kBAAA;EACA,QAAA;EACA,QAAA;CACJ;CACA,eAAe;GACyC,IAAA;GACtB,IAAA;GACA,IAAA;GACG,IAAA;GACQ,IAAA;GACV,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC+B,IAAA;EACI,IAAA;EACE,IAAA;EACJ,IAAA;EACJ,IAAA;EACC,IAAA;EACa,IAAA;EACN,IAAA;EACA,IAAA;EACA,IAAA;EACE,KAAA;EACP,KAAA;EACE,KAAA;EACF,KAAA;EACE,KAAA;EACD,KAAA;EACE,KAAA;EACO,KAAA;EACE,KAAA;EACX,KAAA;EAExC,KAAA;EACwD,KAAA;EACP,KAAA;EACA,KAAA;EACE,KAAA;EACL,KAAA;AACtD,EACJ;AAEA,MAAa,oBAAoB,EAC7B,cAAc;CACV,QAAA;CACA,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EACiC,IAAA;EACJ,IAAA;EACC,IAAA;EACA,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,iCAAiC,EAC1C,cAAc;CACV,IAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC2B,IAAA;GACL,IAAA;GACE,IAAA;CACvC;AACJ;AAEA,MAAa,0BAA0B,EACnC,eAAe;EAC6C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACG,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACE,IAAA;EACG,IAAA;AAC5D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACC,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;EACD,KAAA;EACC,KAAA;EACA,KAAA;EACI,KAAA;EACE,KAAA;AAC/D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACR,IAAA;EACG,IAAA;EACH,IAAA;AACrD,EACJ"}
@@ -51,7 +51,7 @@ var SubaccountsService = class {
51
51
  includeMembers: true,
52
52
  includeInvites: true,
53
53
  includePolicy: true,
54
- invitesDirection: "outgoing"
54
+ invitesDirection: 2
55
55
  }, toConnectCallOptions(options));
56
56
  if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);
57
57
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted count metadata useful for deriving future smart-account salts.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeBalances: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: \"outgoing\",\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Creates a new subaccount under the caller's root account using a smart-account address, nonce, and signature proof.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns incoming, outgoing, or all subaccount invitations for the caller, newest first.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8DA,IAAa,qBAAb,MAAgC;CAC5B;CAEA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,0BAA0B,YAAY,UAAU,QAAQ;EAC5E,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,cAAc,aAAaC,uBAA6B,WAAW,OAAO;EAC/E,KAAKC,oBAAoB,aAAaC,uBAA6B,WAAW,SAAS;EACvF,KAAKC,kBAAkB,aAAaD,uBAA6B,WAAW,OAAO;EACnF,KAAKE,YAAY;CACrB;;;;CAKA,MAAM,KAAK,SAGR;EACC,MAAM,MAAM,MAAM,KAAKP,QAAQ,gBAAgB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAChF,OAAO;GACH,cAAc,IAAI;GAClB,aAAa,MAAM,EAAE,MAAMQ,kBAAgB,GAAG,IAAI,WAAW;EACjE;CACJ;;;;CAKA,MAAM,IACF,OACA,SAQF;EACE,MAAM,iBAAiB,MAAM,yBAAyB,KAAK;EAC3D,MAAM,eAAe,SAAS,eAAe,YAAY;EACzD,MAAM,MAAM,MAAM,KAAKN,YAAY,cAC/B;GACI,cAAc,eAAe;GAC7B,gBAAgB;GAChB,iBAAiB;GACjB,gBAAgB;GAChB,gBAAgB;GAChB,eAAe;GACf,kBAAkB;EACtB,GACA,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,YAAY,MAAM,IAAI,MAAM,yBAAyB,cAAc;EAE5E,OAAO;GACH,GAAG,MAAMM,oBAAkB,IAAI,UAAU;GACzC,QAAQ,IAAI,SACN,MAAM,wBAAwB,IAAI,MAAM,IACxC;GACN,SAAS,MAAM,EAAE,SAA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AiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKE,YAAY,uBAC/B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,QAAQ,MAAM,EAAE,SAAS,EAAE,MAAM,6BAA6B,GAAG,CAAC,CAAC,GAAG,IAAI,MAAM;GAChF,eAAe,IAAI;EACvB;CACJ;;;;CAKA,UAAU,OAAkC;EACxC,MAAM,UAAU,4BAA4B,MAAM,UAAU;EAE5D,OAAO,KAAKK,UAAU,oBAAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,aAAa,MAAMF,oBAAkB,IAAI;IAC/C,MAAM,QAAQ,UAAU;GAC5B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;;;;CAKA,iBAAiB,OAA8B;EAC3C,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKD,UAAU,oBAAoB;GACtC;GACA,QAAQI;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMF,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted count metadata useful for deriving future smart-account salts.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeBalances: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Creates a new subaccount under the caller's root account using a smart-account address, nonce, and signature proof.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns incoming, outgoing, or all subaccount invitations for the caller, newest first.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8DA,IAAa,qBAAb,MAAgC;CAC5B;CAEA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,0BAA0B,YAAY,UAAU,QAAQ;EAC5E,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,cAAc,aAAaC,uBAA6B,WAAW,OAAO;EAC/E,KAAKC,oBAAoB,aAAaC,uBAA6B,WAAW,SAAS;EACvF,KAAKC,kBAAkB,aAAaD,uBAA6B,WAAW,OAAO;EACnF,KAAKE,YAAY;CACrB;;;;CAKA,MAAM,KAAK,SAGR;EACC,MAAM,MAAM,MAAM,KAAKP,QAAQ,gBAAgB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAChF,OAAO;GACH,cAAc,IAAI;GAClB,aAAa,MAAM,EAAE,MAAMQ,kBAAgB,GAAG,IAAI,WAAW;EACjE;CACJ;;;;CAKA,MAAM,IACF,OACA,SAQF;EACE,MAAM,iBAAiB,MAAM,yBAAyB,KAAK;EAC3D,MAAM,eAAe,SAAS,eAAe,YAAY;EACzD,MAAM,MAAM,MAAM,KAAKN,YAAY,cAC/B;GACI,cAAc,eAAe;GAC7B,gBAAgB;GAChB,iBAAiB;GACjB,gBAAgB;GAChB,gBAAgB;GAChB,eAAe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D;;;;CAKA,MAAM,cACF,OACA,SACyB;EACzB,MAAM,iBAAiB,MAAM,oCAAoC,KAAK;EACtE,MAAM,MAAM,MAAM,KAAKA,QAAQ,wBAC3B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,wBAAwB,IAAI,MAAM;CACnD;;;;CAKA,MAAM,WACF,OACA,SAC6D;EAC7D,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKE,YAAY,uBAC/B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,QAAQ,MAAM,EAAE,SAAS,EAAE,MAAM,6BAA6B,GAAG,CAAC,CAAC,GAAG,IAAI,MAAM;GAChF,eAAe,IAAI;EACvB;CACJ;;;;CAKA,UAAU,OAAkC;EACxC,MAAM,UAAU,4BAA4B,MAAM,UAAU;EAE5D,OAAO,KAAKK,UAAU,oBAAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,aAAa,MAAMF,oBAAkB,IAAI;IAC/C,MAAM,QAAQ,UAAU;GAC5B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;;;;CAKA,iBAAiB,OAA8B;EAC3C,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKD,UAAU,oBAAoB;GACtC;GACA,QAAQI;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMF,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -1,5 +1,5 @@
1
1
  import { PolicyAction } from "../../gen/auth/v1/policies_pb.js";
2
- import { ActivityEntityKind, ActivityEventAction, ActivityEventSource, SubaccountInviteAction, SubaccountInviteStatus as SubaccountInviteStatus$1, SubaccountPermission as SubaccountPermission$1, SubaccountRole as SubaccountRole$1, SubaccountStatus as SubaccountStatus$1 } from "../../gen/auth/v1/subaccounts_pb.js";
2
+ import { ActivityEntityKind, ActivityEventAction, ActivityEventSource, SubaccountInviteAction, SubaccountInviteDirection, SubaccountInviteStatus as SubaccountInviteStatus$1, SubaccountPermission as SubaccountPermission$1, SubaccountRole as SubaccountRole$1, SubaccountStatus as SubaccountStatus$1 } from "../../gen/auth/v1/subaccounts_pb.js";
3
3
  import * as v from "valibot";
4
4
  //#region src/services/subaccounts/subaccounts.schemas.d.ts
5
5
  declare const SubaccountRoleSchema: v.PicklistSchema<readonly ["owner", "admin", "treasury", "leveraged_trader", "trader", "viewer"], undefined>;
@@ -128,7 +128,7 @@ declare const SetSubaccountMemberMfaRequirementInputSchema: v.StrictObjectSchema
128
128
  }, undefined>;
129
129
  type SetSubaccountMemberMfaRequirementInput = v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>;
130
130
  declare const ListSubaccountInvitesInputSchema: v.StrictObjectSchema<{
131
- readonly direction: v.OptionalSchema<v.PicklistSchema<["incoming", "outgoing", ""], undefined>, "">;
131
+ readonly direction: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["", "incoming", "outgoing"], undefined>, "">, v.TransformAction<"" | "incoming" | "outgoing", SubaccountInviteDirection>]>;
132
132
  }, undefined>;
133
133
  type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;
134
134
  declare const InviteStatusSchema: v.PicklistSchema<["pending", "accepted", "declined", "cancelled"], undefined>;
@@ -212,7 +212,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
212
212
  readonly granteeAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
213
213
  readonly inviterAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
214
214
  readonly role: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountRole$1, undefined>, v.TransformAction<SubaccountRole$1, "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer">]>;
215
- readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "cancelled" | "accepted" | "declined">]>;
215
+ readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "accepted" | "declined" | "cancelled">]>;
216
216
  readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
217
217
  readonly seconds: v.BigintSchema<undefined>;
218
218
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -239,7 +239,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
239
239
  granteeAccountId: string;
240
240
  inviterAccountId: string;
241
241
  role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
242
- status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
242
+ status: "unspecified" | "pending" | "accepted" | "declined" | "cancelled";
243
243
  createdAt?: number | undefined;
244
244
  respondedAt?: number | undefined;
245
245
  granteeUsername: string;
@@ -257,7 +257,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
257
257
  granteeAccountId: string;
258
258
  inviterAccountId: string;
259
259
  role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
260
- status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
260
+ status: "unspecified" | "pending" | "accepted" | "declined" | "cancelled";
261
261
  createdAt?: number | undefined;
262
262
  respondedAt?: number | undefined;
263
263
  granteeUsername: string;
@@ -279,8 +279,8 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
279
279
  seconds: bigint;
280
280
  nanos: number;
281
281
  } | undefined, number | undefined>]>;
282
- readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "policy" | "member" | "invite" | "security">]>;
283
- readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "revoked" | "failed" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
282
+ readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "member" | "policy" | "invite" | "security">]>;
283
+ readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "failed" | "revoked" | "blocked" | "hold_placed" | "hold_released">]>;
284
284
  readonly source: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventSource, undefined>, v.TransformAction<ActivityEventSource, "unspecified" | "web" | "mobile" | "api">]>;
285
285
  readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
286
286
  readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.schemas.d.ts","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"mappings":";;;;cAoCa,sBAAoB,EAAA;KAErB,iBAAiB,EAAE,mBAAmB;cAS5C,iCAA+B,EAAA,yBAAA,EAAA,kBAAA,oCAAA,EAAA,gBAAA;KAYzB,uBAAuB,EAAE,mBAAmB;cAE3C,sCAAoC,EAAA;;;;;;KAiBrC,iCAAiC,EAAE,mBACpC;cAGE,gCAA8B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E,kCAAgC,EAAA;;;KAOjC,6BAA6B,EAAE,kBAAkB;cAIvD,oBAAkB,EAAA;KAEZ,yBAAyB,EAAE,mBAAmB;cAI7C,oCAAkC,EAAA;;;;KAQnC,+BAA+B,EAAE,kBAAkB;cAEzD,6BAA2B,EAAA,yBAAA,EAAA,kBAAA,gCAAA,EAAA,gBAAA;KAYrB,mBAAmB,EAAE,mBAAmB;cAEvC,kBAAgB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyBjB,aAAa,EAAE,mBAAmB;cAEjC,wBAAsB,EAAA;;;;;;;;KASvB,mBAAmB,EAAE,mBAAmB;cAEvC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4CvB,mBAAmB,EAAE,mBAAmB;cAEvC,+BAA6B,EAAA;;;;;KAM9B,0BAA0B,EAAE,kBAAkB;cAE7C,+BAA6B,EAAA;;;;;;;;;;;;;;;;KA4C9B,kBAAkB,EAAE,mBAAmB"}
@@ -5,7 +5,7 @@ import { PolicyAction } from "../../gen/auth/v1/policies_pb.js";
5
5
  import { PolicyActionCodec } from "../policies/shared.codecs.js";
6
6
  import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
7
7
  import { ActivityEntityKind, ActivityEventAction, ActivityEventSource, SubaccountInviteStatus, SubaccountPermission, SubaccountRole, SubaccountStatus } from "../../gen/auth/v1/subaccounts_pb.js";
8
- import { ActivityEntityKindCodec, ActivityEventActionCodec, ActivityEventSourceCodec, InviteActionCodec, InviteStatusCodec, SUBACCOUNT_STATUS_VALUES, SubaccountPermissionCodec, SubaccountRoleCodec, SubaccountStatusCodec } from "./subaccounts.codecs.js";
8
+ import { ActivityEntityKindCodec, ActivityEventActionCodec, ActivityEventSourceCodec, InviteActionCodec, InviteStatusCodec, SUBACCOUNT_INVITE_DIRECTION_VALUES, SUBACCOUNT_STATUS_VALUES, SubaccountInviteDirectionCodec, SubaccountPermissionCodec, SubaccountRoleCodec, SubaccountStatusCodec } from "./subaccounts.codecs.js";
9
9
  import * as v from "valibot";
10
10
  const SubaccountRoleSchema = v.picklist([
11
11
  "owner",
@@ -105,11 +105,7 @@ const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({
105
105
  subaccountId: idInputSchema("subaccountId"),
106
106
  requireMemberMfa: v.boolean()
107
107
  });
108
- const ListSubaccountInvitesInputSchema = v.strictObject({ direction: v.optional(v.picklist([
109
- "incoming",
110
- "outgoing",
111
- ""
112
- ]), "") });
108
+ const ListSubaccountInvitesInputSchema = v.strictObject({ direction: v.pipe(v.optional(v.picklist(SUBACCOUNT_INVITE_DIRECTION_VALUES), ""), v.transform((direction) => SubaccountInviteDirectionCodec.inputToProto[direction])) });
113
109
  const InviteActionSchema = v.picklist([
114
110
  "accept",
115
111
  "decline",
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.schemas.js","names":["Proto.SubaccountRole","Proto.SubaccountPermission","ProtoPolicies.PolicyAction","Proto.SubaccountInviteStatus","Proto.SubaccountStatus","Proto.ActivityEntityKind","Proto.ActivityEventAction","Proto.ActivityEventSource"],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoPolicies from \"../../gen/auth/v1/policies_pb.js\";\nimport * as v from \"valibot\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n idInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n SubaccountRoleCodec,\n SubaccountPermissionCodec,\n InviteActionCodec,\n InviteStatusCodec,\n SubaccountStatusCodec,\n SUBACCOUNT_STATUS_VALUES,\n ActivityEntityKindCodec,\n ActivityEventActionCodec,\n ActivityEventSourceCodec,\n} from \"./subaccounts.codecs.js\";\nimport { PolicyActionCodec } from \"../policies/shared.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\n\nexport const SubaccountRoleSchema = v.picklist(SUBACCOUNT_ROLE_VALUES);\n\nexport type SubaccountRole = v.InferOutput<typeof SubaccountRoleSchema>;\n\nconst ProtoSubaccountRoleSchema = v.pipe(\n v.enum(Proto.SubaccountRole),\n v.transform((role) =>\n requiredEnumLabel(SubaccountRoleCodec.protoToOutput, role, \"SubaccountRoleSchema\", \"role\"),\n ),\n);\n\nconst ProtoSubaccountPermissionSchema = v.pipe(\n v.enum(Proto.SubaccountPermission),\n v.transform((permission) =>\n requiredEnumLabel(\n SubaccountPermissionCodec.protoToOutput,\n permission,\n \"SubaccountPermissionSchema\",\n \"permission\",\n ),\n ),\n);\n\nexport type SubaccountPermission = v.InferOutput<typeof ProtoSubaccountPermissionSchema>;\n\nexport const SubaccountPermissionDefinitionSchema = v.object({\n permission: ProtoSubaccountPermissionSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n policyAction: v.pipe(\n v.enum(ProtoPolicies.PolicyAction),\n v.transform((action) =>\n requiredEnumLabel(\n PolicyActionCodec.protoToOutput,\n action,\n \"SubaccountPermissionDefinitionSchema\",\n \"policy action\",\n ),\n ),\n ),\n});\n\nexport type SubaccountPermissionDefinition = v.InferOutput<\n typeof SubaccountPermissionDefinitionSchema\n>;\n\nexport const SubaccountRoleDefinitionSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n assignable: v.optional(v.boolean(), false),\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n});\n\nexport type SubaccountRoleDefinition = v.InferOutput<typeof SubaccountRoleDefinitionSchema>;\n\nexport const SubaccountRoleCatalogSchema = v.object({\n permissions: v.optional(v.array(SubaccountPermissionDefinitionSchema), []),\n roles: v.optional(v.array(SubaccountRoleDefinitionSchema), []),\n});\n\nexport type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;\n\nexport const EffectiveSubaccountPermissionsSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n subaccountPolicyId: PublicIdSchema,\n});\n\nexport type EffectiveSubaccountPermissions = v.InferOutput<\n typeof EffectiveSubaccountPermissionsSchema\n>;\n\nexport const CreateSubaccountInputSchema = v.strictObject({\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type CreateSubaccountInput = v.InferInput<typeof CreateSubaccountInputSchema>;\n\nexport const SubaccountIdInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n});\n\nexport type SubaccountIdInput = v.InferInput<typeof SubaccountIdInputSchema>;\n\nexport const CreateSubaccountResultSchema = v.object({\n subaccountId: PublicIdSchema,\n totalCreated: v.number(),\n smartAccountSaltNonce: v.number(),\n revision: BigIntStringSchema,\n});\n\nexport type CreateSubaccountResult = v.InferOutput<typeof CreateSubaccountResultSchema>;\n\nexport const SubaccountMutationResultSchema = v.object({});\n\nexport type SubaccountMutationResult = v.InferOutput<typeof SubaccountMutationResultSchema>;\n\ntype SubaccountPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: (typeof SUBACCOUNT_STATUS_VALUES)[number];\n};\n\nconst SUBACCOUNT_PATCH_FIELDS = defineProtoPatchFields<SubaccountPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: SubaccountStatusCodec.inputToProto[status] }),\n },\n});\n\nexport const UpdateSubaccountInputSchema = v.pipe(\n v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(v.picklist(SUBACCOUNT_STATUS_VALUES)),\n }),\n v.check(\n ({ label, icon, color, status }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined,\n \"At least one subaccount field must be provided\",\n ),\n v.transform(({ subaccountId, expectedRevision, ...input }) => {\n const { patch: subaccount, updateMask } = buildProtoPatch(input, SUBACCOUNT_PATCH_FIELDS);\n return {\n subaccountId,\n subaccount,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type UpdateSubaccountInput = v.InferInput<typeof UpdateSubaccountInputSchema>;\n\nexport const InviteSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n role: v.pipe(\n SubaccountRoleSchema,\n v.transform((role) => SubaccountRoleCodec.inputToProto[role]),\n ),\n});\n\nexport type InviteSubaccountMemberInput = v.InferInput<typeof InviteSubaccountMemberInputSchema>;\n\nexport const RemoveSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n});\n\nexport type RemoveSubaccountMemberInput = v.InferInput<typeof RemoveSubaccountMemberInputSchema>;\n\nexport const UpdateSubaccountMemberRoleInputSchema = InviteSubaccountMemberInputSchema;\n\nexport type UpdateSubaccountMemberRoleInput = v.InferInput<\n typeof UpdateSubaccountMemberRoleInputSchema\n>;\n\nexport const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n requireMemberMfa: v.boolean(),\n});\n\nexport type SetSubaccountMemberMfaRequirementInput = v.InferInput<\n typeof SetSubaccountMemberMfaRequirementInputSchema\n>;\n\nexport const ListSubaccountInvitesInputSchema = v.strictObject({\n direction: v.optional(v.picklist([\"incoming\", \"outgoing\", \"\"]), \"\"),\n});\n\nexport type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;\n\nconst InviteActionSchema = v.picklist([\"accept\", \"decline\", \"cancel\"]);\n\nconst InviteStatusSchema = v.picklist([\"pending\", \"accepted\", \"declined\", \"cancelled\"]);\n\nexport type SubaccountInviteStatus = v.InferOutput<typeof InviteStatusSchema>;\n\nconst ProtoInviteStatusSchema = v.enum(Proto.SubaccountInviteStatus);\n\nexport const RespondSubaccountInviteInputSchema = v.strictObject({\n inviteId: idInputSchema(\"inviteId\"),\n action: v.pipe(\n InviteActionSchema,\n v.transform((v) => InviteActionCodec.inputToProto[v]),\n ),\n});\n\nexport type RespondSubaccountInviteInput = v.InferInput<typeof RespondSubaccountInviteInputSchema>;\n\nconst ProtoSubaccountStatusSchema = v.pipe(\n v.enum(Proto.SubaccountStatus),\n v.transform((status) =>\n requiredEnumLabel(\n SubaccountStatusCodec.protoToOutput,\n status,\n \"SubaccountSchema\",\n \"status\",\n ),\n ),\n);\n\nexport type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;\n\nexport const SubaccountSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n status: ProtoSubaccountStatusSchema,\n smartAccountAddress: v.string(),\n smartAccountSaltNonce: v.optional(v.number()),\n ownerUsername: v.optional(v.string(), \"\"),\n ownerAvatarUrl: v.optional(v.string(), \"\"),\n ownerRootSmartAccountAddress: v.string(),\n subaccountPolicyId: PublicIdSchema,\n requireMemberMfa: v.optional(v.boolean(), false),\n updatedAt: v.optional(TimestampSchema),\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...subaccount }) => ({\n ...subaccount,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type Subaccount = v.InferOutput<typeof SubaccountSchema>;\n\nexport const SubaccountMemberSchema = v.object({\n accountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n username: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n avatarUrl: v.optional(v.string(), \"\"),\n mfaEnrolled: v.optional(v.boolean(), false),\n});\n\nexport type SubaccountMember = v.InferOutput<typeof SubaccountMemberSchema>;\n\nexport const SubaccountInviteSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n subaccountId: PublicIdSchema,\n granteeAccountId: PublicIdSchema,\n inviterAccountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n status: v.pipe(\n ProtoInviteStatusSchema,\n v.transform((v) =>\n requiredEnumLabel(\n InviteStatusCodec.protoToOutput,\n v,\n \"SubaccountInviteSchema\",\n \"status\",\n ),\n ),\n ),\n createdAt: OptionalTimestampMsSchema,\n respondedAt: OptionalTimestampMsSchema,\n granteeUsername: v.optional(v.string(), \"\"),\n inviterUsername: v.optional(v.string(), \"\"),\n subaccountLabel: v.optional(v.string(), \"\"),\n inviterRootSmartAccountAddress: v.string(),\n granteeRootSmartAccountAddress: v.string(),\n requireMemberMfa: v.boolean(),\n }),\n v.transform(\n ({\n subaccountLabel,\n subaccountId,\n inviterRootSmartAccountAddress,\n granteeRootSmartAccountAddress,\n ...rest\n }) => ({\n ...rest,\n subaccountId,\n subaccountLabel,\n inviterSmartAccountAddress: inviterRootSmartAccountAddress,\n granteeSmartAccountAddress: granteeRootSmartAccountAddress,\n }),\n ),\n);\n\nexport type SubaccountInvite = v.InferOutput<typeof SubaccountInviteSchema>;\n\nexport const SubaccountActivityInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(200)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport type SubaccountActivityInput = v.InferInput<typeof SubaccountActivityInputSchema>;\n\nexport const SubaccountActivityEventSchema = v.object({\n createdAt: OptionalTimestampMsSchema,\n entityKind: v.pipe(\n v.enum(Proto.ActivityEntityKind),\n v.transform((value) =>\n requiredEnumLabel(\n ActivityEntityKindCodec.protoToOutput,\n value,\n \"SubaccountActivityEventSchema\",\n \"entity kind\",\n ),\n ),\n ),\n eventAction: v.pipe(\n v.enum(Proto.ActivityEventAction),\n v.transform((value) =>\n requiredEnumLabel(\n ActivityEventActionCodec.protoToOutput,\n value,\n \"SubaccountActivityEventSchema\",\n \"event action\",\n ),\n ),\n ),\n source: v.pipe(\n v.enum(Proto.ActivityEventSource),\n v.transform((value) =>\n requiredEnumLabel(\n ActivityEventSourceCodec.protoToOutput,\n value,\n \"SubaccountActivityEventSchema\",\n \"source\",\n ),\n ),\n ),\n ip: v.optional(v.string()),\n userAgent: v.optional(v.string()),\n actorAccountId: PublicIdSchema,\n payloadJson: v.pipe(\n v.string(),\n v.transform((v) => JSON.parse(v)),\n ),\n});\n\nexport type SubaccountEvent = v.InferOutput<typeof SubaccountActivityEventSchema>;\n"],"mappings":";;;;;;;;;AAoCA,MAAa,uBAAuB,EAAE,SAAS;CAR3C;CACA;CACA;CACA;CACA;CACA;AAG2C,CAAsB;AAIrE,MAAM,4BAA4B,EAAE,KAChC,EAAE,KAAKA,cAAoB,GAC3B,EAAE,WAAW,SACT,kBAAkB,oBAAoB,eAAe,MAAM,wBAAwB,MAAM,CAC7F,CACJ;AAEA,MAAM,kCAAkC,EAAE,KACtC,EAAE,KAAKC,oBAA0B,GACjC,EAAE,WAAW,eACT,kBACI,0BAA0B,eAC1B,YACA,8BACA,YACJ,CACJ,CACJ;AAIA,MAAa,uCAAuC,EAAE,O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AAG,EAAE;CACrF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC;AAID,MAAa,gCAAgC,EAAE,OAAO;CAClD,WAAW;CACX,YAAY,EAAE,KACV,EAAE,KAAKC,kBAAwB,GAC/B,EAAE,WAAW,UACT,kBACI,wBAAwB,eACxB,OACA,iCACA,aACJ,CACJ,CACJ;CACA,aAAa,EAAE,KACX,EAAE,KAAKC,mBAAyB,GAChC,EAAE,WAAW,UACT,kBACI,yBAAyB,eACzB,OACA,iCACA,cACJ,CACJ,CACJ;CACA,QAAQ,EAAE,KACN,EAAE,KAAKC,mBAAyB,GAChC,EAAE,WAAW,UACT,kBACI,yBAAyB,eACzB,OACA,iCACA,QACJ,CACJ,CACJ;CACA,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,gBAAgB;CAChB,aAAa,EAAE,KACX,EAAE,OAAO,GACT,EAAE,WAAW,MAAM,KAAK,MAAM,CAAC,CAAC,CACpC;AACJ,CAAC"}
1
+ {"version":3,"file":"subaccounts.schemas.js","names":["Proto.SubaccountRole","Proto.SubaccountPermission","ProtoPolicies.PolicyAction","Proto.SubaccountInviteStatus","Proto.SubaccountStatus","Proto.ActivityEntityKind","Proto.ActivityEventAction","Proto.ActivityEventSource"],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoPolicies from \"../../gen/auth/v1/policies_pb.js\";\nimport * as v from \"valibot\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n idInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n SubaccountRoleCodec,\n SubaccountPermissionCodec,\n InviteActionCodec,\n InviteStatusCodec,\n SubaccountInviteDirectionCodec,\n SUBACCOUNT_INVITE_DIRECTION_VALUES,\n SubaccountStatusCodec,\n SUBACCOUNT_STATUS_VALUES,\n ActivityEntityKindCodec,\n ActivityEventActionCodec,\n ActivityEventSourceCodec,\n} from \"./subaccounts.codecs.js\";\nimport { PolicyActionCodec } from \"../policies/shared.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\n\nexport const SubaccountRoleSchema = v.picklist(SUBACCOUNT_ROLE_VALUES);\n\nexport type SubaccountRole = v.InferOutput<typeof SubaccountRoleSchema>;\n\nconst ProtoSubaccountRoleSchema = v.pipe(\n v.enum(Proto.SubaccountRole),\n v.transform((role) =>\n requiredEnumLabel(SubaccountRoleCodec.protoToOutput, role, \"SubaccountRoleSchema\", \"role\"),\n ),\n);\n\nconst ProtoSubaccountPermissionSchema = v.pipe(\n v.enum(Proto.SubaccountPermission),\n v.transform((permission) =>\n requiredEnumLabel(\n SubaccountPermissionCodec.protoToOutput,\n permission,\n \"SubaccountPermissionSchema\",\n \"permission\",\n ),\n ),\n);\n\nexport type SubaccountPermission = v.InferOutput<typeof ProtoSubaccountPermissionSchema>;\n\nexport const SubaccountPermissionDefinitionSchema = v.object({\n permission: ProtoSubaccountPermissionSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n policyAction: v.pipe(\n v.enum(ProtoPolicies.PolicyAction),\n v.transform((action) =>\n requiredEnumLabel(\n PolicyActionCodec.protoToOutput,\n action,\n \"SubaccountPermissionDefinitionSchema\",\n \"policy action\",\n ),\n ),\n ),\n});\n\nexport type SubaccountPermissionDefinition = v.InferOutput<\n typeof SubaccountPermissionDefinitionSchema\n>;\n\nexport const SubaccountRoleDefinitionSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n assignable: v.optional(v.boolean(), false),\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n});\n\nexport type SubaccountRoleDefinition = v.InferOutput<typeof SubaccountRoleDefinitionSchema>;\n\nexport const SubaccountRoleCatalogSchema = v.object({\n permissions: v.optional(v.array(SubaccountPermissionDefinitionSchema), []),\n roles: v.optional(v.array(SubaccountRoleDefinitionSchema), []),\n});\n\nexport type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;\n\nexport const EffectiveSubaccountPermissionsSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n subaccountPolicyId: PublicIdSchema,\n});\n\nexport type EffectiveSubaccountPermissions = v.InferOutput<\n typeof EffectiveSubaccountPermissionsSchema\n>;\n\nexport const CreateSubaccountInputSchema = v.strictObject({\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type CreateSubaccountInput = v.InferInput<typeof CreateSubaccountInputSchema>;\n\nexport const SubaccountIdInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n});\n\nexport type SubaccountIdInput = v.InferInput<typeof SubaccountIdInputSchema>;\n\nexport const CreateSubaccountResultSchema = v.object({\n subaccountId: PublicIdSchema,\n totalCreated: v.number(),\n smartAccountSaltNonce: v.number(),\n revision: BigIntStringSchema,\n});\n\nexport type CreateSubaccountResult = v.InferOutput<typeof CreateSubaccountResultSchema>;\n\nexport const SubaccountMutationResultSchema = v.object({});\n\nexport type SubaccountMutationResult = v.InferOutput<typeof SubaccountMutationResultSchema>;\n\ntype SubaccountPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: (typeof SUBACCOUNT_STATUS_VALUES)[number];\n};\n\nconst SUBACCOUNT_PATCH_FIELDS = defineProtoPatchFields<SubaccountPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: SubaccountStatusCodec.inputToProto[status] }),\n },\n});\n\nexport const UpdateSubaccountInputSchema = v.pipe(\n v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(v.picklist(SUBACCOUNT_STATUS_VALUES)),\n }),\n v.check(\n ({ label, icon, color, status }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined,\n \"At least one subaccount field must be provided\",\n ),\n v.transform(({ subaccountId, expectedRevision, ...input }) => {\n const { patch: subaccount, updateMask } = buildProtoPatch(input, SUBACCOUNT_PATCH_FIELDS);\n return {\n subaccountId,\n subaccount,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type UpdateSubaccountInput = v.InferInput<typeof UpdateSubaccountInputSchema>;\n\nexport const InviteSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n role: v.pipe(\n SubaccountRoleSchema,\n v.transform((role) => SubaccountRoleCodec.inputToProto[role]),\n ),\n});\n\nexport type InviteSubaccountMemberInput = v.InferInput<typeof InviteSubaccountMemberInputSchema>;\n\nexport const RemoveSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n});\n\nexport type RemoveSubaccountMemberInput = v.InferInput<typeof RemoveSubaccountMemberInputSchema>;\n\nexport const UpdateSubaccountMemberRoleInputSchema = InviteSubaccountMemberInputSchema;\n\nexport type UpdateSubaccountMemberRoleInput = v.InferInput<\n typeof UpdateSubaccountMemberRoleInputSchema\n>;\n\nexport const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n requireMemberMfa: v.boolean(),\n});\n\nexport type SetSubaccountMemberMfaRequirementInput = v.InferInput<\n typeof SetSubaccountMemberMfaRequirementInputSchema\n>;\n\nexport const ListSubaccountInvitesInputSchema = v.strictObject({\n direction: v.pipe(\n v.optional(v.picklist(SUBACCOUNT_INVITE_DIRECTION_VALUES), \"\"),\n v.transform((direction) => SubaccountInviteDirectionCodec.inputToProto[direction]),\n ),\n});\n\nexport type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;\n\nconst InviteActionSchema = v.picklist([\"accept\", \"decline\", \"cancel\"]);\n\nconst InviteStatusSchema = v.picklist([\"pending\", \"accepted\", \"declined\", \"cancelled\"]);\n\nexport type SubaccountInviteStatus = v.InferOutput<typeof InviteStatusSchema>;\n\nconst ProtoInviteStatusSchema = v.enum(Proto.SubaccountInviteStatus);\n\nexport const RespondSubaccountInviteInputSchema = v.strictObject({\n inviteId: idInputSchema(\"inviteId\"),\n action: v.pipe(\n InviteActionSchema,\n v.transform((v) => InviteActionCodec.inputToProto[v]),\n ),\n});\n\nexport type RespondSubaccountInviteInput = v.InferInput<typeof RespondSubaccountInviteInputSchema>;\n\nconst ProtoSubaccountStatusSchema = v.pipe(\n v.enum(Proto.SubaccountStatus),\n v.transform((status) =>\n requiredEnumLabel(\n SubaccountStatusCodec.protoToOutput,\n status,\n \"SubaccountSchema\",\n \"status\",\n ),\n ),\n);\n\nexport type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;\n\nexport const SubaccountSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n status: ProtoSubaccountStatusSchema,\n smartAccountAddress: v.string(),\n smartAccountSaltNonce: v.optional(v.number()),\n ownerUsername: v.optional(v.string(), \"\"),\n ownerAvatarUrl: v.optional(v.string(), \"\"),\n ownerRootSmartAccountAddress: v.string(),\n subaccountPolicyId: PublicIdSchema,\n requireMemberMfa: v.optional(v.boolean(), false),\n updatedAt: v.optional(TimestampSchema),\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...subaccount }) => ({\n ...subaccount,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type Subaccount = v.InferOutput<typeof SubaccountSchema>;\n\nexport const SubaccountMemberSchema = v.object({\n accountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n username: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n avatarUrl: v.optional(v.string(), \"\"),\n mfaEnrolled: v.optional(v.boolean(), false),\n});\n\nexport type SubaccountMember = v.InferOutput<typeof SubaccountMemberSchema>;\n\nexport const SubaccountInviteSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n subaccountId: PublicIdSchema,\n granteeAccountId: PublicIdSchema,\n inviterAccountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n status: v.pipe(\n ProtoInviteStatusSchema,\n v.transform((v) =>\n requiredEnumLabel(\n InviteStatusCodec.protoToOutput,\n v,\n \"SubaccountInviteSchema\",\n \"status\",\n ),\n ),\n ),\n createdAt: OptionalTimestampMsSchema,\n respondedAt: OptionalTimestampMsSchema,\n granteeUsername: v.optional(v.string(), \"\"),\n inviterUsername: v.optional(v.string(), \"\"),\n subaccountLabel: v.optional(v.string(), \"\"),\n inviterRootSmartAccountAddress: v.string(),\n granteeRootSmartAccountAddress: v.string(),\n requireMemberMfa: v.boolean(),\n }),\n v.transform(\n ({\n subaccountLabel,\n subaccountId,\n inviterRootSmartAccountAddress,\n granteeRootSmartAccountAddress,\n ...rest\n }) => ({\n ...rest,\n subaccountId,\n subaccountLabel,\n inviterSmartAccountAddress: inviterRootSmartAccountAddress,\n granteeSmartAccountAddress: granteeRootSmartAccountAddress,\n }),\n ),\n);\n\nexport type SubaccountInvite = v.InferOutput<typeof SubaccountInviteSchema>;\n\nexport const SubaccountActivityInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(200)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport type SubaccountActivityInput = v.InferInput<typeof SubaccountActivityInputSchema>;\n\nexport const SubaccountActivityEventSchema = v.object({\n createdAt: OptionalTimestampMsSchema,\n entityKind: v.pipe(\n v.enum(Proto.ActivityEntityKind),\n v.transform((value) =>\n requiredEnumLabel(\n ActivityEntityKindCodec.protoToOutput,\n value,\n \"SubaccountActivityEventSchema\",\n \"entity kind\",\n ),\n ),\n ),\n eventAction: v.pipe(\n v.enum(Proto.ActivityEventAction),\n v.transform((value) =>\n requiredEnumLabel(\n ActivityEventActionCodec.protoToOutput,\n value,\n \"SubaccountActivityEventSchema\",\n \"event action\",\n ),\n ),\n ),\n source: v.pipe(\n v.enum(Proto.ActivityEventSource),\n v.transform((value) =>\n requiredEnumLabel(\n ActivityEventSourceCodec.protoToOutput,\n value,\n \"SubaccountActivityEventSchema\",\n \"source\",\n ),\n ),\n ),\n ip: v.optional(v.string()),\n userAgent: v.optional(v.string()),\n actorAccountId: PublicIdSchema,\n payloadJson: v.pipe(\n v.string(),\n v.transform((v) => JSON.parse(v)),\n ),\n});\n\nexport type SubaccountEvent = v.InferOutput<typeof SubaccountActivityEventSchema>;\n"],"mappings":";;;;;;;;;AAsCA,MAAa,uBAAuB,EAAE,SAAS;CAR3C;CACA;CACA;CACA;CACA;CACA;AAG2C,CAAsB;AAIrE,MAAM,4BAA4B,EAAE,KAChC,EAAE,KAAKA,cAAoB,GAC3B,EAA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,gCACA,GAAG,YACA;CACH,GAAG;CACH;CACA;CACA,4BAA4B;CAC5B,4BAA4B;AAChC,EACJ,CACJ;AAIA,MAAa,gCAAgC,EAAE,aAAa;CACxD,cAAc,cAAc,cAAc;CAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE;CACrF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC;AAID,MAAa,gCAAgC,EAAE,OAAO;CAClD,WAAW;CACX,YAAY,EAAE,KACV,EAAE,KAAKC,kBAAwB,GAC/B,EAAE,WAAW,UACT,kBACI,wBAAwB,eACxB,OACA,iCACA,aACJ,CACJ,CACJ;CACA,aAAa,EAAE,KACX,EAAE,KAAKC,mBAAyB,GAChC,EAAE,WAAW,UACT,kBACI,yBAAyB,eACzB,OACA,iCACA,cACJ,CACJ,CACJ;CACA,QAAQ,EAAE,KACN,EAAE,KAAKC,mBAAyB,GAChC,EAAE,WAAW,UACT,kBACI,yBAAyB,eACzB,OACA,iCACA,QACJ,CACJ,CACJ;CACA,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,gBAAgB;CAChB,aAAa,EAAE,KACX,EAAE,OAAO,GACT,EAAE,WAAW,MAAM,KAAK,MAAM,CAAC,CAAC,CACpC;AACJ,CAAC"}
@@ -809,7 +809,7 @@ type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInpu
809
809
  declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
810
810
  readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
811
811
  readonly symbolId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
812
- readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
812
+ readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
813
813
  readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop" | undefined, TriggerType>]>;
814
814
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
815
815
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
@@ -1030,7 +1030,7 @@ declare const ListTriggerEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictO
1030
1030
  readonly triggerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
1031
1031
  }, undefined>, v.TransformAction<{
1032
1032
  limit?: number | undefined;
1033
- eventType?: "failed" | "updated" | "fired" | "canceled" | undefined;
1033
+ eventType?: "updated" | "failed" | "fired" | "canceled" | undefined;
1034
1034
  pageToken: string;
1035
1035
  account?: "active" | "main" | {
1036
1036
  subaccountId: string;