@casual-simulation/aux-records 3.8.2-alpha.19511653187 → 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
package/AuthStore.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { PrivacyFeatures, UserRole } from '@casual-simulation/aux-common';
2
2
  import type { RegexRule } from './Utils';
3
3
  import type { ServerError } from '@casual-simulation/aux-common/Errors';
4
4
  import type { AuthenticatorTransportFuture, CredentialDeviceType } from '@simplewebauthn/types';
5
+ import type { StripeAccountStatus, StripeRequirementsStatus } from './StripeInterface';
5
6
  /**
6
7
  * Defines an interface that represents an auth store.
7
8
  */
@@ -25,13 +26,19 @@ export interface AuthStore {
25
26
  * Finds the user that represents the given address.
26
27
  * @param address The address.
27
28
  * @param addressType The type of the address.
29
+ * @param loginStudioId The ID of the studio that the user is logging into.
28
30
  */
29
- findUserByAddress(address: string, addressType: AddressType): Promise<AuthUser | null>;
31
+ findUserByAddress(address: string, addressType: AddressType, loginStudioId?: string | null): Promise<AuthUser | null>;
30
32
  /**
31
33
  * Finds the user that is associated with the given Stripe Customer ID.
32
34
  * @param customerId The ID of the customer.
33
35
  */
34
36
  findUserByStripeCustomerId(customerId: string): Promise<AuthUser | null>;
37
+ /**
38
+ * Finds the user that is associated with the given Stripe Account ID.
39
+ * @param accountId The ID of the account.
40
+ */
41
+ findUserByStripeAccountId(accountId: string): Promise<AuthUser | null>;
35
42
  /**
36
43
  * Finds the user that is associated with the given Privo Service ID.
37
44
  * @param serviceId
@@ -199,6 +206,11 @@ export interface AuthStore {
199
206
  * @param id The ID of the invoice.
200
207
  */
201
208
  getInvoiceById(id: string): Promise<AuthInvoice | null>;
209
+ /**
210
+ * Gets the invoice with the given stripe ID.
211
+ * @param id The ID of the invoice.
212
+ */
213
+ getInvoiceByStripeId(id: string): Promise<AuthInvoice | null>;
202
214
  /**
203
215
  * Updates the subscription info for a user/studio.
204
216
  *
@@ -213,6 +225,23 @@ export interface AuthStore {
213
225
  * @param request The request.
214
226
  */
215
227
  updateSubscriptionPeriod(request: UpdateSubscriptionPeriodRequest): Promise<void>;
228
+ /**
229
+ * Updates the info for a checkout session.
230
+ * @param request The
231
+ */
232
+ updateCheckoutSessionInfo(request: UpdateCheckoutSessionRequest): Promise<void>;
233
+ /**
234
+ * Marks the checkout session with the given ID as fulfilled.
235
+ * @param sessionId The ID of the checkout session.
236
+ * @param fulfilledAtMs The unix time in miliseconds that the session was fulfilled at.
237
+ */
238
+ markCheckoutSessionFulfilled(sessionId: string, fulfilledAtMs: number): Promise<void>;
239
+ /**
240
+ * Gets the checkout session with the given ID.
241
+ * Returns null if the session could not be found.
242
+ * @param id The ID of the checkout session.
243
+ */
244
+ getCheckoutSessionById(id: string): Promise<AuthCheckoutSession | null>;
216
245
  /**
217
246
  * Gets the list of authenticators for the given user.
218
247
  * @param userId The ID of the user.
@@ -248,6 +277,27 @@ export interface AuthStore {
248
277
  * @param authenticatorId The ID of the authenticator that should be deleted.
249
278
  */
250
279
  deleteUserAuthenticator(userId: string, authenticatorId: string): Promise<number>;
280
+ /**
281
+ * Creates or updates the given purchased item.
282
+ * @param item The item.
283
+ */
284
+ savePurchasedItem(item: PurchasedItem): Promise<void>;
285
+ /**
286
+ * Gets the list of purchased items that are associated with the given activation key.
287
+ * @param keyId The ID of the key.
288
+ */
289
+ listPurchasedItemsByActivationKeyId(keyId: string): Promise<PurchasedItem[]>;
290
+ /**
291
+ * Creates the given activation key.
292
+ * @param key The key.
293
+ */
294
+ createActivationKey(key: ActivationKey): Promise<void>;
295
+ /**
296
+ * Gets the activation key with the given ID.
297
+ * Returns null if the key could not be found.
298
+ * @param keyId The ID of the key.
299
+ */
300
+ getActivationKeyById(keyId: string): Promise<ActivationKey | null>;
251
301
  }
252
302
  export type AddressType = 'email' | 'phone';
253
303
  export interface AuthUser {
@@ -341,6 +391,30 @@ export interface AuthUser {
341
391
  * The role that the user has been assigned in the system.
342
392
  */
343
393
  role?: UserRole;
394
+ /**
395
+ * The rate at which the user is requesting payment (null if not yet specified)
396
+ */
397
+ requestedRate?: number | null;
398
+ /**
399
+ * The user's connected stripe account ID.
400
+ */
401
+ stripeAccountId?: string | null;
402
+ /**
403
+ * The user's connected stripe account requirements status.
404
+ */
405
+ stripeAccountRequirementsStatus?: StripeRequirementsStatus | null;
406
+ /**
407
+ * The user's connected stripe account status.
408
+ */
409
+ stripeAccountStatus?: StripeAccountStatus | null;
410
+ /**
411
+ * The Studio that this user logs into.
412
+ * Used to differentiate between users who belong to the primary instance and users who belong to a comId.
413
+ * Note that this does not grant any permissions to the studio. It only separates users via comId.
414
+ *
415
+ * If null, then the user does not log into a studio, but instead logs into CasualOS proper.
416
+ */
417
+ loginStudioId?: string | null;
344
418
  }
345
419
  export interface AuthUserAuthenticator {
346
420
  /**
@@ -728,12 +802,19 @@ export interface AuthInvoice {
728
802
  stripeInvoiceId: string;
729
803
  /**
730
804
  * The ID of the subscription that this invoice is for.
805
+ * Null if no subscription is associated with this invoice.
731
806
  */
732
- subscriptionId: string;
807
+ subscriptionId: string | null;
808
+ /**
809
+ * The ID of the checkout session that this invoice is for.
810
+ * Null if no checkout session is associated with this invoice.
811
+ */
812
+ checkoutSessionId: string | null;
733
813
  /**
734
814
  * The ID of the subscription period that this invoice is for.
815
+ * Null if no subscription period is associated with this invoice.
735
816
  */
736
- periodId: string;
817
+ periodId: string | null;
737
818
  /**
738
819
  * The description of the invoice.
739
820
  */
@@ -864,7 +945,7 @@ export interface UpdateSubscriptionPeriodRequest {
864
945
  /**
865
946
  * The invoice that should be created.
866
947
  */
867
- invoice: Omit<AuthInvoice, 'id' | 'subscriptionId' | 'periodId'>;
948
+ invoice: Omit<AuthInvoice, 'id' | 'subscriptionId' | 'periodId' | 'checkoutSessionId'>;
868
949
  }
869
950
  /**
870
951
  * Defines metadata that is included after a user successfully logs in.
@@ -897,4 +978,236 @@ export interface UserLoginMetadata {
897
978
  */
898
979
  pushSubscriptionIds: string[];
899
980
  }
981
+ /**
982
+ * Defines an interface that represents a checkout session for a purchasable item.
983
+ */
984
+ export interface AuthCheckoutSession {
985
+ /**
986
+ * The ID of the session.
987
+ */
988
+ id: string;
989
+ /**
990
+ * Whether the checkout session has been paid for or not.
991
+ */
992
+ paid: boolean;
993
+ /**
994
+ * The items that are in the checkout session.
995
+ */
996
+ items: AuthCheckoutSessionItem[];
997
+ /**
998
+ * The unix time in miliseconds that the checkout session has been fulfilled at by
999
+ * granting the user access to their items.
1000
+ *
1001
+ * For contracts, this means opening the contract.
1002
+ */
1003
+ fulfilledAtMs: number | null;
1004
+ /**
1005
+ * The status of the checkout session.
1006
+ */
1007
+ stripeStatus: CheckoutSessionStatus;
1008
+ /**
1009
+ * The payment status of the checkout session.
1010
+ */
1011
+ stripePaymentStatus: CheckoutSessionPaymentStatus;
1012
+ /**
1013
+ * The ID of the stripe checkout session that is associated with this session.
1014
+ * If null, then the session is not associated with a stripe checkout session.
1015
+ */
1016
+ stripeCheckoutSessionId: string | null;
1017
+ /**
1018
+ * The ID of the user that the checkout session is for.
1019
+ */
1020
+ userId: string | null;
1021
+ /**
1022
+ * The ID of the invoice that the session has.
1023
+ * Null if no invoice was created for the checkout session.
1024
+ */
1025
+ invoiceId: string | null;
1026
+ /**
1027
+ * The transaction ID that should be associated with the checkout session.
1028
+ */
1029
+ transactionId?: string | null;
1030
+ /**
1031
+ * The transfers that have been posted for the checkout session.
1032
+ */
1033
+ transferIds?: string[] | null;
1034
+ /**
1035
+ * Wether the transfers are currently pending.
1036
+ */
1037
+ transfersPending?: boolean;
1038
+ /**
1039
+ * Whether the checkout session should be automatically fulfilled once payment completes.
1040
+ */
1041
+ shouldBeAutomaticallyFulfilled?: boolean;
1042
+ }
1043
+ export type AuthCheckoutSessionItem = AuthCheckoutSessionRoleItem | AuthCheckoutSessionContractItem;
1044
+ export interface AuthCheckoutSessionRoleItem {
1045
+ /**
1046
+ * The type of the item.
1047
+ */
1048
+ type: 'role';
1049
+ /**
1050
+ * The name of the record that the role is being purchased in.
1051
+ */
1052
+ recordName: string;
1053
+ /**
1054
+ * The address of the purchasable item.
1055
+ */
1056
+ purchasableItemAddress: string;
1057
+ /**
1058
+ * The role that is being purchased.
1059
+ */
1060
+ role: string;
1061
+ /**
1062
+ * The number of miliseconds that the role is being purchased for.
1063
+ */
1064
+ roleGrantTimeMs: number | null;
1065
+ }
1066
+ export interface AuthCheckoutSessionContractItem {
1067
+ type: 'contract';
1068
+ /**
1069
+ * The name of the record that the contract is being purchased in.
1070
+ */
1071
+ recordName: string;
1072
+ /**
1073
+ * The address of the contract.
1074
+ */
1075
+ contractAddress: string;
1076
+ /**
1077
+ * The ID of the contract that is being purchased.
1078
+ */
1079
+ contractId: string;
1080
+ /**
1081
+ * The value of the contract being purchased.
1082
+ */
1083
+ value: number;
1084
+ }
1085
+ /**
1086
+ * The status of the stripe checkout session.
1087
+ */
1088
+ export type CheckoutSessionStatus = 'open' | 'expired' | 'complete';
1089
+ /**
1090
+ * The payment status of the checkout session.
1091
+ *
1092
+ * - "no_payment_required" - The checkout session does not require payment via Stripe.
1093
+ * - "paid" - The checkout session has been paid for.
1094
+ * - "unpaid" - The checkout session has not been paid for.
1095
+ */
1096
+ export type CheckoutSessionPaymentStatus = 'no_payment_required' | 'paid' | 'unpaid';
1097
+ /**
1098
+ * Defines an interface that represents an item that has been purchased.
1099
+ */
1100
+ export interface PurchasedItem {
1101
+ /**
1102
+ * The ID of the item.
1103
+ */
1104
+ id: string;
1105
+ /**
1106
+ * The name of the record that the item was purchased from.
1107
+ */
1108
+ recordName: string;
1109
+ /**
1110
+ * The address of the purchasable item.
1111
+ */
1112
+ purchasableItemAddress: string;
1113
+ /**
1114
+ * The ID of the user that purchased the item.
1115
+ * Null if the purchase wasn't associated with a user (purchased by a guest or purchased as an access key).
1116
+ */
1117
+ userId: string | null;
1118
+ /**
1119
+ * The ID of the checkout session that the item was purchased through.
1120
+ * Null if the purchase wasn't associated with a checkout session.
1121
+ */
1122
+ checkoutSessionId: string | null;
1123
+ /**
1124
+ * The name of the role that is granted by the purchasable item.
1125
+ */
1126
+ roleName: string;
1127
+ /**
1128
+ * The number of miliseconds that the role is granted for.
1129
+ * If null, then the role is granted indefinitely.
1130
+ */
1131
+ roleGrantTimeMs: number | null;
1132
+ /**
1133
+ * The unix timestamp in miliseconds when the item was activated.
1134
+ * Null if the item has not been activated.
1135
+ */
1136
+ activatedTimeMs: number | null;
1137
+ /**
1138
+ * The ID of the activation key that was used to activate the item.
1139
+ * Null if the item is associated with a user.
1140
+ */
1141
+ activationKeyId: string | null;
1142
+ }
1143
+ /**
1144
+ * Defines an interface for a key that can be used to activate a purchased item.
1145
+ */
1146
+ export interface ActivationKey {
1147
+ /**
1148
+ * The ID of the activation key.
1149
+ */
1150
+ id: string;
1151
+ /**
1152
+ * The hash of the secret for the key.
1153
+ */
1154
+ secretHash: string;
1155
+ }
1156
+ export interface UpdateCheckoutSessionRequest {
1157
+ /**
1158
+ * The ID of the session.
1159
+ */
1160
+ id: string;
1161
+ /**
1162
+ * The status of the checkout session.
1163
+ */
1164
+ status: CheckoutSessionStatus;
1165
+ /**
1166
+ * The payment status of the checkout session.
1167
+ */
1168
+ paymentStatus: CheckoutSessionPaymentStatus;
1169
+ /**
1170
+ * Whether the checkout session has been paid for or not.
1171
+ */
1172
+ paid: boolean;
1173
+ /**
1174
+ * The items in the session.
1175
+ */
1176
+ items: AuthCheckoutSessionItem[];
1177
+ /**
1178
+ * The ID of the stripe checkout session that is associated with this session.
1179
+ * If null, then the session is not associated with a stripe checkout session.
1180
+ */
1181
+ stripeCheckoutSessionId: string | null;
1182
+ /**
1183
+ * The ID of the user that the checkout session is for.
1184
+ */
1185
+ userId: string | null;
1186
+ /**
1187
+ * The unix time in miliseconds that the checkout session was fulfilled at.
1188
+ */
1189
+ fulfilledAtMs: number | null;
1190
+ /**
1191
+ * The invoice that should be created/updated.
1192
+ * If null, then the invoice will not be created/updated.
1193
+ */
1194
+ invoice: Omit<AuthInvoice, 'id' | 'subscriptionId' | 'periodId' | 'checkoutSessionId'> | null;
1195
+ /**
1196
+ * The transaction ID that should be associated with the checkout session.
1197
+ */
1198
+ transactionId?: string | null;
1199
+ /**
1200
+ * The transfers that have been posted for the checkout session.
1201
+ */
1202
+ transferIds?: string[] | null;
1203
+ /**
1204
+ * Wether the transfers are currently pending.
1205
+ * Defaults to false.
1206
+ */
1207
+ transfersPending?: boolean;
1208
+ /**
1209
+ * Whether the checkout session should be automatically fulfilled once payment completes.
1210
+ */
1211
+ shouldBeAutomaticallyFulfilled?: boolean;
1212
+ }
900
1213
  //# sourceMappingURL=AuthStore.d.ts.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=BigIntPatch.d.ts.map
package/BigIntPatch.js ADDED
@@ -0,0 +1,24 @@
1
+ /* CasualOS is a set of web-based tools designed to facilitate the creation of real-time, multi-user, context-aware interactive experiences.
2
+ *
3
+ * Copyright (c) 2019-2025 Casual Simulation, Inc.
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as
7
+ * published by the Free Software Foundation, either version 3 of the
8
+ * License, or (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ if (typeof BigInt.prototype.toJSON === 'undefined') {
19
+ // Fix for BigInt serialization in JSON.stringify
20
+ BigInt.prototype.toJSON = function () {
21
+ return this.toString();
22
+ };
23
+ }
24
+ //# sourceMappingURL=BigIntPatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BigIntPatch.js","sourceRoot":"","sources":["BigIntPatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,IAAI,OAAQ,MAAM,CAAC,SAAiB,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;IAC1D,iDAAiD;IAChD,MAAM,CAAC,SAAiB,CAAC,MAAM,GAAG;QAC/B,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC"}
@@ -71,8 +71,8 @@ export class BlockadeLabsGenerateSkyboxInterface {
71
71
  }
72
72
  catch (err) {
73
73
  const span = trace.getActiveSpan();
74
- span === null || span === void 0 ? void 0 : span.recordException(err);
75
- span === null || span === void 0 ? void 0 : span.setStatus({ code: SpanStatusCode.ERROR });
74
+ span?.recordException(err);
75
+ span?.setStatus({ code: SpanStatusCode.ERROR });
76
76
  handleAxiosErrors(err);
77
77
  }
78
78
  }
@@ -91,8 +91,8 @@ export class BlockadeLabsGenerateSkyboxInterface {
91
91
  }
92
92
  catch (err) {
93
93
  const span = trace.getActiveSpan();
94
- span === null || span === void 0 ? void 0 : span.recordException(err);
95
- span === null || span === void 0 ? void 0 : span.setStatus({ code: SpanStatusCode.ERROR });
94
+ span?.recordException(err);
95
+ span?.setStatus({ code: SpanStatusCode.ERROR });
96
96
  handleAxiosErrors(err);
97
97
  }
98
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BlockadeLabsGenerateSkyboxInterface.js","sourceRoot":"","sources":["BlockadeLabsGenerateSkyboxInterface.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAO5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAErE,MAAM,UAAU,GAAG,qCAAqC,CAAC;AACzD,MAAM,YAAY,GAAgB;IAC9B,IAAI,EAAE,QAAQ,CAAC,MAAM;IACrB,UAAU,EAAE;QACR,cAAc,EAAE,cAAc;QAC9B,cAAc,EAAE,cAAc;KACjC;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAK5C,YAAY,OAAmD;QAC3D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CAChB,OAAyC;QAEzC,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;gBAC/B,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;gBAC7B,MAAM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D,EAAE,EAAE,EAChE;YACI,OAAO,EAAE;gBACL,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;aACpC;SACJ,CACJ,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,CAAC;CACJ;AAhGS;IADL,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;yEAuDhC;AAGK;IADL,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;oEAyBhC;AAmCL,SAAS,UAAU,CAAC,MAAgC;IAChD,OAAO,CACH,MAAM,CAAC,MAAM,KAAK,UAAU;QAC5B,MAAM,CAAC,MAAM,KAAK,OAAO;QACzB,MAAM,CAAC,MAAM,KAAK,OAAO,CAC5B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,MAAgC;IAC7C,OAAO,MAAM,CAAC,MAAM,KAAK,OAAO,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,CAAC;AAClE,CAAC"}
@@ -1,8 +1,11 @@
1
1
  import type { PrivoConfiguration } from './PrivoConfiguration';
2
2
  import type { Cache } from './Cache';
3
- import type { ConfigurationStore } from './ConfigurationStore';
3
+ import type { ConfigurationInput, ConfigurationKey, ConfigurationOutput } from './ConfigurationStore';
4
+ import { type ConfigurationStore } from './ConfigurationStore';
4
5
  import type { SubscriptionConfiguration } from './SubscriptionConfiguration';
5
6
  import type { ModerationConfiguration } from './ModerationConfiguration';
7
+ import type { WebConfig } from '@casual-simulation/aux-common';
8
+ import type { WebManifest } from '@casual-simulation/aux-common/common/WebManifest';
6
9
  /**
7
10
  * Defines a config store that uses a cache.
8
11
  */
@@ -17,6 +20,10 @@ export declare class CachingConfigStore implements ConfigurationStore {
17
20
  * @param cacheSeconds The number of seconds that cache entries should be stored.
18
21
  */
19
22
  constructor(store: ConfigurationStore, cache: Cache, cacheSeconds: number);
23
+ setConfiguration<TKey extends ConfigurationKey>(key: TKey, value: ConfigurationInput<TKey>): Promise<void>;
24
+ getConfiguration<TKey extends ConfigurationKey>(key: TKey, defaultValue?: ConfigurationInput<TKey>): Promise<ConfigurationOutput<TKey> | null>;
25
+ getWebConfig(): Promise<WebConfig | null>;
26
+ getPlayerWebManifest(): Promise<WebManifest | null>;
20
27
  getSubscriptionConfiguration(): Promise<SubscriptionConfiguration>;
21
28
  getPrivoConfiguration(): Promise<PrivoConfiguration>;
22
29
  getModerationConfig(): Promise<ModerationConfiguration>;
@@ -4,6 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ import { PLAYER_WEB_MANIFEST_KEY, WEB_CONFIG_KEY, } from './ConfigurationStore';
7
8
  import { traced } from './tracing/TracingDecorators';
8
9
  const TRACE_NAME = 'CachingConfigStore';
9
10
  /**
@@ -21,6 +22,43 @@ export class CachingConfigStore {
21
22
  this._cache = cache;
22
23
  this._cacheSeconds = cacheSeconds;
23
24
  }
25
+ async setConfiguration(key, value) {
26
+ await this._cache.remove(key);
27
+ await this._store.setConfiguration(key, value);
28
+ }
29
+ async getConfiguration(key, defaultValue) {
30
+ const cached = await this._cache.retrieve(key);
31
+ if (cached) {
32
+ return cached;
33
+ }
34
+ const result = await this._store.getConfiguration(key, defaultValue);
35
+ if (result) {
36
+ await this._cache.store(key, result, this._cacheSeconds);
37
+ }
38
+ return result;
39
+ }
40
+ async getWebConfig() {
41
+ const cached = await this._cache.retrieve(WEB_CONFIG_KEY);
42
+ if (cached) {
43
+ return cached;
44
+ }
45
+ const result = await this._store.getWebConfig();
46
+ if (result) {
47
+ await this._cache.store(WEB_CONFIG_KEY, result, this._cacheSeconds);
48
+ }
49
+ return result;
50
+ }
51
+ async getPlayerWebManifest() {
52
+ const cached = await this._cache.retrieve(PLAYER_WEB_MANIFEST_KEY);
53
+ if (cached) {
54
+ return cached;
55
+ }
56
+ const result = await this._store.getPlayerWebManifest();
57
+ if (result) {
58
+ await this._cache.store(PLAYER_WEB_MANIFEST_KEY, result, this._cacheSeconds);
59
+ }
60
+ return result;
61
+ }
24
62
  async getSubscriptionConfiguration() {
25
63
  const cached = await this._cache.retrieve('subscriptions');
26
64
  if (cached) {
@@ -55,6 +93,18 @@ export class CachingConfigStore {
55
93
  return result;
56
94
  }
57
95
  }
96
+ __decorate([
97
+ traced(TRACE_NAME)
98
+ ], CachingConfigStore.prototype, "setConfiguration", null);
99
+ __decorate([
100
+ traced(TRACE_NAME)
101
+ ], CachingConfigStore.prototype, "getConfiguration", null);
102
+ __decorate([
103
+ traced(TRACE_NAME)
104
+ ], CachingConfigStore.prototype, "getWebConfig", null);
105
+ __decorate([
106
+ traced(TRACE_NAME)
107
+ ], CachingConfigStore.prototype, "getPlayerWebManifest", null);
58
108
  __decorate([
59
109
  traced(TRACE_NAME)
60
110
  ], CachingConfigStore.prototype, "getSubscriptionConfiguration", null);
@@ -1 +1 @@
1
- {"version":3,"file":"CachingConfigStore.js","sourceRoot":"","sources":["CachingConfigStore.ts"],"names":[],"mappings":";;;;;;AAsBA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAK3B;;;;;OAKG;IACH,YAAY,KAAyB,EAAE,KAAY,EAAE,YAAoB;QACrE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACtC,CAAC;IAGK,AAAN,KAAK,CAAC,4BAA4B;QAC9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CACrC,eAAe,CAClB,CAAC;QAEF,IAAI,MAAM,EAAE,CAAC;YACT,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,MA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