@indiegems/gem-web-sdk 5.12.0 → 7.0.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.
@@ -12,6 +12,8 @@ interface TransportRequest {
12
12
  readonly method: "GET" | "PUT" | "POST" | "PATCH" | "DELETE";
13
13
  readonly path: string;
14
14
  readonly body?: unknown;
15
+ readonly bytes?: Uint8Array;
16
+ readonly responseType?: "json" | "bytes";
15
17
  readonly headers?: ConditionalRequestHeaders;
16
18
  readonly signal?: AbortSignal;
17
19
  readonly keepalive?: boolean;
@@ -21,6 +23,7 @@ interface TransportResponse {
21
23
  readonly body: unknown;
22
24
  readonly etag?: string;
23
25
  readonly retryAfterSeconds?: number;
26
+ readonly invocationId?: string;
24
27
  }
25
28
  interface Transport {
26
29
  request(request: TransportRequest): Promise<TransportResponse>;
@@ -50,6 +53,10 @@ type VersionedResponse<T> = {
50
53
  readonly modified: false;
51
54
  readonly etag?: string;
52
55
  };
56
+ interface BytesResponse {
57
+ readonly bytes: Uint8Array;
58
+ readonly invocationId?: string;
59
+ }
53
60
  declare class GemClient {
54
61
  private readonly options;
55
62
  constructor(options: ClientOptions);
@@ -57,6 +64,7 @@ declare class GemClient {
57
64
  getWithEtag<T>(path: string, options?: VersionedGetOptions): Promise<VersionedResponse<T>>;
58
65
  put<T>(path: string, body: unknown, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
59
66
  post<T>(path: string, body: unknown, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
67
+ postBytes(path: string, bytes: Uint8Array, signal?: AbortSignal, options?: RequestOptions): Promise<BytesResponse>;
60
68
  patch<T>(path: string, body: unknown, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
61
69
  delete<T>(path: string, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
62
70
  private send;
@@ -67,6 +75,7 @@ interface GameApi {
67
75
  readonly client: GemClient;
68
76
  gameId(): string;
69
77
  }
78
+ type AchievementUnlockOutcome = "unlocked" | "already_unlocked" | "suppressed";
70
79
  type ActiveWindowResponse = {
71
80
  "ends_at": string;
72
81
  "window_id": string;
@@ -92,6 +101,28 @@ type AdminActionRequest = {
92
101
  "hearing_radius"?: number | null;
93
102
  "max_voices"?: number | null;
94
103
  };
104
+ type AnalyticsBatchRequest = {
105
+ "batch_id": string;
106
+ "events": AnalyticsEventSubmission[];
107
+ "sent_at_ms": number;
108
+ };
109
+ type AnalyticsBatchResponse = {
110
+ "accepted": number;
111
+ "duplicate"?: boolean;
112
+ "rejected"?: AnalyticsRejection[];
113
+ };
114
+ type AnalyticsEventSubmission = {
115
+ "dimensions"?: Record<string, unknown>;
116
+ "event_uid": string;
117
+ "measures"?: Record<string, unknown>;
118
+ "name": string;
119
+ "offset_ms": number;
120
+ "player_id"?: string | null;
121
+ };
122
+ type AnalyticsRejection = {
123
+ "code": string;
124
+ "index": number;
125
+ };
95
126
  type BatchOrderItem = {
96
127
  "nonce"?: string | null;
97
128
  "operations": OperationRequest[];
@@ -118,6 +149,8 @@ type BatchOrderResponse = {
118
149
  type BucketBalanceResponse = {
119
150
  "balance": number;
120
151
  "bucket": string;
152
+ "last_reset_at"?: number | null;
153
+ "next_reset_at"?: number | null;
121
154
  };
122
155
  type CatalogItem = {
123
156
  "consumable": boolean;
@@ -125,9 +158,14 @@ type CatalogItem = {
125
158
  "fungible": boolean;
126
159
  "icon_url"?: string | null;
127
160
  "item_id": string;
128
- "platform_prices": PurchasePrice[];
161
+ "platform_prices": CatalogPrice[];
129
162
  "stack_size"?: number | null;
130
163
  };
164
+ type CatalogPrice = {
165
+ "platform_currency_id": string;
166
+ "price": number;
167
+ "unconfirmed_spend": boolean;
168
+ };
131
169
  type CatalogRecipe = {
132
170
  "availability_end"?: string | null;
133
171
  "availability_start"?: string | null;
@@ -135,7 +173,7 @@ type CatalogRecipe = {
135
173
  "cooldown_seconds"?: number | null;
136
174
  "display_name"?: string | null;
137
175
  "max_uses"?: number | null;
138
- "platform_prices": PurchasePrice[];
176
+ "platform_prices": CatalogPrice[];
139
177
  "recipe_id": string;
140
178
  "recipe_type": string;
141
179
  };
@@ -253,6 +291,7 @@ type GameRoomMemberResponseV2 = {
253
291
  "role": string;
254
292
  };
255
293
  type GameRoomResponseV2 = {
294
+ "cluster_target_id"?: string | null;
256
295
  "created_at": number;
257
296
  "game_channel": string;
258
297
  "game_id": string;
@@ -266,7 +305,6 @@ type GameRoomResponseV2 = {
266
305
  "member_count": number;
267
306
  "members": GameRoomMemberResponseV2[];
268
307
  "name": string;
269
- "region"?: string | null;
270
308
  "room_args"?: Record<string, unknown> | null;
271
309
  "room_args_template"?: null | RoomArgsTemplate;
272
310
  "settings"?: unknown;
@@ -279,6 +317,7 @@ type GameRoomResponseV2 = {
279
317
  "version": number;
280
318
  };
281
319
  type GameRoomSummaryResponse = {
320
+ "cluster_target_id"?: string | null;
282
321
  "created_at": number;
283
322
  "game_channel": string;
284
323
  "game_id": string;
@@ -381,16 +420,25 @@ type InventoryChange = {
381
420
  "granted": number;
382
421
  "mapping_index": number;
383
422
  "outcome": PlatformGrantOutcome;
423
+ "platform_order_id"?: string | null;
384
424
  "progression_definition_id": string;
385
425
  "reason"?: string | null;
386
426
  "requested": number;
387
427
  "target_currency_id": string;
388
428
  "type": "platform_grant";
429
+ } | {
430
+ "achievement_id": string;
431
+ "outcome": AchievementUnlockOutcome;
432
+ "points": number;
433
+ "progression_definition_id": string;
434
+ "reason"?: string | null;
435
+ "type": "achievement_unlocked";
389
436
  } | {
390
437
  "balance_after": number;
391
438
  "balance_before": number;
392
439
  "bucket": string;
393
440
  "currency_id": string;
441
+ "synthesized"?: boolean;
394
442
  "type": "currency_bucket_reset";
395
443
  } | {
396
444
  "progression_definition_id": string;
@@ -406,6 +454,7 @@ type InventoryResponse = {
406
454
  "entity_id": string;
407
455
  "etag": string;
408
456
  "items": PaginatedCollectionItemInstanceResponse;
457
+ "period_progress": PeriodProgressResponse[];
409
458
  "progressions": PaginatedCollectionProgressionStateResponse;
410
459
  "scope": InventoryScopeResponse;
411
460
  };
@@ -425,6 +474,7 @@ type ItemInstanceResponse = {
425
474
  "quantity": number;
426
475
  };
427
476
  type LeaderboardEntryResponse = {
477
+ "avatar_icon_url"?: string | null;
428
478
  "discriminator"?: string | null;
429
479
  "display_name"?: string | null;
430
480
  "display_tag"?: string | null;
@@ -571,10 +621,13 @@ type PaginatedCollectionItemInstanceResponse = {
571
621
  };
572
622
  type PaginatedCollectionProgressionStateResponse = {
573
623
  "data": {
624
+ "achievements"?: ProgressionAchievementState[];
625
+ "achievements_unavailable"?: boolean;
574
626
  "completion_count": number;
575
627
  "current_value": number;
576
628
  "is_completed": boolean;
577
629
  "progression_definition_id": string;
630
+ "updated_at": number;
578
631
  }[];
579
632
  "has_more": boolean;
580
633
  "next_cursor"?: string | null;
@@ -594,8 +647,25 @@ type PaginatedResponseSaveDataResponse = {
594
647
  "has_more": boolean;
595
648
  "next_cursor"?: string | null;
596
649
  };
597
- type PlatformGrantClamp = "none" | "max_per_event" | "game_max_per_entity" | "platform_max_per_game_per_entity" | "max_balance";
650
+ type PeriodProgressResponse = {
651
+ "completed": boolean;
652
+ "current_value": number;
653
+ "period_ends_at": number;
654
+ "period_start_at": number;
655
+ "progression_definition_id": string;
656
+ "target": number;
657
+ "window": string;
658
+ };
659
+ type PlatformGrantClamp = "none" | "max_per_event" | "game_max_per_entity" | "platform_max_per_game_per_entity" | "game_max_per_window" | "platform_max_per_window" | "max_balance";
598
660
  type PlatformGrantOutcome = "fired" | "clamped" | "suppressed";
661
+ type ProgressionAchievementState = {
662
+ "hidden": boolean;
663
+ "id": string;
664
+ "points": number;
665
+ "revoked"?: boolean;
666
+ "threshold": number;
667
+ "unlocked_at"?: number | null;
668
+ };
599
669
  type ProgressionAddRequest = {
600
670
  "amount": number;
601
671
  "reason"?: string | null;
@@ -616,20 +686,19 @@ type ProgressionStateOverride = {
616
686
  "rewards_claimed_through"?: Record<string, unknown> | null;
617
687
  };
618
688
  type ProgressionStateResponse = {
689
+ "achievements"?: ProgressionAchievementState[];
690
+ "achievements_unavailable"?: boolean;
619
691
  "completion_count": number;
620
692
  "current_value": number;
621
693
  "is_completed": boolean;
622
694
  "progression_definition_id": string;
695
+ "updated_at": number;
623
696
  };
624
697
  type PurchaseCatalogResponse = {
625
698
  "config_version": number;
626
699
  "items": CatalogItem[];
627
700
  "recipes": CatalogRecipe[];
628
701
  };
629
- type PurchasePrice = {
630
- "platform_currency_id": string;
631
- "price": number;
632
- };
633
702
  type PutSettingRequest = {
634
703
  "value": Base64String;
635
704
  };
@@ -757,6 +826,8 @@ type SlugOrId = string;
757
826
  type SuppliedBucketRow = {
758
827
  "balance": number;
759
828
  "bucket": string;
829
+ "last_reset_at"?: number | null;
830
+ "next_reset_at"?: number | null;
760
831
  };
761
832
  type SuppliedCurrencies = {
762
833
  "data"?: SuppliedCurrencyRow[];
@@ -773,6 +844,7 @@ type SuppliedInventory = {
773
844
  "entity_id"?: string | null;
774
845
  "etag"?: string;
775
846
  "items"?: SuppliedItems;
847
+ "period_progress"?: SuppliedPeriodProgressRow[];
776
848
  "progressions"?: SuppliedProgressions;
777
849
  "scope"?: null | SuppliedScope;
778
850
  };
@@ -789,11 +861,21 @@ type SuppliedItems = {
789
861
  "has_more"?: boolean;
790
862
  "next_cursor"?: string | null;
791
863
  };
864
+ type SuppliedPeriodProgressRow = {
865
+ "completed"?: boolean;
866
+ "current_value"?: number;
867
+ "period_ends_at": number;
868
+ "period_start_at": number;
869
+ "progression_definition_id": string;
870
+ "target": number;
871
+ "window": string;
872
+ };
792
873
  type SuppliedProgressionRow = {
793
874
  "completion_count": number;
794
875
  "current_value": number;
795
876
  "is_completed": boolean;
796
877
  "progression_definition_id": string;
878
+ "updated_at"?: number;
797
879
  };
798
880
  type SuppliedProgressions = {
799
881
  "data"?: SuppliedProgressionRow[];
@@ -937,12 +1019,13 @@ declare function getEntityGameSetting(api: GameApi, entity_type: string, entity_
937
1019
  }): Promise<VersionedResponse<SettingResponse>>;
938
1020
  declare function getEntityInventory(api: GameApi, entity_type: string, entity_id: string, options?: {
939
1021
  "include_buckets"?: boolean;
940
- "currency_limit"?: number;
941
- "currency_cursor"?: string;
942
- "item_limit"?: number;
943
- "item_cursor"?: string;
944
- "progression_limit"?: number;
945
- "progression_cursor"?: string;
1022
+ "include_custom_data"?: boolean;
1023
+ "currency_limit"?: number | null;
1024
+ "currency_cursor"?: string | null;
1025
+ "item_limit"?: number | null;
1026
+ "item_cursor"?: string | null;
1027
+ "progression_limit"?: number | null;
1028
+ "progression_cursor"?: string | null;
946
1029
  signal?: AbortSignal;
947
1030
  }): Promise<InventoryResponse>;
948
1031
  declare function getEntityInventoryItem(api: GameApi, entity_type: string, entity_id: string, item_definition_id: SlugOrId, options?: {
@@ -964,7 +1047,7 @@ declare function getEntityRecipeAvailability(api: GameApi, entity_type: string,
964
1047
  signal?: AbortSignal;
965
1048
  }): Promise<RecipeAvailabilityResponse>;
966
1049
  declare function getEntityRecipeUsage(api: GameApi, entity_type: string, entity_id: string, options?: {
967
- "limit"?: number;
1050
+ "limit"?: number | null;
968
1051
  signal?: AbortSignal;
969
1052
  }): Promise<RecipeUsageListResponse>;
970
1053
  declare function getEntitySave(api: GameApi, entity_type: string, entity_id: string, key: string, options?: {
@@ -996,6 +1079,9 @@ declare function getRoomArgs(api: GameApi, game_room_id: string, options?: {
996
1079
  declare function getTransferDetails(api: GameApi, transfer_id: string, options?: {
997
1080
  signal?: AbortSignal;
998
1081
  }): Promise<TransferResponse>;
1082
+ declare function ingestAnalyticsEvents(api: GameApi, body: AnalyticsBatchRequest, options?: {
1083
+ signal?: AbortSignal;
1084
+ }): Promise<AnalyticsBatchResponse>;
999
1085
  declare function initiateInventoryTransfer(api: GameApi, body: InitiateTransferRequest, options?: {
1000
1086
  signal?: AbortSignal;
1001
1087
  }): Promise<TransferResponse>;
@@ -1007,15 +1093,15 @@ declare function listEntityGameSettings(api: GameApi, entity_type: string, entit
1007
1093
  }): Promise<SettingsListResponse>;
1008
1094
  declare function listEntityOrders(api: GameApi, entity_type: string, entity_id: string, options?: {
1009
1095
  "limit"?: number;
1010
- "cursor"?: string;
1096
+ "cursor"?: string | null;
1011
1097
  signal?: AbortSignal;
1012
1098
  }): Promise<OrderListResponse>;
1013
1099
  declare function listEntityProgressions(api: GameApi, entity_type: string, entity_id: string, options?: {
1014
1100
  signal?: AbortSignal;
1015
1101
  }): Promise<ProgressionStateResponse[]>;
1016
1102
  declare function listEntitySaves(api: GameApi, entity_type: string, entity_id: string, options?: {
1017
- "limit"?: number;
1018
- "cursor"?: string;
1103
+ "limit"?: number | null;
1104
+ "cursor"?: string | null;
1019
1105
  signal?: AbortSignal;
1020
1106
  }): Promise<PaginatedResponseSaveDataResponse>;
1021
1107
  declare function listEvents(api: GameApi, options?: {
@@ -1046,9 +1132,6 @@ declare function listTransfers(api: GameApi, options: {
1046
1132
  "limit"?: number;
1047
1133
  signal?: AbortSignal;
1048
1134
  }): Promise<ListTransfersResponse>;
1049
- declare function matchEnd(api: GameApi, match_id: string, options?: {
1050
- signal?: AbortSignal;
1051
- }): Promise<void>;
1052
1135
  declare function putEntityGameSetting(api: GameApi, entity_type: string, entity_id: string, key: string, body: PutSettingRequest, options?: {
1053
1136
  ifMatch?: string;
1054
1137
  signal?: AbortSignal;
@@ -1075,4 +1158,4 @@ declare function updateGameRoomV2(api: GameApi, game_room_id: string, body: Upda
1075
1158
  ifMatch?: string;
1076
1159
  signal?: AbortSignal;
1077
1160
  }): Promise<GameRoomResponseV2>;
1078
- export { type ActiveWindowResponse, type AdminActionRequest, type BatchOrderItem, type BatchOrderItemResult, type BatchOrderRequest, type BatchOrderResponse, type BucketBalanceResponse, type CatalogItem, type CatalogRecipe, type ClientPlatform, type CreateOrderRequest, type CreateSessionRequest, type CurrencyBalanceResponse, type CurrencyResetOverride, type DropRateEntry, type DropRatesResponse, type EntityLeaderboardEntryResponse, type EntityLeaderboardResponse, type EntityType, type ErrorDetail, type ErrorResponse, type EventDefinitionResponse, type EventListResponse, type EventStatusInfo, type FidelityReport, type GameApi, type GameChannel, type GameRoomMemberResponseV2, type GameRoomResponseV2, type GameRoomSummaryResponse, type GameRoomTemplateListResponse, type GameRoomTemplateResponse, type GameRoomsListResponse, type InitiateTransferRequest, type InventoryChange, type InventoryResponse, type InventoryScopeResponse, type ItemInstanceResponse, type LeaderboardEntryResponse, type LeaderboardResponse, type ListTransfersResponse, type LootRollResultResponse, type MatchType, type OperationRequest, type OrderListResponse, type OrderRecordResponse, type OrderResponse, type OrderSource, type OrderStatus, type OverflowBehavior, type PaginatedCollectionCurrencyBalanceResponse, type PaginatedCollectionItemInstanceResponse, type PaginatedCollectionProgressionStateResponse, type PaginatedResponseSaveDataResponse, type PlatformGrantClamp, type PlatformGrantOutcome, type ProgressionAddRequest, type ProgressionClaimRequest, type ProgressionResetRequest, type ProgressionStateOverride, type ProgressionStateResponse, type PurchaseCatalogResponse, type PurchasePrice, type PutSettingRequest, type RecipeAvailabilityResponse, type RecipeExecuteRequest, type RecipeExecuteResponse, type RecipeUsageListResponse, type RecipeUsageResponse, type RoomArgType, type RoomArgsResponse, type RoomArgsTemplate, type SaveDataResponse, type SaveFinalizeRequest, type SaveUploadUrlRequest, type SaveUploadUrlResponse, type SettingResponse, type SettingsListResponse, type SimulateOrderRequest, type SimulateOrderResponse, type SimulationFailure, type SimulationOutcome, type SimulationOverrides, type SlugOrId, type SuppliedBucketRow, type SuppliedCurrencies, type SuppliedCurrencyRow, type SuppliedInventory, type SuppliedItemRow, type SuppliedItems, type SuppliedProgressionRow, type SuppliedProgressions, type SuppliedScope, type TransferCurrencyRequest, type TransferItemRequest, type TransferResponse, type UnavailabilityReason, type UpdateGameRoomRequest, type UpdateRoomArgsRequest, type WindowPreviewResponse, acceptTransfer, addEntityProgression, adminAction, cancelInventoryTransfer, claimEntityProgressionRewards, closeGameRoom, createEntityBatchOrder, createEntityOrder, createSession, deleteEntityGameSetting, deleteEntitySave, deleteSession, executeEntityRecipe, finalizeSaveUpload, getDropRates, getEntityCurrency, getEntityGameSetting, getEntityInventory, getEntityInventoryItem, getEntityLeaderboard, getEntityOrder, getEntityProgression, getEntityRecipeAvailability, getEntityRecipeUsage, getEntitySave, getEvent, getGameRoomV2, getLeaderboard, getPurchaseCatalog, getResolvedTemplate, getRoomArgs, getTransferDetails, initiateInventoryTransfer, kickPlayer, listEntityGameSettings, listEntityOrders, listEntityProgressions, listEntitySaves, listEvents, listGameRooms, listResolvedTemplates, listTransfers, matchEnd, putEntityGameSetting, putRoomArgs, rejectTransfer, requestSaveUploadUrl, resetEntityProgression, simulateEntityOrder, transferHostV2, updateGameRoomV2 };
1161
+ export { type AchievementUnlockOutcome, type ActiveWindowResponse, type AdminActionRequest, type AnalyticsBatchRequest, type AnalyticsBatchResponse, type AnalyticsEventSubmission, type AnalyticsRejection, type BatchOrderItem, type BatchOrderItemResult, type BatchOrderRequest, type BatchOrderResponse, type BucketBalanceResponse, type CatalogItem, type CatalogPrice, type CatalogRecipe, type ClientPlatform, type CreateOrderRequest, type CreateSessionRequest, type CurrencyBalanceResponse, type CurrencyResetOverride, type DropRateEntry, type DropRatesResponse, type EntityLeaderboardEntryResponse, type EntityLeaderboardResponse, type EntityType, type ErrorDetail, type ErrorResponse, type EventDefinitionResponse, type EventListResponse, type EventStatusInfo, type FidelityReport, type GameApi, type GameChannel, type GameRoomMemberResponseV2, type GameRoomResponseV2, type GameRoomSummaryResponse, type GameRoomTemplateListResponse, type GameRoomTemplateResponse, type GameRoomsListResponse, type InitiateTransferRequest, type InventoryChange, type InventoryResponse, type InventoryScopeResponse, type ItemInstanceResponse, type LeaderboardEntryResponse, type LeaderboardResponse, type ListTransfersResponse, type LootRollResultResponse, type MatchType, type OperationRequest, type OrderListResponse, type OrderRecordResponse, type OrderResponse, type OrderSource, type OrderStatus, type OverflowBehavior, type PaginatedCollectionCurrencyBalanceResponse, type PaginatedCollectionItemInstanceResponse, type PaginatedCollectionProgressionStateResponse, type PaginatedResponseSaveDataResponse, type PeriodProgressResponse, type PlatformGrantClamp, type PlatformGrantOutcome, type ProgressionAchievementState, type ProgressionAddRequest, type ProgressionClaimRequest, type ProgressionResetRequest, type ProgressionStateOverride, type ProgressionStateResponse, type PurchaseCatalogResponse, type PutSettingRequest, type RecipeAvailabilityResponse, type RecipeExecuteRequest, type RecipeExecuteResponse, type RecipeUsageListResponse, type RecipeUsageResponse, type RoomArgType, type RoomArgsResponse, type RoomArgsTemplate, type SaveDataResponse, type SaveFinalizeRequest, type SaveUploadUrlRequest, type SaveUploadUrlResponse, type SettingResponse, type SettingsListResponse, type SimulateOrderRequest, type SimulateOrderResponse, type SimulationFailure, type SimulationOutcome, type SimulationOverrides, type SlugOrId, type SuppliedBucketRow, type SuppliedCurrencies, type SuppliedCurrencyRow, type SuppliedInventory, type SuppliedItemRow, type SuppliedItems, type SuppliedPeriodProgressRow, type SuppliedProgressionRow, type SuppliedProgressions, type SuppliedScope, type TransferCurrencyRequest, type TransferItemRequest, type TransferResponse, type UnavailabilityReason, type UpdateGameRoomRequest, type UpdateRoomArgsRequest, type WindowPreviewResponse, acceptTransfer, addEntityProgression, adminAction, cancelInventoryTransfer, claimEntityProgressionRewards, closeGameRoom, createEntityBatchOrder, createEntityOrder, createSession, deleteEntityGameSetting, deleteEntitySave, deleteSession, executeEntityRecipe, finalizeSaveUpload, getDropRates, getEntityCurrency, getEntityGameSetting, getEntityInventory, getEntityInventoryItem, getEntityLeaderboard, getEntityOrder, getEntityProgression, getEntityRecipeAvailability, getEntityRecipeUsage, getEntitySave, getEvent, getGameRoomV2, getLeaderboard, getPurchaseCatalog, getResolvedTemplate, getRoomArgs, getTransferDetails, ingestAnalyticsEvents, initiateInventoryTransfer, kickPlayer, listEntityGameSettings, listEntityOrders, listEntityProgressions, listEntitySaves, listEvents, listGameRooms, listResolvedTemplates, listTransfers, putEntityGameSetting, putRoomArgs, rejectTransfer, requestSaveUploadUrl, resetEntityProgression, simulateEntityOrder, transferHostV2, updateGameRoomV2 };