@casual-simulation/aux-records 3.8.1 → 3.10.2

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 (239) hide show
  1. package/AIChatInterface.d.ts +7 -43
  2. package/AIChatInterface.js +8 -6
  3. package/AIChatInterface.js.map +1 -1
  4. package/AIController.js +44 -49
  5. package/AIController.js.map +1 -1
  6. package/AIOpenAIRealtimeInterface.d.ts +1 -1
  7. package/AnthropicAIChatInterface.js +4 -4
  8. package/AnthropicAIChatInterface.js.map +1 -1
  9. package/AuthController.d.ts +78 -10
  10. package/AuthController.js +230 -166
  11. package/AuthController.js.map +1 -1
  12. package/AuthStore.d.ts +317 -4
  13. package/BigIntPatch.d.ts +1 -0
  14. package/BigIntPatch.js +24 -0
  15. package/BigIntPatch.js.map +1 -0
  16. package/BlockadeLabsGenerateSkyboxInterface.js +4 -4
  17. package/BlockadeLabsGenerateSkyboxInterface.js.map +1 -1
  18. package/CachingConfigStore.d.ts +8 -1
  19. package/CachingConfigStore.js +50 -0
  20. package/CachingConfigStore.js.map +1 -1
  21. package/ComIdConfig.d.ts +132 -86
  22. package/ComIdConfig.js +5 -5
  23. package/ComIdConfig.js.map +1 -1
  24. package/ConfigurationStore.d.ts +1393 -3
  25. package/ConfigurationStore.js +49 -0
  26. package/ConfigurationStore.js.map +1 -1
  27. package/DataRecordsController.js +28 -28
  28. package/DataRecordsController.js.map +1 -1
  29. package/EventRecordsController.js +9 -9
  30. package/EventRecordsController.js.map +1 -1
  31. package/FileRecordsController.js +18 -17
  32. package/FileRecordsController.js.map +1 -1
  33. package/GoogleAIChatInterface.js +4 -4
  34. package/GoogleAIChatInterface.js.map +1 -1
  35. package/HttpTestUtils.d.ts +48 -0
  36. package/HttpTestUtils.js +256 -0
  37. package/HttpTestUtils.js.map +1 -0
  38. package/LivekitController.js +2 -2
  39. package/LivekitController.js.map +1 -1
  40. package/LoomController.js +3 -4
  41. package/LoomController.js.map +1 -1
  42. package/MemoryStore.d.ts +60 -7
  43. package/MemoryStore.js +427 -59
  44. package/MemoryStore.js.map +1 -1
  45. package/MetricsStore.d.ts +11 -0
  46. package/ModerationConfiguration.d.ts +11 -85
  47. package/ModerationConfiguration.js +17 -17
  48. package/ModerationConfiguration.js.map +1 -1
  49. package/ModerationController.js +9 -11
  50. package/ModerationController.js.map +1 -1
  51. package/OpenAIChatInterface.js +8 -13
  52. package/OpenAIChatInterface.js.map +1 -1
  53. package/OpenAIImageInterface.js +4 -5
  54. package/OpenAIImageInterface.js.map +1 -1
  55. package/PolicyController.js +66 -73
  56. package/PolicyController.js.map +1 -1
  57. package/PolicyStore.d.ts +59 -33
  58. package/PolicyStore.js +35 -1
  59. package/PolicyStore.js.map +1 -1
  60. package/PrivoClient.d.ts +3 -1
  61. package/PrivoClient.js +2 -4
  62. package/PrivoClient.js.map +1 -1
  63. package/PrivoConfiguration.d.ts +6 -72
  64. package/PrivoConfiguration.js +30 -31
  65. package/PrivoConfiguration.js.map +1 -1
  66. package/README.md +276 -2
  67. package/RateLimitController.js +2 -2
  68. package/RateLimitController.js.map +1 -1
  69. package/RecordsClient.d.ts +3 -1
  70. package/RecordsClient.js +6 -6
  71. package/RecordsClient.js.map +1 -1
  72. package/RecordsController.d.ts +145 -3
  73. package/RecordsController.js +399 -61
  74. package/RecordsController.js.map +1 -1
  75. package/RecordsServer.d.ts +1932 -1109
  76. package/RecordsStore.d.ts +99 -14
  77. package/RecordsStore.js +8 -10
  78. package/RecordsStore.js.map +1 -1
  79. package/ServerConfig.d.ts +698 -9867
  80. package/ServerConfig.js +457 -377
  81. package/ServerConfig.js.map +1 -1
  82. package/SloydInterface.js +1 -1
  83. package/SloydInterface.js.map +1 -1
  84. package/StabilityAIImageInterface.js +6 -9
  85. package/StabilityAIImageInterface.js.map +1 -1
  86. package/StripeInterface.d.ts +431 -287
  87. package/StripeInterface.js +21 -1
  88. package/StripeInterface.js.map +1 -1
  89. package/SubscriptionConfigBuilder.d.ts +10 -1
  90. package/SubscriptionConfigBuilder.js +72 -41
  91. package/SubscriptionConfigBuilder.js.map +1 -1
  92. package/SubscriptionConfiguration.d.ts +606 -6334
  93. package/SubscriptionConfiguration.js +460 -277
  94. package/SubscriptionConfiguration.js.map +1 -1
  95. package/SubscriptionController.d.ts +677 -4
  96. package/SubscriptionController.js +2986 -186
  97. package/SubscriptionController.js.map +1 -1
  98. package/SystemNotificationMessenger.d.ts +14 -70
  99. package/SystemNotificationMessenger.js +17 -20
  100. package/SystemNotificationMessenger.js.map +1 -1
  101. package/TestUtils.d.ts +18 -3
  102. package/TestUtils.js +84 -8
  103. package/TestUtils.js.map +1 -1
  104. package/TypeUtils.d.ts +991 -0
  105. package/TypeUtils.js +2 -0
  106. package/TypeUtils.js.map +1 -0
  107. package/Utils.d.ts +59 -0
  108. package/Utils.js +507 -3
  109. package/Utils.js.map +1 -1
  110. package/Validations.d.ts +24 -108
  111. package/Validations.js +62 -45
  112. package/Validations.js.map +1 -1
  113. package/ViewTemplateRenderer.d.ts +39 -0
  114. package/ViewTemplateRenderer.js +19 -0
  115. package/ViewTemplateRenderer.js.map +1 -0
  116. package/contracts/ContractRecordsController.d.ts +58 -0
  117. package/contracts/ContractRecordsController.js +144 -0
  118. package/contracts/ContractRecordsController.js.map +1 -0
  119. package/contracts/ContractRecordsStore.d.ts +285 -0
  120. package/contracts/ContractRecordsStore.js +19 -0
  121. package/contracts/ContractRecordsStore.js.map +1 -0
  122. package/contracts/MemoryContractRecordsStore.d.ts +27 -0
  123. package/contracts/MemoryContractRecordsStore.js +124 -0
  124. package/contracts/MemoryContractRecordsStore.js.map +1 -0
  125. package/contracts/index.d.ts +4 -0
  126. package/contracts/index.js +21 -0
  127. package/contracts/index.js.map +1 -0
  128. package/crud/CrudHelpers.d.ts +25 -26
  129. package/crud/CrudHelpers.js +1 -1
  130. package/crud/CrudHelpers.js.map +1 -1
  131. package/crud/CrudRecordsController.js +13 -16
  132. package/crud/CrudRecordsController.js.map +1 -1
  133. package/crud/CrudRecordsControllerTests.d.ts +2 -2
  134. package/crud/CrudRecordsControllerTests.js +605 -580
  135. package/crud/CrudRecordsControllerTests.js.map +1 -1
  136. package/crud/MemoryCrudRecordsStore.js +1 -2
  137. package/crud/MemoryCrudRecordsStore.js.map +1 -1
  138. package/crud/sub/MemorySubCrudRecordsStore.js +4 -6
  139. package/crud/sub/MemorySubCrudRecordsStore.js.map +1 -1
  140. package/crud/sub/SubCrudRecordsController.js +8 -8
  141. package/crud/sub/SubCrudRecordsController.js.map +1 -1
  142. package/database/DatabaseRecordsController.js +1 -2
  143. package/database/DatabaseRecordsController.js.map +1 -1
  144. package/database/SqliteDatabaseInterface.js +1 -2
  145. package/database/SqliteDatabaseInterface.js.map +1 -1
  146. package/dns/DNSDomainNameValidator.d.ts +11 -0
  147. package/dns/DNSDomainNameValidator.js +59 -0
  148. package/dns/DNSDomainNameValidator.js.map +1 -0
  149. package/dns/DomainNameValidator.d.ts +36 -0
  150. package/dns/DomainNameValidator.js +19 -0
  151. package/dns/DomainNameValidator.js.map +1 -0
  152. package/dns/index.d.ts +3 -0
  153. package/dns/index.js +20 -0
  154. package/dns/index.js.map +1 -0
  155. package/financial/FinancialController.d.ts +272 -0
  156. package/financial/FinancialController.js +762 -0
  157. package/financial/FinancialController.js.map +1 -0
  158. package/financial/FinancialInterface.d.ts +352 -0
  159. package/financial/FinancialInterface.js +642 -0
  160. package/financial/FinancialInterface.js.map +1 -0
  161. package/financial/FinancialStore.d.ts +186 -0
  162. package/financial/FinancialStore.js +19 -0
  163. package/financial/FinancialStore.js.map +1 -0
  164. package/financial/MemoryFinancialInterface.d.ts +23 -0
  165. package/financial/MemoryFinancialInterface.js +592 -0
  166. package/financial/MemoryFinancialInterface.js.map +1 -0
  167. package/financial/TigerBeetleFinancialInterface.d.ts +46 -0
  168. package/financial/TigerBeetleFinancialInterface.js +109 -0
  169. package/financial/TigerBeetleFinancialInterface.js.map +1 -0
  170. package/financial/TigerBeetleTestUtils.d.ts +40 -0
  171. package/financial/TigerBeetleTestUtils.js +185 -0
  172. package/financial/TigerBeetleTestUtils.js.map +1 -0
  173. package/financial/Types.d.ts +1 -0
  174. package/financial/Types.js +801 -0
  175. package/financial/Types.js.map +1 -0
  176. package/financial/index.d.ts +6 -0
  177. package/financial/index.js +24 -0
  178. package/financial/index.js.map +1 -0
  179. package/index.d.ts +4 -0
  180. package/index.js +3 -0
  181. package/index.js.map +1 -1
  182. package/notifications/NotificationRecordsController.js +14 -14
  183. package/notifications/NotificationRecordsController.js.map +1 -1
  184. package/notifications/WebPushInterface.d.ts +24 -155
  185. package/notifications/WebPushInterface.js +2 -2
  186. package/notifications/WebPushInterface.js.map +1 -1
  187. package/package.json +72 -70
  188. package/packages/version/MemoryPackageVersionRecordsStore.js +12 -15
  189. package/packages/version/MemoryPackageVersionRecordsStore.js.map +1 -1
  190. package/packages/version/PackageVersionRecordsController.d.ts +19 -0
  191. package/packages/version/PackageVersionRecordsController.js +102 -22
  192. package/packages/version/PackageVersionRecordsController.js.map +1 -1
  193. package/packages/version/PackageVersionRecordsStore.js +6 -8
  194. package/packages/version/PackageVersionRecordsStore.js.map +1 -1
  195. package/purchasable-items/MemoryPurchasableItemRecordsStore.d.ts +7 -0
  196. package/purchasable-items/MemoryPurchasableItemRecordsStore.js +33 -0
  197. package/purchasable-items/MemoryPurchasableItemRecordsStore.js.map +1 -0
  198. package/purchasable-items/PurchasableItemRecordsController.d.ts +16 -0
  199. package/purchasable-items/PurchasableItemRecordsController.js +72 -0
  200. package/purchasable-items/PurchasableItemRecordsController.js.map +1 -0
  201. package/purchasable-items/PurchasableItemRecordsStore.d.ts +66 -0
  202. package/purchasable-items/PurchasableItemRecordsStore.js +2 -0
  203. package/purchasable-items/PurchasableItemRecordsStore.js.map +1 -0
  204. package/purchasable-items/index.d.ts +4 -0
  205. package/purchasable-items/index.js +21 -0
  206. package/purchasable-items/index.js.map +1 -0
  207. package/queue/MemoryQueue.js +1 -1
  208. package/queue/MemoryQueue.js.map +1 -1
  209. package/search/MemorySearchInterface.js +1 -2
  210. package/search/MemorySearchInterface.js.map +1 -1
  211. package/search/SearchRecordsController.d.ts +66 -244
  212. package/search/SearchRecordsController.js +35 -36
  213. package/search/SearchRecordsController.js.map +1 -1
  214. package/search/SearchSyncProcessor.d.ts +7 -83
  215. package/search/TypesenseSearchInterface.js +8 -11
  216. package/search/TypesenseSearchInterface.js.map +1 -1
  217. package/tracing/TracingDecorators.js +5 -8
  218. package/tracing/TracingDecorators.js.map +1 -1
  219. package/webhooks/WebhookEnvironment.d.ts +36 -560
  220. package/webhooks/WebhookEnvironment.js +1 -1
  221. package/webhooks/WebhookEnvironment.js.map +1 -1
  222. package/webhooks/WebhookRecordsController.js +14 -16
  223. package/webhooks/WebhookRecordsController.js.map +1 -1
  224. package/websockets/MemoryLockStore.d.ts +18 -0
  225. package/websockets/MemoryLockStore.js +2 -0
  226. package/websockets/MemoryLockStore.js.map +1 -0
  227. package/websockets/MemoryTempInstRecordsStore.js +15 -27
  228. package/websockets/MemoryTempInstRecordsStore.js.map +1 -1
  229. package/websockets/MemoryWebsocketConnectionStore.js +6 -8
  230. package/websockets/MemoryWebsocketConnectionStore.js.map +1 -1
  231. package/websockets/MemoryWebsocketMessenger.js +1 -2
  232. package/websockets/MemoryWebsocketMessenger.js.map +1 -1
  233. package/websockets/SplitInstRecordsStore.js +2 -2
  234. package/websockets/SplitInstRecordsStore.js.map +1 -1
  235. package/websockets/WebsocketController.d.ts +5 -0
  236. package/websockets/WebsocketController.js +122 -83
  237. package/websockets/WebsocketController.js.map +1 -1
  238. package/RecordsServer.js +0 -6435
  239. package/RecordsServer.js.map +0 -1
@@ -1,10 +1,30 @@
1
1
  import type { AuthController, ValidateSessionKeyFailure } from './AuthController';
2
2
  import type { AuthStore } from './AuthStore';
3
- import type { StripeInterface } from './StripeInterface';
3
+ import type { StripeAccount, StripeInterface } from './StripeInterface';
4
4
  import type { NotAuthorizedError, NotLoggedInError, ServerError } from '@casual-simulation/aux-common/Errors';
5
5
  import type { RecordsStore } from './RecordsStore';
6
+ import type { StripeAccountStatus, StripeRequirementsStatus } from './StripeInterface';
6
7
  import type { ConfigurationStore } from './ConfigurationStore';
7
- import type { UserRole } from '@casual-simulation/aux-common';
8
+ import type { UserRole, DenialReason, Result, SimpleError, KnownErrorCodes, AccountBalance } from '@casual-simulation/aux-common';
9
+ import type { PurchasableItemRecordsStore } from './purchasable-items/PurchasableItemRecordsStore';
10
+ import type { AuthorizeSubjectFailure, ConstructAuthorizationContextFailure, PolicyController } from './PolicyController';
11
+ import type { PolicyStore } from './PolicyStore';
12
+ import type { AccountBalances, FinancialAccount, FinancialAccountFilter, FinancialController, FinancialStore, PayoutDestination } from './financial';
13
+ import { TransferCodes } from './financial';
14
+ import type { ContractInvoice, ContractRecord, ContractRecordsStore, InvoicePayoutDestination } from './contracts/ContractRecordsStore';
15
+ import type { Transfer } from 'tigerbeetle-node';
16
+ /**
17
+ * The number of bytes that the access key secret should be.
18
+ */
19
+ export declare const ACCESS_KEY_SECRET_BYTE_LENGTH = 16;
20
+ /**
21
+ * The number of bytes that the access key ID should be.
22
+ */
23
+ export declare const ACCESS_KEY_ID_BYTE_LENGTH = 16;
24
+ /**
25
+ * The number of seconds to wait before a Stripe payout transfer times out.
26
+ */
27
+ export declare const STRIPE_PAYOUT_TIMEOUT_SECONDS: number;
8
28
  /**
9
29
  * Defines a class that is able to handle subscriptions.
10
30
  */
@@ -14,13 +34,30 @@ export declare class SubscriptionController {
14
34
  private _authStore;
15
35
  private _recordsStore;
16
36
  private _config;
17
- constructor(stripe: StripeInterface | null, auth: AuthController, authStore: AuthStore, recordsStore: RecordsStore, config: ConfigurationStore);
37
+ private _policies;
38
+ private _policyStore;
39
+ private _purchasableItems;
40
+ private _financialController;
41
+ private _financialStore;
42
+ private _contractRecords;
43
+ constructor(stripe: StripeInterface | null, auth: AuthController, authStore: AuthStore, recordsStore: RecordsStore, config: ConfigurationStore, policies: PolicyController, policyStore: PolicyStore, purchasableItems: PurchasableItemRecordsStore, financialController: FinancialController | null, financialStore: FinancialStore | null, contractRecords: ContractRecordsStore);
18
44
  private _getConfig;
19
45
  /**
20
46
  * Gets the status of the given user's scription.
21
47
  * @param request
22
48
  */
23
49
  getSubscriptionStatus(request: GetSubscriptionStatusRequest): Promise<GetSubscriptionStatusResult>;
50
+ /**
51
+ * Gets the account balances for the user/studio/contract.
52
+ * @param request
53
+ */
54
+ getBalances(request: GetBalancesRequest): Promise<Result<AccountBalances, SimpleError>>;
55
+ private _checkAuthorizationForFilter;
56
+ /**
57
+ * Lists the transfers for the given account.
58
+ * @param request The request.
59
+ */
60
+ listAccountTransfers(request: ListAccountTransfersRequest): Promise<Result<ListedAccountTransfers, SimpleError>>;
24
61
  /**
25
62
  * Attempts to update the subscription for the given user.
26
63
  * @param request The request to update the subscription.
@@ -33,12 +70,140 @@ export declare class SubscriptionController {
33
70
  * Returns a link that the user can be redirected to to initiate a purchase of the subscription.
34
71
  */
35
72
  createManageSubscriptionLink(request: CreateManageSubscriptionRequest): Promise<CreateManageSubscriptionResult>;
73
+ /**
74
+ * Creates a link that the user can be redirected to in order to manage their store account.
75
+ * @param request The request to create the manage store account link.
76
+ * @returns
77
+ */
78
+ createManageStoreAccountLink(request: CreateManageStoreAccountLinkRequest): Promise<ManageAccountLinkResult>;
79
+ /**
80
+ * Creates a link that the user can be redirected to in order to manage their stripe XP account.
81
+ * @param request The request to create the manage xp account link.
82
+ */
83
+ createManageXpAccountLink(request: CreateManageXpAccountLinkRequest): Promise<ManageAccountLinkResult>;
84
+ /**
85
+ * Creates a link that the user can be redirected to in order to login to their stripe account.
86
+ * @param request The request to create the manage xp account link.
87
+ */
88
+ createStripeLoginLink(request: CreateStripeLoginLinkRequest): Promise<ManageAccountLinkResult>;
89
+ /**
90
+ * Creates a session that can be used to display stripe embedded components for the user.
91
+ * @param request The request to create the account session.
92
+ */
93
+ createStripeAccountSession(request: CreateStripeLoginLinkRequest): Promise<CreateStripeAccountSessionResult>;
36
94
  private _createCheckoutSession;
95
+ /**
96
+ * Creates a link that the user can be redirected to in order to purchase a purchasable item.
97
+ * @param request The request to create the purchase item link.
98
+ */
99
+ createPurchaseItemLink(request: CreatePurchaseItemLinkRequest): Promise<CreatePurchaseItemLinkResult>;
100
+ /**
101
+ * Gets the details required for purchasing a contract.
102
+ * @param request The request.
103
+ */
104
+ private _getContractPurchaseDetails;
105
+ /**
106
+ * Gets the pricing information for a contract.
107
+ * @param request The request.
108
+ */
109
+ getContractPricing(request: GetContractPricingRequest): Promise<Result<ContractPricing, SimpleError>>;
110
+ /**
111
+ * Creates a link that the user can be redirected to in order to purchase a contract.
112
+ * @param request The request to purchase the contract.
113
+ * @returns A promise that resolves to the result of the purchase contract operation.
114
+ */
115
+ purchaseContract(request: PurchaseContractRequest): Promise<PurchaseContractResult>;
116
+ /**
117
+ * Cancels a contract and issues a refund if applicable.
118
+ * @param request The request to cancel the contract.
119
+ * @returns A promise that resolves to the result of the cancel contract operation.
120
+ */
121
+ cancelContract(request: CancelContractRequest): Promise<CancelContractResult>;
122
+ /**
123
+ * Issues a new invoice for a contract.
124
+ * @param request The request to invoice the contract.
125
+ */
126
+ invoiceContract(request: InvoiceContractRequest): Promise<Result<{
127
+ invoiceId: string;
128
+ }, SimpleError>>;
129
+ /**
130
+ * Cancels an invoice for a contract.
131
+ * @param request The request to cancel the invoice.
132
+ */
133
+ cancelInvoice(request: CancelInvoiceRequest): Promise<Result<void, SimpleError>>;
134
+ /**
135
+ * Lists all invoices for a contract.
136
+ * @param request The request to list the invoices.
137
+ */
138
+ listContractInvoices(request: ListContractInvoicesRequest): Promise<Result<ContractInvoice[], SimpleError>>;
139
+ /**
140
+ * Pays an invoice for a contract.
141
+ * @param request The request to pay the invoice.
142
+ */
143
+ payContractInvoice(request: PayContractInvoiceRequest): Promise<Result<void, SimpleError>>;
144
+ /**
145
+ * Attempts to payout an account.
146
+ * @param request The request.
147
+ */
148
+ payoutAccount(request: InternalPayoutRequest): Promise<Result<{
149
+ payoutId: string;
150
+ }, SimpleError>>;
151
+ private _payoutToStripe;
152
+ private _payoutToCash;
153
+ /**
154
+ * Initiates a refund for a canceled contract.
155
+ * @param request The request to cancel the contract.
156
+ * @param item The contract record to refund.
157
+ * @param context The authorization context for the operation.
158
+ * @returns A promise that resolves to the result of the refund operation.
159
+ */
160
+ private _refundContract;
161
+ /**
162
+ * Completes a checkout session. Grants the user access to the purchased items or completes a contract purchase.
163
+ * @param request The request for the checkout session fulfillment.
164
+ * @returns A promise that resolves to the result of the checkout session fulfillment.
165
+ */
166
+ fulfillCheckoutSession(request: FulfillCheckoutSessionRequest): Promise<FulfillCheckoutSessionResult>;
167
+ claimActivationKey(request: ClaimActivationKeyRequest): Promise<ClaimActivationKeyResult>;
37
168
  /**
38
169
  * Handles the webhook from Stripe for updating the internal database.
39
170
  */
40
171
  handleStripeWebhook(request: HandleStripeWebhookRequest): Promise<HandleStripeWebhookResponse>;
172
+ private _handleStripeCheckoutSessionEvent;
173
+ private _handleStripeAccountUpdatedEvent;
174
+ private _handleStudioStripeAccountUpdatedEvent;
175
+ private _handleUserStripeAccountUpdatedEvent;
176
+ private _handleStripeInvoicePaidEvent;
177
+ private _internalTransactionPurchaseCreditsStripe;
178
+ private _handleStripeSubscriptionEvent;
41
179
  }
180
+ /**
181
+ * Gets the account status for the given stripe account.
182
+ * @param account The account that the status should be retrieved for.
183
+ */
184
+ export declare function getAccountStatus(account: StripeAccount): StripeAccountStatus;
185
+ /**
186
+ * Gets the requirements status for the given stripe account.
187
+ * @param account The account.
188
+ */
189
+ export declare function getAccountRequirementsStatus(account: StripeAccount): StripeRequirementsStatus;
190
+ /**
191
+ * Formats a V1 access key.
192
+ * @param itemId The ID of the purchased item.
193
+ * @param secret The secret that should be used to access the purchased item.
194
+ */
195
+ export declare function formatV1ActivationKey(itemId: string, secret: string): string;
196
+ /**
197
+ * Parses the given access key.
198
+ * Returns null if the access key is invalid.
199
+ * @param key The key to parse.
200
+ */
201
+ export declare function parseActivationKey(key: string): [keyId: string, secret: string];
202
+ /**
203
+ * Generates a human readable note for the given transfer.
204
+ * @param transfer The transfer that should be characterized.
205
+ */
206
+ export declare function charactarizeTransfer(transfer: Transfer): string | null;
42
207
  /**
43
208
  * Defines a request for managing a user's subscription.
44
209
  */
@@ -125,6 +290,12 @@ export interface GetSubscriptionStatusSuccess {
125
290
  * The list of subscriptions that the user can purchase.
126
291
  */
127
292
  purchasableSubscriptions: PurchasableSubscription[];
293
+ /**
294
+ * The account balances for the user.
295
+ *
296
+ * This will be undefined if the financial controller is not enabled.
297
+ */
298
+ accountBalances?: AccountBalances;
128
299
  }
129
300
  export interface SubscriptionStatus {
130
301
  /**
@@ -245,7 +416,7 @@ export interface GetSubscriptionStatusFailure {
245
416
  /**
246
417
  * The error code.
247
418
  */
248
- errorCode: ServerError | ValidateSessionKeyFailure['errorCode'] | 'unacceptable_user_id' | 'unacceptable_studio_id' | 'unacceptable_request' | 'not_supported';
419
+ errorCode: KnownErrorCodes;
249
420
  /**
250
421
  * The error message.
251
422
  */
@@ -316,4 +487,506 @@ export interface UpdateSubscriptionFailure {
316
487
  errorCode: ServerError | NotLoggedInError | NotAuthorizedError | 'user_not_found' | 'studio_not_found' | 'invalid_request';
317
488
  errorMessage: string;
318
489
  }
490
+ export interface CreateManageStoreAccountLinkRequest {
491
+ /**
492
+ * The ID of the studio that the link should be created for.
493
+ */
494
+ studioId: string;
495
+ /**
496
+ * The ID of the user that is currently logged in.
497
+ */
498
+ userId: string;
499
+ }
500
+ export interface CreateManageXpAccountLinkRequest {
501
+ /**
502
+ * The ID of the user that is currently logged in.
503
+ */
504
+ userId: string;
505
+ }
506
+ export interface CreateStripeLoginLinkRequest {
507
+ /**
508
+ * The ID of the user that is currently logged in.
509
+ */
510
+ userId: string;
511
+ /**
512
+ * The ID of the studio that the link should be created for.
513
+ * If not provided, the link will be created for the user's personal account.
514
+ */
515
+ studioId?: string;
516
+ }
517
+ export type ManageAccountLinkResult = Result<{
518
+ /**
519
+ * The URL that the user can visit to manage their account.
520
+ */
521
+ url: string;
522
+ }, SimpleError>;
523
+ export type CreateStripeAccountSessionResult = Result<{
524
+ /**
525
+ * The secret token that can be used to access the Stripe account session.
526
+ */
527
+ clientSecret: string;
528
+ /**
529
+ * The unix time in seconds that the session expires at.
530
+ */
531
+ expiresAt: number;
532
+ }, SimpleError>;
533
+ export interface CreatePurchaseItemLinkRequest {
534
+ /**
535
+ * The ID of the user that is currently logged in.
536
+ * Null if the user is not logged in.
537
+ */
538
+ userId: string | null;
539
+ /**
540
+ * The instances that the request is being made from.
541
+ */
542
+ instances: string[];
543
+ /**
544
+ * The item that is being purchased.
545
+ */
546
+ item: {
547
+ /**
548
+ * The name of the record that the item is stored in.
549
+ */
550
+ recordName: string;
551
+ /**
552
+ * The address of the item.
553
+ */
554
+ address: string;
555
+ /**
556
+ * The expected cost of the item.
557
+ */
558
+ expectedCost: number;
559
+ /**
560
+ * The currency that the cost is in.
561
+ */
562
+ currency: string;
563
+ };
564
+ /**
565
+ * The URL that the user should be redirected to if the purchase is canceled.
566
+ */
567
+ returnUrl: string;
568
+ /**
569
+ * The URL that the user should be redirected to if the purchase is unsuccessful.
570
+ */
571
+ successUrl: string;
572
+ }
573
+ export type PurchaseContractResult = Result<{
574
+ /**
575
+ * The URL that the user should be directed to to complete the purchase.
576
+ */
577
+ url?: string;
578
+ /**
579
+ * The ID of the checkout session.
580
+ */
581
+ sessionId: string;
582
+ }, SimpleError>;
583
+ export type CreatePurchaseItemLinkResult = CreatePurchaseItemLinkSuccess | CreatePurchaseItemLinkFailure;
584
+ export interface CreatePurchaseItemLinkSuccess {
585
+ success: true;
586
+ /**
587
+ * The URL that the user should be redirected to.
588
+ */
589
+ url: string;
590
+ /**
591
+ * The ID of the checkout session.
592
+ */
593
+ sessionId: string;
594
+ }
595
+ export interface CreatePurchaseItemLinkFailure {
596
+ success: false;
597
+ errorCode: ServerError | 'invalid_request' | 'not_supported' | 'item_not_found' | 'price_does_not_match' | 'store_disabled' | 'currency_not_supported' | 'subscription_limit_reached' | 'item_already_purchased' | ConstructAuthorizationContextFailure['errorCode'] | AuthorizeSubjectFailure['errorCode'];
598
+ errorMessage: string;
599
+ reason?: DenialReason;
600
+ }
601
+ export interface GetContractPricingRequest {
602
+ /**
603
+ * The ID of the user that is currently logged in.
604
+ * Null if the user is not logged in.
605
+ */
606
+ userId: string | null;
607
+ /**
608
+ * The instances that the request is being made from.
609
+ */
610
+ instances: string[];
611
+ /**
612
+ * The contract that is being purchased.
613
+ */
614
+ contract: {
615
+ /**
616
+ * The name of the record that the contract is stored in.
617
+ */
618
+ recordName: string;
619
+ /**
620
+ * The address of the contract.
621
+ */
622
+ address: string;
623
+ };
624
+ }
625
+ export interface ContractPricing {
626
+ /**
627
+ * The information for the contract.
628
+ */
629
+ contract: ContractRecord;
630
+ /**
631
+ * The total cost to purchase the contract.
632
+ */
633
+ total: number;
634
+ /**
635
+ * The line items that make up the total cost.
636
+ */
637
+ lineItems: ContractPricingLineItem[];
638
+ /**
639
+ * The currency that the cost is in.
640
+ */
641
+ currency: string;
642
+ }
643
+ export interface ContractPricingLineItem {
644
+ name: string;
645
+ amount: number;
646
+ }
647
+ export interface PurchaseContractRequest {
648
+ /**
649
+ * The ID of the user that is currently logged in.
650
+ * Null if the user is not logged in.
651
+ */
652
+ userId: string | null;
653
+ /**
654
+ * The instances that the request is being made from.
655
+ */
656
+ instances: string[];
657
+ /**
658
+ * The contract that is being purchased.
659
+ */
660
+ contract: {
661
+ /**
662
+ * The name of the record that the contract is stored in.
663
+ */
664
+ recordName: string;
665
+ /**
666
+ * The address of the contract.
667
+ */
668
+ address: string;
669
+ /**
670
+ * The expected cost of the contract.
671
+ */
672
+ expectedCost: number;
673
+ /**
674
+ * The currency that the cost is in.
675
+ */
676
+ currency: string;
677
+ };
678
+ /**
679
+ * The URL that the user should be redirected to if the purchase is canceled.
680
+ */
681
+ returnUrl: string;
682
+ /**
683
+ * The URL that the user should be redirected to if the purchase is unsuccessful.
684
+ */
685
+ successUrl: string;
686
+ }
687
+ export interface CancelContractRequest {
688
+ /**
689
+ * The ID of the user that is currently logged in.
690
+ * Null if the user is not logged in.
691
+ */
692
+ userId: string | null;
693
+ /**
694
+ * The instances that the request is being made from.
695
+ */
696
+ instances: string[];
697
+ /**
698
+ * The name of the record that the contract is stored in.
699
+ */
700
+ recordName: string;
701
+ /**
702
+ * The address of the contract that is being canceled.
703
+ */
704
+ address: string;
705
+ /**
706
+ * The ID of the account that the refund should be sent to.
707
+ * If not provided, then the refund will be sent to the account that owns the contract.
708
+ */
709
+ refundAccountId?: string;
710
+ }
711
+ export type CancelContractResult = Result<{
712
+ /**
713
+ * The amount that was refunded to the user.
714
+ */
715
+ refundedAmount: number;
716
+ /**
717
+ * The currency that the refunded amount is in.
718
+ */
719
+ refundCurrency: string;
720
+ }, SimpleError>;
721
+ export interface FulfillCheckoutSessionRequest {
722
+ /**
723
+ * The ID of the session that should be fulfilled.
724
+ */
725
+ sessionId: string;
726
+ /**
727
+ * The ID of the user that is currently logged in.
728
+ */
729
+ userId: string | null;
730
+ /**
731
+ * How the session should be fulfilled.
732
+ * - `now` indicates that the items should be granted to the user and activated imediately.
733
+ * Only valid if the user is logged in.
734
+ * - `later` indicates that an access key should be granted for the user to activate later.
735
+ */
736
+ activation: 'now' | 'later';
737
+ }
738
+ export type FulfillCheckoutSessionResult = FulfillCheckoutSessionSuccess | FulfillCheckoutSessionFailure;
739
+ export interface FulfillCheckoutSessionSuccess {
740
+ success: true;
741
+ /**
742
+ * The activation key that the user can use to activate the items later.
743
+ */
744
+ activationKey?: string;
745
+ /**
746
+ * The URL that the user can visit to activate the items.
747
+ */
748
+ activationUrl?: string;
749
+ }
750
+ export interface FulfillCheckoutSessionFailure {
751
+ success: false;
752
+ errorCode: ServerError | 'invalid_request' | 'not_supported' | 'not_authorized' | 'not_found';
753
+ errorMessage: string;
754
+ }
755
+ export interface ClaimActivationKeyRequest {
756
+ /**
757
+ * The key that should be claimed.
758
+ */
759
+ activationKey: string;
760
+ /**
761
+ * The target of the activation key.
762
+ *
763
+ * - `guest` indicates that the key should be claimed for a guest user.
764
+ * - `self` indicates that the key should be claimed for the user that is currently logged in.
765
+ */
766
+ target: 'guest' | 'self';
767
+ /**
768
+ * The ID of the user that is currently logged in.
769
+ */
770
+ userId: string | null;
771
+ /**
772
+ * The IP Address that the request is coming from.
773
+ */
774
+ ipAddress: string;
775
+ }
776
+ export type ClaimActivationKeyResult = ClaimActivationKeySuccess | ClaimActivationKeyFailure;
777
+ export interface ClaimActivationKeySuccess {
778
+ success: true;
779
+ /**
780
+ * The ID of the user that the key was claimed for.
781
+ */
782
+ userId: string;
783
+ /**
784
+ * The session key that was granted to the new user.
785
+ */
786
+ sessionKey?: string;
787
+ /**
788
+ * The connection key that was granted to the new user.
789
+ */
790
+ connectionKey?: string;
791
+ /**
792
+ * The time that the session key will expire.
793
+ */
794
+ expireTimeMs?: number;
795
+ }
796
+ export interface ClaimActivationKeyFailure {
797
+ success: false;
798
+ errorCode: ServerError | 'invalid_request' | 'not_supported' | 'not_authorized' | 'not_found' | 'not_logged_in';
799
+ errorMessage: string;
800
+ }
801
+ export interface ListAccountTransfersRequest {
802
+ /**
803
+ * The ID of the user that is currently logged in.
804
+ */
805
+ userId: string;
806
+ /**
807
+ * The role of the user that is currently logged in.
808
+ */
809
+ userRole?: UserRole | null;
810
+ /**
811
+ * The ID of the account to list transfers for.
812
+ */
813
+ accountId: string | bigint;
814
+ }
815
+ export interface ListedAccountTransfers {
816
+ accountDetails: FinancialAccount;
817
+ account: AccountBalance;
818
+ transfers: AccountTransfer[];
819
+ }
820
+ export interface AccountTransfer {
821
+ /**
822
+ * The ID of the transfer.
823
+ */
824
+ id: string;
825
+ /**
826
+ * The amount of the transfer in the smallest unit of the currency.
827
+ */
828
+ amount: bigint;
829
+ /**
830
+ * The ID of the account that the transfer was debited from.
831
+ */
832
+ debitAccountId: string;
833
+ /**
834
+ * The ID of the account that the transfer was credited to.
835
+ */
836
+ creditAccountId: string;
837
+ /**
838
+ * Whether the transfer is currently pending.
839
+ */
840
+ pending: boolean;
841
+ /**
842
+ * The code for the transfer.
843
+ */
844
+ code: TransferCodes;
845
+ /**
846
+ * The time of the transfer in miliseconds since the Unix epoch.
847
+ */
848
+ timeMs: number;
849
+ /**
850
+ * The ID of the transaction that the transfer belongs to.
851
+ */
852
+ transactionId?: string;
853
+ /**
854
+ * A helpful note for the transfer.
855
+ */
856
+ note?: string;
857
+ }
858
+ export interface GetBalancesRequest {
859
+ /**
860
+ * The ID of the user that is currently logged in.
861
+ */
862
+ userId: string;
863
+ /**
864
+ * The role of the user that is currently logged in.
865
+ */
866
+ userRole?: UserRole | null;
867
+ /**
868
+ * The filter that should be used to find the accounts.
869
+ */
870
+ filter: FinancialAccountFilter;
871
+ }
872
+ export interface InvoiceContractRequest {
873
+ /**
874
+ * The ID of the user that is currently logged in.
875
+ */
876
+ userId: string;
877
+ /**
878
+ * The role of the user that is currently logged in.
879
+ */
880
+ userRole: UserRole | null;
881
+ /**
882
+ * The ID of the contract that should be invoiced.
883
+ */
884
+ contractId: string;
885
+ /**
886
+ * The amount charged in the invoice.
887
+ */
888
+ amount: number;
889
+ /**
890
+ * The note that should be included with the invoice.
891
+ */
892
+ note: string | null;
893
+ /**
894
+ * Where the invoice payment should end up.
895
+ */
896
+ payoutDestination: InvoicePayoutDestination;
897
+ }
898
+ export interface PayContractInvoiceRequest {
899
+ /**
900
+ * The ID of the user that is currently logged in.
901
+ */
902
+ userId: string;
903
+ /**
904
+ * The role of the user that is currently logged in.
905
+ */
906
+ userRole: UserRole | null;
907
+ /**
908
+ * The ID of the invoice that should be paid.
909
+ */
910
+ invoiceId: string;
911
+ }
912
+ export interface VoidContractInvoiceRequest {
913
+ /**
914
+ * The ID of the user that is currently logged in.
915
+ */
916
+ userId: string;
917
+ /**
918
+ * The role of the user that is currently logged in.
919
+ */
920
+ userRole: UserRole | null;
921
+ /**
922
+ * The ID of the invoice that should be voided.
923
+ */
924
+ invoiceId: string;
925
+ }
926
+ export interface PayoutAccountRequest {
927
+ /**
928
+ * The ID of the currently logged in user.
929
+ */
930
+ userId: string | null;
931
+ /**
932
+ * The role of the user that is currently logged in.
933
+ */
934
+ userRole: UserRole | null;
935
+ /**
936
+ * The ID of the user that the payout is for.
937
+ */
938
+ payoutUserId?: string;
939
+ /**
940
+ * The ID of the studio that the payout is for.
941
+ */
942
+ payoutStudioId?: string;
943
+ /**
944
+ * The amount to payout in the smallest unit of the currency.
945
+ * If omitted, then the full available balance will be paid out.
946
+ */
947
+ payoutAmount?: number;
948
+ /**
949
+ * The destination that the payout should be sent to.
950
+ */
951
+ payoutDestination: PayoutDestination;
952
+ }
953
+ interface InternalPayoutRequest extends PayoutAccountRequest {
954
+ /**
955
+ * The ID of the invoice that the payout is for.
956
+ */
957
+ invoiceId?: string;
958
+ /**
959
+ * The ID of the contract that the payout is for.
960
+ */
961
+ contractId?: string;
962
+ }
963
+ export interface ListContractInvoicesRequest {
964
+ /**
965
+ * The ID of the user that is currently logged in.
966
+ */
967
+ userId: string;
968
+ /**
969
+ * The role of the user that is currently logged in.
970
+ */
971
+ userRole: UserRole | null;
972
+ /**
973
+ * The ID of the contract to list invoices for.
974
+ */
975
+ contractId: string;
976
+ }
977
+ export interface CancelInvoiceRequest {
978
+ /**
979
+ * The ID of the user that is currently logged in.
980
+ */
981
+ userId: string;
982
+ /**
983
+ * The role of the user that is currently logged in.
984
+ */
985
+ userRole: UserRole | null;
986
+ /**
987
+ * The ID of the invoice to cancel.
988
+ */
989
+ invoiceId: string;
990
+ }
991
+ export {};
319
992
  //# sourceMappingURL=SubscriptionController.d.ts.map